Snippet transformation does not work with nested snippets
See original GitHub issueVS Code version: Code 1.51.1 (e5a624b788d92b8d34d1392e4c4d9789406efe8f, 2020-11-10T23:34:32.027Z) OS version: Windows_NT x64 10.0.18363
I’ve written a snippet that transforms TypeScript interfaces to JSON key-values where the key is the name of the TS property and the value is the name of the type.
Example:
// input:
{
myFirstProp: string;
mySecondProp: number;
}
// output:
{
myFirstProp: 'string',
mySecondProp: 'number',
}
This is the snippet source:
"body": [
"$1",
"\n${1/([A-Za-z0-9]+): ([A-Za-z]+).*/$1: '$2',/gm}"
]
When the snippet is active and I’m typing the TS interface, I get the suggestion/autocomplete while typing. If I hit ESC before typing the semicolon that ends each line, then the snippet works great. But if I don’t hit ESC, the snippet stops executing.
Steps to Reproduce:
I’ve recorded two gifs using a keylogger that lets you see which keys I’m hitting. Note that I’m on a Swedish keyboard, which the keylogger doesn’t seem to support, so when I type :
it will display it as >
and when I type ;
it will display <
.
Here’s when I’m hitting escape before the semicolon:
Here’s when I don’t hit escaoe before the semicolon, which makes the snippet stop executing:
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
fyi - we have “F1 > Toggle Screencast Mode” which might be more true wrt what you are typing
Yeah, this is a bug that snippet transformations don’t work on nested snippet invocation (which completions are)