Visual Studio代码不格式化C#代码 [英] Visual Studio Code doesn't format C# code

查看:88
本文介绍了Visual Studio代码不格式化C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新文件,设置了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 F1Format 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 FilePreferencesSettings

这篇关于Visual Studio代码不格式化C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