Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make vscode autocomplete HTML tag's attribute with single quote?

As I prefer single quote in HTML, how can I configure my VScode editor to autocomplete HTML tag's attribute's value string with single quotes?

I've tried installing Prettier and set "prettier.singleQuote": true

or set

"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single"

or set configs for Emmet:

"emmet.syntaxProfiles": {
    "html": {
        "attr_quotes": "single"
    }
}

But these options won't affect HTML auto-completion.

So when I type something like: <meta charset= and hit Enter VScode will complete with double quotes:

<meta charset=""

How to get the result like:

<meta charset=''
like image 793
Escape0707 Avatar asked Nov 06 '22 17:11

Escape0707


1 Answers

There is a new setting just merged into Insiders v1.62:

html.completion.attributeDefaultValue

with the options: empty | singleQuotes | doubleQuotes

doubleQuotes is the default.

See https://github.com/microsoft/vscode/pull/129284 and https://github.com/microsoft/vscode/commit/8d70e049dd1f15ce1f4a114c801b71aa9183c00b

attribute quotes setting - single, double or none

like image 185
Mark Avatar answered Nov 15 '22 06:11

Mark