vue.js - Visual Studio Code 中的自动关闭括号不适用于 Vue 文件

标签 vue.js visual-studio-code

我在输入 .vue 文件时遇到了括号不能自动关闭的问题。我使用visual-studio-code作为我的编辑器,并且在设置中将自动结束括号设置为“始终”。 HTML 标签会自动关闭,问题仅在 .vue 文件中,而在 .js/.jsx 文件中输入时一切正常,括号和引号自动关闭。有想法该怎么解决这个吗?

最佳答案

对于安装了 Github copilot extension 的人!
知道它确实如此覆盖设置 !它是 一个原因 !
我从没想过自动关闭括号!它总是有效!直到这个时候它才停止做!
你可以在这里检查:
https://github.com/microsoft/vscode/issues/127739
即使你正在设置

"editor.autoClosingBrackets": "always",
还是不行!

This might be defined by an extension. Are you by any chance using copilot?


你可以通过这个知道为什么comment :

Copilot is defining these default language settings that can be overwritten only using language specific settings. They do that to workaround an issue in vscode tracked at #125663 . Once we ship our next stable release (sometime this week), they will be free to remove that workaround. Until then you can disable the extension if you are not in the preview program yet or you can define the language specific setting e.g.:


"[typescript]": { "editor.autoClosingBrackets": "languageDefined" }
一个人让它不适用于 js 和 typescript !并为 PHP 开箱即用!
我有 副驾驶 也安装了!
您只需添加:
"[typescript]": { "editor.autoClosingBrackets": "languageDefined" }
"[javascript]": { "editor.autoClosingBrackets": "languageDefined" }
到您的设置!
enter image description here
enter image description here
enter image description here
现在它又开始工作了!
您也可以禁用 副驾驶 延期!我不想!
也知道这个副驾驶问题!很快就不会再有问题了!正如上面评论中提到的!你可以考虑更新它和vscode并检查下一次更新!

关于vue.js - Visual Studio Code 中的自动关闭括号不适用于 Vue 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64086068/

相关文章:

javascript - 输入字段的动态数量

javascript - 使用 Raw-Loader 将 SVG 标记嵌入 vue-component 中

visual-studio-code - 禁用 React JavaScript 文件中的 VS Code Stylelint 错误

vue.js - Vue 没有定义 Bootstrap-vue

node.js - 在 Google App Engine 上部署 Vuejs - webpack webapp

javascript - 无法从导入中引入 Vue,但如果我将它引入 html 文件中,则可以访问它

visual-studio-code - 是否可以在VsCode扩展中捆绑预组合的二进制文件?

visual-studio-code - VSCode 语言特定的背景颜色,如 Notepad++

ruby - 在 Visual Studio Code 中,如何让 # 自动替换为 Ruby 字符串中的 #{}

visual-studio-code - 有没有办法使用 VS Code 任务运行命令?