Open ppo opened 7 months ago
After many tests and trials this is what I got to work: "togglequotes.chars": ["\"", "'", "`", "<,>", "[,]", "(,)", "{,}"]
You can also add the pairs by opening up the Toggle Quotes extension settings and clicking add item for each pair: <,> (,) [,] {,} which will give you the above togglequotes.chars entry in settings.json
You can also add the pairs by opening up the Toggle Quotes extension settings and clicking add item for each pair: <,> (,) [,] {,} which will give you the above togglequotes.chars entry in settings.json
How did you get it to work?
Through "Add item", I have been adding the following:
[,]
, (,)
and {,}
but the only thing it seems to do is to change "test"
into 'test'
and then 'test'
into [,]test[,]
...
and then it raises an error Cannot read properties of undefined (reading 'begin')
I also tried to force togglequotes.chars": [""", "'", "
", "<,>", "[,]", "(,)", "{,}"]` directly in the extension settings ...
but result is basically the same: 'X', [-1, 0, 0]: 'X'
change into 'X[,], [-1, 0, 0]: [,]X'
instead of the desired 'X', (-1, 0, 0): 'X'
when the content of the brackets is selected
inpecting more in detail the code, I was finally able to get it working. Impossible for me to alter the settings through vs-code, as any value I would enter would be considered as string
but I was finally able to get the desired behavious through editing directly the settings file (and multiples uninstall / install) as such:
"togglequotes.chars": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"\"",
"'",
["[", "]"],
["(", ")"],
["{", "}"]
],
"description": "The quote characters to toggle between.",
"scope": "language-overridable"
}
Oddly, my previous solution stopped working, but what I have working now in my settings.json is:
"togglequotes.chars": [
"\"",
"'",
"`",
["<", ">"],
["[", "]"],
["(", ")"],
["{", "}"]
]
vscode will scream about the types being incorrect, but it works.
Just to update my last post, it seemed like the extension had started failing again. Then I realized it was working in some files but not others. So for some languages it wasn't enough to just have the brackets added to the default configuration. I had to add them under the vscode settings for the language where it was failing as well.
Toggling Brackets
The README says
Also available different start and end of wrap characters: </>, [/], «/» etc.
but it doesn't seem to work, or at least I don't understand how to make it work. I don't find any documentation about that.I tried the following, using the standard keyboard shortcut
Cmd + '
, in a Python file, on this linev = [0, 1]
:[
,]
,(
, and)
.0, 1
and[0, 1]
.Multiple Config
Is it possible to configure multiple lists? Like this:
It would also be useful to be able to configure different keyboard shortcuts. For example to have one acting on quotes and another one on brackets; so that we don't have to select, it finds the closest type around the cursor.