Visual studio code 如何禁用Visual Studio代码';s C++;访问修饰符缩进? 代码版本1.150似乎会极大地改变C++代码中访问修改器的缩进,尽管禁用AutoDutoMand FalATONType。

Visual studio code 如何禁用Visual Studio代码';s C++;访问修饰符缩进? 代码版本1.150似乎会极大地改变C++代码中访问修改器的缩进,尽管禁用AutoDutoMand FalATONType。,visual-studio-code,Visual Studio Code,当我输入以下内容时: class Foo { public: Foo(); }; 键入“public:”后,我一按enter键,它就会被重新格式化为: class Foo { public: Foo(); }; 在我的用户设置中,我将“editor.autoIndent”和“editor.formatOnType”设置为false。我还将C++扩展集中的“CpCPP格式”设置为“禁用”。 是否有某种方法可以控制此行为?是否尝试将此选项设置为false "C_Cpp.c

当我输入以下内容时:

class Foo
{
    public:
    Foo();
};
键入“public:”后,我一按enter键,它就会被重新格式化为:

class Foo
{
public:
    Foo();
};
在我的用户设置中,我将“editor.autoIndent”和“editor.formatOnType”设置为false。我还将C++扩展集中的“CpCPP格式”设置为“禁用”。
是否有某种方法可以控制此行为?

是否尝试将此选项设置为false

"C_Cpp.clang_format_formatOnSave": false,
编辑

还可以查看此选项:

editor.formatOnSave

您是否尝试将此选项设置为false

"C_Cpp.clang_format_formatOnSave": false,
编辑

还可以查看此选项:

editor.formatOnSave

我找到了一种方法,通过修改C++语言配置文件来实现这一点。它位于Microsoft VS代码目录中:resources/app/extension/cpp/language-configuration.json

我删除了“IncremaseIndentPattern”和“decreaseIndentPattern”中与访问修饰符相关的项


<>这是可行的,但是直接编辑文件看起来是个坏主意。

我找到了一个方法,通过修改C++语言配置文件。它位于Microsoft VS代码目录中:resources/app/extension/cpp/language-configuration.json

我删除了“IncremaseIndentPattern”和“decreaseIndentPattern”中与访问修饰符相关的项


这是可行的,但直接编辑文件似乎不是个好主意。

我将其设置为false。它不会改变行为。所有这些都是false:“editor.formatType”:false,“editor.formatOnPaste”:false,“editor.formatOnSave”:false,“editor.autoIndent”:false我也在使用vscode v1.15.0,但没有遇到这个问题。也许你应该再次检查你的用户配置,或者尝试重新安装c/c++扩展。我把它设置为false。它不会改变行为。所有这些都是false:“editor.formatType”:false,“editor.formatOnPaste”:false,“editor.formatOnSave”:false,“editor.autoIndent”:false我也在使用vscode v1.15.0,但没有遇到这个问题。也许您应该再次检查您的用户配置,或者尝试重新安装c/c++扩展。