Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An update on the LSP-powered, Visual Studio Code C# Extension #5708

Closed
timheuer opened this issue Jun 6, 2023 · 45 comments
Closed

An update on the LSP-powered, Visual Studio Code C# Extension #5708

timheuer opened this issue Jun 6, 2023 · 45 comments
Assignees

Comments

@timheuer
Copy link
Member

timheuer commented Jun 6, 2023

Last summer, the .NET team announced a plan to evolve the .NET Tooling ecosystem and incorporate more capabilities into Visual Studio Code. We appreciated your responses to that announcement, which were essential for us to determine the best path for improving the C# Extension and overall C# dev experience in VS Code. Building on that initial announcement and your feedback, today we released an update to the C# Extension that creates a more performant, reliable C# experience in VS Code by powering it with a new Language Server Protocol (LSP) server. This server communicates by default to Roslyn and Razor but allows users to choose an alternative language server. This updated, open-source extension is available today in the VS Code Marketplace exclusively as a pre-release version of the C# extension. The move of the repo and open sourcing of the extension code will take place in one week, on June 13. We are coordinating with a few individuals and teams to get the smoothest repo move possible.

Based on the community feedback from last year’s initial announcement, we decided to keep all components for this extension (including the LSP host) fully open source. We are committed to keeping the C# Extension and other components like Razor and Roslyn open source, and we are committed to further improving the quality and reliability of this extension over time.

As part of this effort, we also moved the C# for VS Code extension from github.com/OmniSharp/omnisharp-vscode to github.com/dotnet/vscode-csharp (in progress so not yet available). We will continue to monitor this new repo for feedback and provide regular updates to the extension until we are confident enough in the quality and feature capabilities to remove the Preview label. To get started using the new features, you must opt in to “Switch to Pre-release Version,”, which will install the new LSP-based extension.

csdevkit-switchtoprerelease

You can also choose to revert from the LSP version to the OmniSharp version of the C# extension by first uninstalling the C# Dev Kit and then setting the dotnet.server.useOmnisharp to true. This will require a restart but will revert to using the original OmniSharp-powered extension. In the coming releases, the team is working to update the extension so that it can communicate with OmniSharp Server via LSP. Note that using the new C# Dev Kit extension requires the LSP-based extension to be running to work.

Thanks for sharing your feedback so far! We look forward to continuing to improve and expand on your C# development experience in VS Code and Visual Studio.

@Igorgro
Copy link

Igorgro commented Jun 6, 2023

Thank you for this great decision! While I understand why Microsoft wants to keep closed-sourced such features as IntelliCode, I still do not understand why it was decided to move solution explorer and unit test features to closed-source extension. 😕 It looks not too unpleasant, but rather unclear, because this a very simple features to implement in comparison to LSP for example. Will you accept the community contribution which will bring that features to open-source extension?

@thargy
Copy link

thargy commented Jun 6, 2023

Really positive step forward. I think we would have liked a little more communication, rather than this surprise (to me at least) announcement.

However, credit where credit is due - making this Open Source is a very good decision and gives me hope that C# can continue into the future in a strong position. This is such an important decision with the massive increase in choice and alternatives in the last few years. There is now hope that C# language support in VSCode can compete on an even footing.

Thank you!

@TrieBr
Copy link

TrieBr commented Jun 6, 2023

This is great! After years of dealing with issues in VSCode, I had actually gave up last week and installed Rider. I'm very happy to see this announcement at the perfect time to give VSCode a second chance. Well done! Looking forward to trying it.

@tmitchel2
Copy link

Hallelujah, this is amazing. The dev kit seems to work really well on first usage, not personally fussed about that part being closed source.

@Meligy
Copy link

Meligy commented Jun 6, 2023

Thanks a lot for the great work. It's also amazing to see the C# Dev Kit announcement mentioning debugging, another key area that could use some love.

I have a question if you may. Is IntellliCode supposed to work side by side with GitHub Copilot? In the past they seemed to do pretty much the same thing, so I kept only Copilot, but this seems different in the context of C# development.

@phillip-haydon
Copy link

This is really good to hear! Well done! I honestly thought MS was going to regress, but this is a really great step forward!

@therealbluepandabear
Copy link

It's encouraging to witness companies actively paying attention to community feedback, which has become quite uncommon nowadays. From a company standpoint, prioritizing open-source development tools would be immensely advantageous in the long run, and it's something developers at Microsoft should keep in mind.

