visual-studio-code - VS Code - 函数括号前的空格

标签 visual-studio-code

在 VS Code 中编辑函数时,是否可以禁用删除括号前的空格?

假设我有一个功能

function render () {
    // some code here
}

当我开始编辑它时,VS Code 会删除括号前的空格并将此代码转换为:
function render() {
    // some code here
}

有没有办法禁用这种行为?

最佳答案

  • 在 VS Code 中打开文件 -> 首选项 -> 设置
  • 添加到您的 JSON 配置:
  • "javascript.format.insertSpaceBeforeFunctionParenthesis": true
    function render () {
        // some code here
    }

    "javascript.format.insertSpaceBeforeFunctionParenthesis": false
    function render() {
        // some code here
    }


  • 现在您可以继续使用您的自动格式化选项 "editor.formatOnType": true
  • 关于visual-studio-code - VS Code - 函数括号前的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41150726/

    相关文章:

    c - 为什么 sprintf() 会生成问号字符作为输出?

    JavaFX-11 与 VSCode

    visual-studio-code - VSCODE 准确的键绑定(bind),想知道当前上下文。怎么做?

    javascript - VSCode Intellisense 突然停止对所有工作区工作

    delphi - 如何将 OmniPascal 安装到 vscode 中

    node.js - 如何使用 VSCode 通过 Firestore 触发器调试 Google Cloud Functions?

    cmake - 使用一些选项为 CMake 配置 Visual Studio Code

    html - 如何在 Visual Studio Code 中格式化保存 HTML-Eex 文件?

    c# - Visual Studio Code - 单击类/方法名称 -> 显示定义

    debugging - 如何在VSCode中调试AWS SAM制作的应用程序?