vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

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

Open timheuer opened this issue 3 years ago • 44 comments

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.

timheuer avatar Jun 06 '23 20:06 timheuer

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?

Igorgro avatar Jun 06 '23 21:06 Igorgro

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!

thargy avatar Jun 06 '23 21:06 thargy

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.

TrieBr avatar Jun 06 '23 22:06 TrieBr

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

tmitchel2 avatar Jun 06 '23 22:06 tmitchel2

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.

Meligy avatar Jun 06 '23 22:06 Meligy

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

phillip-haydon avatar Jun 07 '23 00:06 phillip-haydon

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? https://github.com/dotnet/core/issues/505

ghuntley avatar Jun 07 '23 03:06 ghuntley

I will try it

NCLnclNCL avatar Jun 07 '23 05:06 NCLnclNCL

@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 https://github.com/dotnet/roslyn/issues/68463

bjorkstromm avatar Jun 07 '23 05:06 bjorkstromm

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
    }
}

chickenSandwich avatar Jun 07 '23 06:06 chickenSandwich

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

Meligy avatar Jun 07 '23 06:06 Meligy

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

chickenSandwich avatar Jun 07 '23 06:06 chickenSandwich

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

ivanjx avatar Jun 07 '23 07:06 ivanjx

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

itsmuntadhar avatar Jun 07 '23 07:06 itsmuntadhar

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

itsmuntadhar avatar Jun 07 '23 07:06 itsmuntadhar

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

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

timheuer avatar Jun 07 '23 14:06 timheuer

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

https://github.com/microsoft/vscode-dotnettools/issues/15

timheuer avatar Jun 07 '23 14:06 timheuer

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')

timheuer avatar Jun 07 '23 14:06 timheuer

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

NCLnclNCL avatar Jun 07 '23 14:06 NCLnclNCL

@nclnclncl

There is not enough disk space on drive D:

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

CyrusNajmabadi avatar Jun 07 '23 15:06 CyrusNajmabadi