@ghuntley
Copy link
Member

ghuntley commented Jun 7, 2023

Great outcome. Time to update http://ghuntley.com/facture / https://isdotnetopen.com once the repo is open?

  • What license will the tooling be released under? Will it be mixed or have terms that it can only be used by "Visual Studio Code" (ie. prohibiting usage on competition to GitHub Codespaces such as Gitpod, Coder or open-source editors such as vscodium or Theia?)
  • What's the status of the debugger being closed off? Any resolution here? Kindly reconsider the licensing for .NET Core debugging libraries core#505
@NCLnclNCL
Copy link

I will try it

@bjorkstromm
Copy link
Contributor

@ghuntley

  • What license will the tooling be released under? Will it be mixed or have terms that it can only be used by "Visual Studio Code" (ie. prohibiting usage on competition to GitHub Codespaces such as Gitpod, Coder or open-source editors such as vscodium or Theia?)

While I'm unsure what the license of Microsoft.CodeAnalysis.LanguageServer.exe is, I can see that some of the dependencies are licensed under the problematic "MICROSOFT VISUAL STUDIO ADD-ONs and EXTENSIONS" license. I created an issue for it in the Roslyn repo dotnet/roslyn#68463

@chickenSandwich
Copy link

Does anyone know how to customize formatting c# using the pre-release?
For example I currently use the file omnisharp.json to set formatting options:

{
    "FormattingOptions": {
        "NewLinesForBracesInLambdaExpressionBody": false,
        "NewLinesForBracesInAnonymousMethods": false,
        "NewLinesForBracesInAnonymousTypes": false,
        "NewLinesForBracesInControlBlocks": false,
        "NewLinesForBracesInTypes": false,
        "NewLinesForBracesInMethods": false,
        "NewLinesForBracesInProperties": false,
        "NewLinesForBracesInObjectCollectionArrayInitializers": false,
        "NewLinesForBracesInAccessors": false,
        "NewLineForElse": false,
        "NewLineForCatch": false,
        "NewLineForFinally": false
    },
    "RoslynExtensionsOptions": {
        "enableDecompilationSupport": true
    }
}
@Meligy
Copy link

Meligy commented Jun 7, 2023

Does anyone know how to customize formatting c# using the pre-release? For example I currently use the file omnisharp.json to set formatting options:

{
    "FormattingOptions": {
        "NewLinesForBracesInLambdaExpressionBody": false,
        "NewLinesForBracesInAnonymousMethods": false,
        "NewLinesForBracesInAnonymousTypes": false,
        "NewLinesForBracesInControlBlocks": false,
        "NewLinesForBracesInTypes": false,
        "NewLinesForBracesInMethods": false,
        "NewLinesForBracesInProperties": false,
        "NewLinesForBracesInObjectCollectionArrayInitializers": false,
        "NewLinesForBracesInAccessors": false,
        "NewLineForElse": false,
        "NewLineForCatch": false,
        "NewLineForFinally": false
    },
    "RoslynExtensionsOptions": {
        "enableDecompilationSupport": true
    }
}

Have you tried the equivalent settings in .editorconfig?

Docs:
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?view=vs-2022

@chickenSandwich
Copy link

Does anyone know how to customize formatting c# using the pre-release? For example I currently use the file omnisharp.json to set formatting options:

{
    "FormattingOptions": {
        "NewLinesForBracesInLambdaExpressionBody": false,
        "NewLinesForBracesInAnonymousMethods": false,
        "NewLinesForBracesInAnonymousTypes": false,
        "NewLinesForBracesInControlBlocks": false,
        "NewLinesForBracesInTypes": false,
        "NewLinesForBracesInMethods": false,
        "NewLinesForBracesInProperties": false,
        "NewLinesForBracesInObjectCollectionArrayInitializers": false,
        "NewLinesForBracesInAccessors": false,
        "NewLineForElse": false,
        "NewLineForCatch": false,
        "NewLineForFinally": false
    },
    "RoslynExtensionsOptions": {
        "enableDecompilationSupport": true
    }
}

Have you tried the equivalent settings in .editorconfig?

Docs: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?view=vs-2022

Thank-you. That works very well. I added .editorconfig to my home directory:

#  CSharp formatting rules:
[*.cs]
csharp_new_line_before_open_brace = none
@ivanjx
Copy link

ivanjx commented Jun 7, 2023

cross projects renaming (method, class, etc) does not work yet

