视觉工作室代码中的自动关闭括号不适用于 Vue 文件 [英] Auto closing brackets in visual-studio-code not working for Vue files

查看:19
本文介绍了视觉工作室代码中的自动关闭括号不适用于 Vue 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在输入 .vue 文件时遇到括号无法自动关闭的问题.我使用 Visual-studio-code 作为我的编辑器,并且我将自动结束括号设置为始终".在设置中.HTML 标签会自动关闭,问题仅在 .vue 文件中,而在 .js/.jsx 文件中输入时一切正常,括号和引号自动关闭.有关如何解决此问题的任何想法?

解决方案

对于安装了 Github copilot 扩展的人!

知道它确实覆盖设置!这是原因

我从没想过自动关闭括号!它总是有效!直到这个时候它才停止做!

您可以在这里查看:

现在又可以使用了!

您还可以禁用copilot 扩展程序!我不想!

也知道这个副驾驶问题!很快就不会再有问题了!正如上面评论中提到的!可以考虑更新和vscode,看看下次更新!

I have a problem with brackets not auto closing while typing in .vue files. I use visual-studio-code as my editor and i have auto closing brackets set to "always" in settings. HTML tags do self close, and the problem is only in .vue files, while typing in .js/.jsx files everything works normally, brackets and quotation marks auto close. Any ideas on how to fix this?

解决方案

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",

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" }

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" }

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!

这篇关于视觉工作室代码中的自动关闭括号不适用于 Vue 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