Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volar does not respect "Editor: Auto Closing Quotes" setting when writing attributes in templates #840

Closed
its-dlh opened this issue Jan 4, 2022 · 9 comments
Labels
question Further information is requested

Comments

@its-dlh
Copy link

its-dlh commented Jan 4, 2022

When you start typing something like class= the Volar extension tries to be helpful and adds a pair of quotes automatically.

image

I'm sure this is an intended feature. However, this disregards the setting in VS Code that allows the developer to disable "Editor: Auto Closing Quotes".

image

Personally, I find auto quotes or brackets distracting, as I don't expect characters to appear without my input, so I have that setting set to "never". I'm sure that I'm in the minority on that preference, given the fact that the setting is enabled by default, but I do think I'm justified in expecting an extension to respect this preference, or to add a setting of its own to disable auto quotes.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Jan 5, 2022
@johnsoncodehk
Copy link
Member

This is by new html config html.autoCreateQuotes and it is not release yet, you need to add "html.autoCreateQuotes": false to settings manually for now, see https://github.com/microsoft/vscode/blob/f0054e049cd286ff317c738efe0fd8810b48ae98/extensions/html-language-features/package.json#L200-L205.

@johnsoncodehk johnsoncodehk added question Further information is requested and removed bug Something isn't working labels Jan 5, 2022
@its-dlh
Copy link
Author

its-dlh commented Jan 5, 2022

Ah, thanks, and sorry to bother you.

@johnsoncodehk
Copy link
Member

Never mind, thanks for your report. :)

@its-dlh
Copy link
Author

its-dlh commented Jan 5, 2022

Just out of curiosity, why does it only seem to affect my Vue templates and not pure HTML files or PHP or things like that?

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jan 5, 2022

vscode do not release a new version with this feature yet. This feature does not rely on vscode client upgrades, so Volar can release this feature earlier than vscode.

@its-dlh
Copy link
Author

its-dlh commented Jan 5, 2022

Ah, so it's an upcoming part of the spec, but the implementation is left up to extension maintainers rather than being built into VS Code itself?

If the implementation is custom, do you have control over which quote gets overtyped? If I type = and then ", I would expect the opening quote to get overtyped, but instead the opening quote stays in place, and the closing quote gets overtyped. Is it known yet how VS Code's core implementation will handle this?

@johnsoncodehk
Copy link
Member

HTML extension is built-in support by vscode, I just refer to the code of vscode to add it for vue.

If the implementation is custom, do you have control over which quote gets overtyped? If I type = and then ", I would expect the opening quote to get overtyped, but instead the opening quote stays in place, and the closing quote gets overtyped. Is it known yet how VS Code's core implementation will handle this?

I just follow the logic of vscode. You can open an issue in vscode. If vscode decides to change this logic, volar will change it together.

FYR https://github.com/microsoft/vscode/blob/main/extensions/html-language-features/client/src/autoInsertion.ts

@its-dlh
Copy link
Author

its-dlh commented Jan 5, 2022

Gotcha, thanks!

@keithbrink
Copy link

keithbrink commented Mar 21, 2022

@johnsoncodehk There seems to be a regression on Volar where it doesn't respect the "html.autoCreateQuotes": false setting:

0c9d7a33-32e2-459c-bd16-173bc5f2e2d8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants