vscode-csharp: Format code returns: Sorry, but there is no formatter for 'csharp'-files installed.
Environment data
dotnet --info
output:
.NET Command Line Tools (2.1.2)
Product Information:
Version: 2.1.2
Commit SHA-1 hash: 5695315371
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
VS Code version: Version 1.19.2 Commit 490ef761b76b3f3b3832eff7a588aac891e5fe80 Date 2018-01-10T16:16:25.767Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture ia32 C# Extension version: 1.13.1
Steps to reproduce
I did got extension C# FixFormat installed. I uninstalled it and after that i constantly just receive “Sorry, but there is no formatter for ‘csharp’-files installed”. Feels like omnisharp doesn’t install that part any more, i tried to reinstall omnisharp without success.
I didn’t find any errors or messages from omnisharp log or vscode developer console. Didn’t try debugmodes though.
Expected behavior
Format is invoked.
Actual behavior
Format is not invoked and error “Sorry, but there is no formatter for ‘csharp’-files installed.” appear in vscode.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 30 (15 by maintainers)
Ah got it, there was line
"csharp.format.enable": false,
in my user config, after cleared that it started working again. C# fixformat extensions seems to set it, tested to install it after cleared user settings …However other issues mentioned here may not be releated to this. Should this issue be closed or?
I checked that and it is true. I don’t have any other extensions installed. When u install it by default it should be set true. I removed any data related to extensions before I installed.
CaosEngine is correct. When opening a workspace project, or opening a lone .cs file outside of a folder project, it refuses to format the code. I doubt this is the intended behaviour. Somehow omnisharp needs to be registered as the default provider for formating, even when not using a folder project.
I know this issue is closed but I am getting the same error on visual studio code 1.22.2 on Windows 10. Version 1.22.2 Commit 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9 Date 2018-04-12T16:38:45.278Z Shell 1.7.12 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64
I uninstalled all the extensions, reinstalled Visual Studio Code and still getting the same error.
This one worked for me https://marketplace.visualstudio.com/items?itemName=Leopotam.csharpfixformat
It is ridiculous that Microsoft can’t even provide a formatter for their own language.
For those who’ve confirmed that
"csharp.format.enable"
is set totrue
and you’re still having the issue, it’s being tracked over here: https://github.com/OmniSharp/omnisharp-vscode/issues/2391issue occurred on vs.code Version 1.21.1 Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1 Date 2018-03-14T14:46:47.128Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64
dotnet --info: Product Information: Version: 2.1.101 Commit SHA-1 hash: 6c22303bf0
Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.101\
Microsoft .NET Core Shared Framework Host
Version : 2.0.6 Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d
@ssurba The “Miscellaneous” file is loaded into the omnisharp workspace once the user starts editing the file. Did you try to make some changes in the file. It “should” give you basic instellisense. Also, note that you must open the folder in vscode in which the file is contained.