简体   繁体   English

如何在Visual Studio代码版本1.31.3中关闭自动格式设置(系统设置程序)

[英]How to turn off auto formatting in visual studio code Version: 1.35.1 (system setup)

I am using visual studio code for my Node JS application with mustache templating. 我正在使用带有胡子模板的Node JS应用程序使用Visual Studio代码。 I have below code in one of my html files : 我的其中一个html文件中包含以下代码:

<script>
 {{{interface}}}
</script>

Due to auto formatting on save, it turns out to be a below (space added between braces): 由于保存时会自动格式化,因此结果显示为以下(括号之间添加空格):

<script>
     { { { interface } } }
  </script>

This is giving below error on browser console: 这在浏览器控制台上显示以下错误:

Uncaught ReferenceError: interface is not defined

I have tried to set editor.formatOnSave to false but could not find this switch. 我试图将editor.formatOnSave设置为false,但是找不到此开关。

Below is my version info on VS Code: 以下是我在VS Code上的版本信息:

Version: 1.35.1 (system setup)
Commit: c7d83e57cd18f90026a8162d042843yui1bcf27m
Date: 2019-06-12T15:16:14.389Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT ia32 10.0.17134

How to get rid of this auto format feature on save? 如何在保存时摆脱这种自动格式化功能?

There is definitely a setting for that option. 该选项肯定有一个设置。 See picture below. 见下图。

Note that VS Code provides two different scopes for settings: 请注意,VS Code提供了两种不同的设置范围:

  • User Settings - Settings that apply globally to any instance of VS Code you open. 用户设置 -全局应用于您打开的任何VS Code实例的设置。

  • Workspace Settings - Settings stored inside your workspace and only apply when the workspace is opened. 工作区设置 -存储在工作区中的设置 ,仅在打开工作区时适用。

Also please see the Edit in settings.json settings at the end of the screen. 另外,请参见屏幕结尾处的Edit in settings.json设置中的“ Edit in settings.json ”。 If you switch to older view you can manually edit the settings file. 如果切换到较旧的视图,则可以手动编辑设置文件。 See answer for that 看到答案

保存设置格式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM