Visual Studio代码不格式化C#代码 [英] Visual Studio Code doesn't format C# code
问题描述
我创建了一个新文件,设置了C#语言,并编写了一些代码.然后按 Ctrl + Shift + F (或 F1 → Format Document ).并得到了我的错误
I created a new file, set the C# language, and wrote some code. Then I pressed Ctrl + Shift + F (or F1 → Format Document). And got I the error
对不起,但是没有安装'csharp'文件的格式化程序.
Sorry, but there is no formatter for 'csharp'-files installed.
另外,我安装了 C#Extension ,但没有帮助.Visual Studio Code版本为1.18.0.
Also, I installed C# Extension, but it didn't help. The Visual Studio Code version is 1.18.0.
推荐答案
这对我有用.
注意:如果为 true
,则清除该复选框并将其再次设置为true.之后,您必须重新启动Visual Studio Code.
Note: If it is true
then clear the checkbox and set it to true again. After that, you must restart Visual Studio Code.
菜单文件→首选项→设置→
Menu File → Preferences → Settings →
这篇关于Visual Studio代码不格式化C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!