Handle backslash escapes in snippet completion text #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ondrejmirtes/lsp-client:snippet-escapes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Snippet completion items (insertTextFormat: Snippet) carry LSP snippets, which
use
\$,\}and\\for literal characters. serverCompletion translated the$1tab stops to
${1}but passed the escapes through to CodeMirror's snippetparser unchanged, so e.g. a method completion with insertText
"add(${1:\$x})$0"came out as
add(\$x)instead ofadd($x).This unescapes
\$,\}and\\in the snippet translation, and adds a test.The insertText of a snippet completion is an LSP snippet, where \$, \} and \\ are escapes for literal characters. We translated $1 tab stops to ${1} but left the escapes alone and handed them to CodeMirror's snippet parser, which doesn't understand them. So a completion like add(${1:\$x})$0 was inserted as add(\$x) instead of add($x). Unescape \$, \} and \\ as well.Thanks! Merged as
1371912bbfPull request closed