@itsmuntadhar
Copy link

Does it work with .NET 8 (i.e. preview) SDK projects? because a project targeting .NET8 was full of errors unlike .NET6/7

@itsmuntadhar
Copy link

It seems there is no way to "unload" a project. e.g. a project that uses WinUI causes problem when loading the whole solution on macOS

@timheuer
Copy link
Member Author

timheuer commented Jun 7, 2023

cross projects renaming (method, class, etc) does not work yet

Please feel free to log an issue -- we can track specific issues easier

@timheuer
Copy link
Member Author

timheuer commented Jun 7, 2023

Does it work with .NET 8 (i.e. preview) SDK projects? because a project targeting .NET8 was full of errors unlike .NET6/7

microsoft/vscode-dotnettools#15

@timheuer
Copy link
Member Author

timheuer commented Jun 7, 2023

It seems there is no way to "unload" a project. e.g. a project that uses WinUI causes problem when loading the whole solution on macOS

I'm assuming you mean in this instance using the C# Dev Kit specifically? If so, please feel free to log an issue on this one. We've been discussing solution filters as well. For now what I've done is multiple .sln files (to serve as the 'filter')

@NCLnclNCL
Copy link

It seems there is no way to "unload" a project. e.g. a project that uses WinUI causes problem when loading the whole solution on macOS

I'm assuming you mean in this instance using the C# Dev Kit specifically? If so, please feel free to log an issue on this one. We've been discussing solution filters as well. For now what I've done is multiple .sln files (to serve as the 'filter')

hey bro errors with new verssion
Downloading the .NET Runtime.
Downloading .NET version(s) 7.0.5 .............. Error!
Failed to download .NET 7.0.5:
Command failed: powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 ; & 'd:\VSCode-win32-x64-1.78.2\data\extensions\ms-dotnettools.vscode-dotnet-runtime-1.6.0\dist\install scripts\dotnet-install.ps1' -InstallDir 'd:\VSCode-win32-x64-1.78.2\data\user-data\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\7.0.5' -Version 7.0.5 -Runtime dotnet }
There is not enough disk space on drive D:
At D:\VSCode-win32-x64-1.78.2\data\extensions\ms-dotnettools.vscode-dotnet-runtime-1.6.0\dist\install
scripts\dotnet-install.ps1:1115 char:9

@CyrusNajmabadi
Copy link
Member

@NCLnclNCL

There is not enough disk space on drive D:

That does not look like something we can help with :)

@NCLnclNCL
Copy link

NCLnclNCL commented Jun 7, 2023

@NCLnclNCL

There is not enough disk space on drive D:

That does not look like something we can help with :)

no bro, i have 200 gb in disk space

@CyrusNajmabadi
Copy link
Member

@NCLnclNCL Might want to report this over at dotnet/runtime. They can have someone who owns the installation experience look into this. We just call into the normal dotnet install script. thanks. :)

@danmoseley
Copy link
Member

dotnet-install.ps1 is in https://github.com/dotnet/install-scripts and that's the best place to open an issue for it.

@neorth
Copy link

neorth commented Jun 8, 2023

Will there be decompilation support like we had in Omnisharp?

@zhen8838
Copy link

zhen8838 commented Jun 8, 2023

@timheuer the new language server to definition can't go to the source file.

2023-06-08.19.47.33.mov
@TrieBr
Copy link

TrieBr commented Jun 8, 2023

I can't get this preview version working at all on Mac. Even basic things like an Exception is not being highlighted correctly , (Go to definition doesn't work, etc).
Screenshot 2023-06-08 at 7 52 07 AM

@tmitchel2
Copy link

@TrieBr I suspect you might not have installed the extension yet, it's actually a new extension called "C# Dev Kit"... I had a similar issue initially

@Igorgro
Copy link

Igorgro commented Jun 8, 2023

@tmitchel2 , no, C# Dev Kit is not required for this features to work

@TrieBr
Copy link

TrieBr commented Jun 8, 2023

I had both C# and C# Dev Kit installed. I disabled them all and re-enabled and now it seems to be working!

It seems my only remaining issue now is dotnet/razor#5901

Edit: This is such a drastic improvement. Great work!

@Tomeroeni
Copy link

Nice work!
I do find it rather annoying that the solution explorer doesn't have a "Track active item" feature.

@ghost
Copy link

ghost commented Jun 9, 2023

I had multiple issues where when ctrl-clicking/F12 an item this would send me to the assembly file instead of the source file.

