Giter Site home page Giter Site logo

devlooped / smallsharp Goto Github PK

View Code? Open in Web Editor NEW
277.0 5.0 12.0 6.87 MB

Create, edit and run multiple C# top-level programs in the same project by just selecting the startup program from the start button.

Home Page: https://clarius.org/SmallSharp

License: MIT License

C# 98.24% Ruby 0.35% SCSS 1.41%
csharp-sourcegenerator console-application learning visual-studio csharp

smallsharp's Issues

When changing active files quickly, opening startup file may fail

This manifests in a "program is busy" indicator and a Debug.Fail (in debug builds), when we invoke File.OpenFile via the DTE.

Add some resiliency there, with some timeout and retries so that we can give VS time to respond to user actions before we run our command.

Renaming file crashes Visual Studio

VS 16.8.5

SmallSharp 1.0.1

After renaming cs file using F2 in Solution Explorer Visual Studio crashes.

Rename one or two times, try to run.

20210212_102653

Generator cannot be used

Hi,
upon trying out your generator a compiler warning is emitted:
Generator 'LaunchSettingsGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.'

My repro is here:
https://gist.github.com/MichalBrylka/17a2b66c2885450278ba9ceaca5fdea8

Also - have you considered testing of such generators. Normal approach does not seem to work here, see:
https://gist.github.com/MichalBrylka/933bd1313a097bec63cabd0ac02fc29b

you cannot create a compilation with 2+ top level programs to begin with.

Failure with VS 16.10 preview

The build always fails with SmallSharp requires Visual Studio 16.8 or greater..

This is because the comparison of MSBuild short version (i.e. 16.8 vs 16.10) is
not done numerically, but as a string, resulting in 16.10 being smaller than 16.8. This
didn't surface before because 16.9 is lexicographically greater than 16.8, but now that's
no longer the case.

Populate launchSettings with candidate top-level compile files

We used to do this via a C# source generator, but stopped doing it because it interferred with the compilation and sometimes broke intellisense.

Now we have a more reliable auto-selection mechanism based on detecting the active document. In some rare cases, however, the IDE detection stops working and it's impossible to select the actual target we want to run.

We should bring back the launchSettings.json generation, but base it entirely on MSBuild instead, so we don't interfere at all with any of the built-in stuff that's already working. We should also run this right after we select the startup file, so it's basically a complement, not a replacement.

Make SmallSharp a development dependency

Since it's just a development aid, you might want to use it in your actual
console app development (i.e. a dotnet global tool) but not want it to
become an actual dependency of your package.

Adding new C# file should result in a new startup file

Currently, when adding a new C# file to the project, an infobar error shows up and the file does not become the new startup file.

Both may be related, since a non-startup file would be marked as None content and by the time the text buffer is being initialized, it might already have assumed the item would be a Compile item, failing to initialize intellisense properly for it since it was turned into a non-compile item under the editor's feet.

This seems to also cause more or less random disablement of intellisense from that point on, making things less predictable.

So we should just fix our logic and welcome the new file as the new startup file instead :)

Editor exception from VS log
System.ArgumentNullException: Value cannot be null.
Parameter name: filePath

   at Microsoft.VisualStudio.CodeSense.Editor.Roslyn.CodeElementTag..ctor(SyntaxNodeInfo syntaxNodeInfo, String filePath, DocumentId documentId, Workspace workspace, Guid projectGuid)
      at Microsoft.VisualStudio.CodeSense.Editor.Roslyn.CodeElementTagger.GetTag(Int32 lineNumber)
         at Microsoft.VisualStudio.CodeSense.Editor.Tagger`1.<GetTagsCore>d__28.MoveNext()
            at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__47.MoveNext()
            --- End of stack trace from previous location where exception was thrown ---
               at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.