gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 09:01:41 32 4
gpt4 key购买 nike

在 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/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com