Went back to Omnisharp until resolved

@timheuer
Copy link
Member Author

timheuer commented Jun 9, 2023

I had multiple issues where when ctrl-clicking/F12 an item this would send me to the assembly file instead of the source file.

Went back to Omnisharp until resolved

I think you are hitting -- which we have a fix for coming soon: microsoft/vscode-dotnettools#40

@Tomeroeni
Copy link

Copy/paste files inside of the solution explorer isn't doing anything either.

@timheuer
Copy link
Member Author

Copy/paste files inside of the solution explorer isn't doing anything either.

Can you please log an issue using the "Report an Issue" capability...this is related to the C# Dev Kit and not the language service.

@Code-DJ
Copy link

Code-DJ commented Jun 13, 2023

Nit pick: all the extension icons are 128x128 instead of 256x256. Appear blurred on retina display on the extension details page in VS Code. Not sure if that qualifies as a bug or a feature request :)

@timheuer
Copy link
Member Author

Nit pick: all the extension icons are 128x128 instead of 256x256. Appear blurred on retina display on the extension details page in VS Code. Not sure if that qualifies as a bug or a feature request :)

Would you mind logging a bug so we can track that request -- we want to make sure to maximize your pixels ;-)

@jasonmalinowski
Copy link
Member

For the folks who were having issues with go to definition not working, we've shipped an update this morning for the C# extension that should address those issues. Thanks for the reporst!

@tmitchel2
Copy link

@jasonmalinowski I still have the go to definition issue (mac os, devkit 0.1.103, net sdk 7.0.304). I don't see any errors in the output windows apart from

[LanguageServerHost]Ignoring diagnostics request for untracked document: file:///Users/*******/File.cs

in the C# output window.

Is there any suggested way to get better output / logging to float the issue?

@jasonmalinowski
Copy link
Member

@tmitchel2 Ah, looks like you have something else going on then. Can you open another bug and we'll take up the conversation there?

@tmitchel2
Copy link

An existing issue is open here > microsoft/vscode-dotnettools#135. I've just realised that the new version you mentioned was unfortunately the source of my issues, I've downgraded and the issues have gone away.

@VeithBuergerhoff
Copy link

Is anyone else having trouble with windows defender?
The .exe Files in the node dependencies are not signed (.vscode\extensions\ms-dotnettools.csdevkit-0.1.103-win32-x64\components\vs-green-server\platforms\win32-x64\node_modules\@microsoft\visualstudio-server.win32-x64\Microsoft.VisualStudio.Code.Server.exe and .vscode\extensions\ms-dotnettools.csdevkit-0.1.103-win32-x64\components\vs-green-server\platforms\win32-x64\node_modules\@microsoft\visualstudio-code-launcher.win32-x64\Microsoft.VisualStudio.Code.Launcher.exe) while the dlls are.

@dmitry-azaraev
Copy link

@jasonmalinowski I have same issue in form [LanguageServerHost]Ignoring diagnostics request for untracked document: file:///Users/*******/File.cs in the C# output window. I'm using extension without C# Dev Kit. Seems like it works, but it completely did not see types from framework assemblies, e.g. Console.WriteLine is completely unknown. Tested on simple new console project with clean vscode config. This not floating issue, it just not working at all.

Also, there is questionable why all of this stuff download own copy of .NET 7.0.X runtime, is globally installed runtime is not enough?

@jasonmalinowski
Copy link
Member

An existing issue is open here > microsoft/vscode-dotnettools#135. I've just realised that the new version you mentioned was unfortunately the source of my issues, I've downgraded and the issues have gone away.

@tmitchel2: oh interesting, yes, that's not good! Could you file a new bug in this repo and we'll take the investigation from there? If you could include the full C# log if possible that'd be a help.

@timheuer timheuer self-assigned this Jun 16, 2023
@timheuer
Copy link
Member Author

Thanks everyone for the comments here on this update. This thread has started to turn in to some specific support/issues a bit, which we want to better accurately track for you and get the fix discussions happening in the right place.

If you encounter issues with the C# Extension you can log them directly from within VS Code (Report an Issue) which will log directly on the repo or simply log issues directly on the repo at https://github.com/dotnet/vscode-csharp/issues. (Please note that the C# Dev Kit issues are tracked https://github.com/microsoft/vscode-dotnettools.)

I'm closing this announcement issue for now.

@mikadumont mikadumont unpinned this issue Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet