Closed Lambozhuang closed 2 years ago
Hi @Lambozhuang, could you try html.autoCreateQuotes
?
@Lambozhuang I tried it in my environment and could not reproduce the problem.
volar.autoCreateQuotes
is false
by default. Works with =
typing, if volar.autoCreateQuotes
is true
.
It is possible that volar.autoCreateQuotes
is set to true
somewhere in your environment.
https://user-images.githubusercontent.com/188642/160254873-ca94bc11-d289-4ddd-8da7-99ae9b3fcaba.mp4
Hi @Lambozhuang, could you try
html.autoCreateQuotes
?
Hi, I already set this to false and in native HTML files it works just fine. It's just the vue files that still create quotes.
And I haven't set the volar.autoCreateQuotes
anywhere and I don't have any local coc config files.
Here is a screenshot and a video:(I'm not sure if you can open the link)
This is about feature involving volar.autoCreateQuotes
or html.autoCreateQuotes
settings.
""
is automatically inserted after the attribute name when typing =
.
| is the cursor position
class|
class=|
class="|"
""
is automatically insertedIt is not a feature that controls ""
of class=""
in the completion item.
@yaegassy Sorry I didn't quite get it. What I meant was whenever I want to type, let's say the attribute "class", I usually type "cla" and the LS would give the hint down below, and I would press TAB on my keyboard to choose one of the hints. And if I stay at the "class~" one, the quotes will automatically be created, and the cursor will be placed after the second quote instead of inside the two quotes, which I think that's a bit of uncomfortable. If I misunderstand this feature, my apologies. Thanks for the help anyway 😃
For items with ~
suffix, try using CTRL + y
key. For example, class~
would be class="|"
.
Other keys, such as Enter, can also be used. In this case, check the README.md or Wiki of "coc.nvim" and add the following settings to your .vimrc
or init.vim
Hi, @Lambozhuang
The html.completion.attributeDefaultValue
setting will be respected at the next volar language server update.
Perhaps this is the behavior you were looking for.
"html.completion.attributeDefaultValue": "empty",
@yaegassy Exactly! Actually I already set this to false when I was testing the html files. Because the volar manual doesn't mention this attribute, so I didn't bring it up when I found the problem. Now I'm thinking that these two attributes might have a bit of conflicts?
The latest version of volar's language server has been published to npm. coc-volar
has also upgraded the langauge server.
Please update @yaegassy/coc-volar
.
Even the option volar.autoCreateQuotes set to false, it will still create quotes when typing html attributes.