muhammadsammy / free-vscode-csharp

Free/Libre fork of the official C# extension for vscode

Home Page:https://open-vsx.org/extension/muhammad-sammy/csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conflict with official C# extension installed, how to set FreeOmnisharp as default?

opened this issue · comments

Some extensions like C# snippets require the official ms-dotnettools version of C# extension to be installed and enabled.

If I have both Official C# and FreeOmnisharp C# extensions, how do you set in launch.json which one to use for debugging? When I press F5 it uses the official one to run the debugger not this one.

A lot of popular extensions depend on the official one.

Environment data

dotnet --info output: .NET 5.0.102 SDK Installed
VS Code version: Latest
C# Extension version: Latest

Steps to reproduce

  1. Install the Microsoft Official C# extension for VS Code
  2. Install the Free Omnisharp VSCode Extension
  3. Run the program, uses official MS C# by default

Expected behavior

  • Be able to set the default extension to use as FreeOmnisharp
  • OR
  • Allow third-party extensions to think Microsoft Official C# is installed

Actual behavior

  • Debugger runs with official c# extension not with FreeOmnisharp
  • Disabling or removing microsoft C# extension makes it impossible to use other extenions that depend on it.

I don't know if vscode can choose one to be the default or not.
But you can change the C# key inside the extensionDependencies key of package.json of an extension source from ms-dotnettools.csharp to muhammad-sammy.csharp and build that extension's vsix file from source.

Or you can change all occurrences of ms-dotnettools.csharp in an installed extension in .vsixmanifest and package.json files at $HOME/.vscode-oss/extensions/EXTENSION_FOLDER/ and do this for every update for that extension.


Another solution would be to build free-omnisharp-vscode extension from source but change the extension id before building at:

https://github.com/muhammadsammy/free-omnisharp-vscode/blob/f0ec1d43becef701c43b9587463e28a95e70b33f/src/constants/CSharpExtensionId.ts#L6

and at
https://github.com/muhammadsammy/free-omnisharp-vscode/blob/f0ec1d43becef701c43b9587463e28a95e70b33f/package.json#L3

It has improved in the meantime. For example Roslynator supports our version and also it should be reported to the upstream repositories if they depend on official C# extension. Let's close that one.