Skip to content
This repository has been archived by the owner on Dec 14, 2019. It is now read-only.

Commit

Permalink
Finesse the behavior of Jsonnet auto-close symbols
Browse files Browse the repository at this point in the history
vscode allows extension writers to customize "autoclose", e.g., when we
type the `{` character, we might wish for vscode to insert a
corresponding character `}` after the cursor.

This commit will change the auto-close behavior for the characters `{`,
`[`, and `'`.

For the case of `{` and `[`, this is straightforward: we close these
with `},` and `],`, respectively; the comma is included because Jsonnet
optionally allows commas after objects and lists in the vast majority of
circumstances, and it's more convenient to include it than to have the
user type it.

The `'` character is slightly more subtle. Currently if we're in a
comment, and we type the single quote character, vscode will add another
to close it. Normally this is useful, but in this case, it's vastly more
likely that we're using the single quote to write an English contraction
than anything else, and in this case, we do not want to close the quote.
  • Loading branch information
hausdorff committed Mar 13, 2017
1 parent ebb9c85 commit 7191d25
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions language-configuration.json
Expand Up @@ -11,11 +11,12 @@
],
// Symbols that are auto closed when typing.
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
{ "open": "{", "close": "}," },
{ "open": "[", "close": "]," },
{ "open": "(", "close": ")" },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "/**", "close": " */", "notIn": ["string"] }
],
// Symbols that that can be used to surround a selection.
"surroundingPairs": [
Expand Down

0 comments on commit 7191d25

Please sign in to comment.