Preferences > Settings

问题描述 投票:0回答:1
Type "save" in the search box

In the list, choose Text Editor

我想...

const $tab_a = $('tab_a')
const $tab_b = $('tab_b')

;[$tab_a, $tab_b].forEach($e => $e.onclick = () => {
  if ($e.className) return
  $tab_a.classList.toggle('active')
  $tab_b.classList.toggle('active')
})

当我保存时,避免自动缩进行为

const $tab_a = $('tab_a')
const $tab_b = $('tab_b')

  ;[$tab_a, $tab_b].forEach($e => $e.onclick = () => {
    if ($e.className) return
    $tab_a.classList.toggle('active')
    $tab_b.classList.toggle('active')
  })

在Visual Studio代码中的一个(javascript)文件中,没有关闭完全的自动缩进。

  1. 我有这样的代码(如果可能的话,我想保留这个缩进)。
  2. 然而,每次我用Visual Studio Code保存时,它都会改变缩进的方式。
  3. 我在Visual Studio Code中尝试了不同的设置。

编辑器:自动缩进(默认:全)。自动缩进(默认:全)-> none.

编辑。包裹缩进(默认:相同) -> none。

所有组合和重启VSCode的方法不幸的是,他们中的任何一个都对我有用。

任何帮助将是非常感激它。
javascript visual-studio-code save indentation
1个回答
1
投票

  1. 当我在Visual Studio Code中保存一个(javascript)文件时,我想避免自动缩进行为,而不关闭完全的自动缩进。我有这样的代码(我想保持这个缩进......
  2. 要关闭保存时的格式化。
  3. 转到 锉刀
  4. 它应该被默认设置为false,但可能某些扩展功能被切换为true,所以只要把它改回false即可。希望能帮到你

"editor.formatOnSave" false

© www.soinside.com 2019 - 2024. All rights reserved.