yaegassy / coc-volar

Volar (Fast Vue Language Support) extension for coc.nvim
https://www.npmjs.com/package/@yaegassy/coc-volar
MIT License
272 stars 6 forks source link

Configuration volar.autoCreateQuotes set to false not working #132

Closed Lambozhuang closed 2 years ago

Lambozhuang commented 2 years ago

Even the option volar.autoCreateQuotes set to false, it will still create quotes when typing html attributes.

johnsoncodehk commented 2 years ago

Hi @Lambozhuang, could you try html.autoCreateQuotes?

yaegassy commented 2 years ago

@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

Lambozhuang commented 2 years ago

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)

Screen Shot 2022-03-27 at 13 48 09

https://user-images.githubusercontent.com/57835575/160268383-45a2ebc5-5690-4bd8-a88f-c543795a729c.mp4

yaegassy commented 2 years ago

This is about feature involving volar.autoCreateQuotes or html.autoCreateQuotes settings.

"" is automatically inserted after the attribute name when typing =.

| is the cursor position

It is not a feature that controls "" of class="" in the completion item.

Lambozhuang commented 2 years ago

@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 😃

yaegassy commented 2 years ago

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

yaegassy commented 2 years ago

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

coc-volar-issue-132-image-1
Lambozhuang commented 2 years ago

@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?

yaegassy commented 2 years ago

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.