-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
Escaping closing brackets in snippet choices results in backslashes being inserted #201059
Comments
This actually repros without the backslashes when using appendChoice:
Although it's possible that bit will be fixed by #180132 |
related: #200424 |
I see how the docs make you believe so but it is a misunderstanding. Generally, only things that have a "syntax-meaning" need to be escaped. |
Gotcha - so the only thing to escape in a choice is the pipe I'm happy to send a PR with my guess at what that is if you'd review it - I'd like to ensure our server (and the LSP spec) are correct |
The current text reads like you can escape $ and } where not strictly necessary, but according to VS Code's behaviour and microsoft/vscode#201059 this is not the case - you may only escape the characters that are _required_ to be escaped, otherwise you'll see backslashes in the output.
The current text reads like you can escape $ and } where not strictly necessary, but according to VS Code's behaviour and microsoft/vscode#201059 this is not the case - you may only escape the characters that are required to be escaped, otherwise you'll see backslashes in the output.
The current text reads like you can escape $ and } where not strictly necessary, but according to VS Code's behaviour and microsoft/vscode#201059 this is not the case - you may only escape the characters that are required to be escaped, otherwise you'll see backslashes in the output.
microsoft/vscode-docs#6928 was merged with doc updates for VS Code. The same change in LSP is open at microsoft/language-server-protocol#1868. |
The current text reads like you can escape $ and } where not strictly necessary, but according to VS Code's behaviour and microsoft/vscode#201059 this is not the case - you may only escape the characters that are _required_ to be escaped, otherwise you'll see backslashes in the output. Co-authored-by: Dirk Bäumer <dirkb@microsoft.com>
Both the PRs above have been merged. |
In the docs here it says:
My understanding of this is that
}
can be escaped with a\
for all kinds of snippets.However, if I create a snippet that uses choices and escapes a bracket, the backslash appears as-is in the choice:
If it is not allowed to escape
}
for choices, then I think it should be clearer from the docs (and the same docs in LSP).Note: I can't use the
appendChoice()
API because these snippets are being returned over LSP from a language server (and such, it's important the docs are accurate and specific, to ensure servers and clients have the same understandings).The text was updated successfully, but these errors were encountered: