Luk*_*dic 9 vue.js visual-studio-code
我在输入 .vue 文件时遇到了括号不能自动关闭的问题。我使用visual-studio-code作为我的编辑器,并且在设置中将自动结束括号设置为“始终”。HTML 标签会自动关闭,问题仅在 .vue 文件中,而在 .js/.jsx 文件中输入时一切正常,括号和引号自动关闭。有想法该怎么解决这个吗?
Moh*_*lal 29
For the people that installed Github copilot extension!
Know that it does override settings! And it's a cause!
I never thought about auto closing brackets! It always worked! Till this time it just ceased to do!
You can check this here: https://github.com/microsoft/vscode/issues/127739
Even if you are setting
"editor.autoClosingBrackets": "always",
Run Code Online (Sandbox Code Playgroud)
It will still not work!
This might be defined by an extension. Are you by any chance using copilot?
You can know why by this 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" }
Run Code Online (Sandbox Code Playgroud)
A guy had it not work for js and typescript! And work out of the box for PHP!
I had copilot installed too!
You can just add:
"[typescript]": { "editor.autoClosingBrackets": "languageDefined" }
"[javascript]": { "editor.autoClosingBrackets": "languageDefined" }
Run Code Online (Sandbox Code Playgroud)
to your settings!
Now it's working again!
You can also disable copilot extension! I didn't want to!
Know too that this copilot issue! Will no more be an issue soon enough! As mentionned in the comment above! You can think about updating it and vscode and check on the next update!
| 归档时间: |
|
| 查看次数: |
3455 次 |
| 最近记录: |