mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-19 00:31:19 +00:00
Auto merge of #12646 - lowr:fix/11897, r=lowr
fix: escape receiver texts in completion This PR fixes #11897 by escaping '\\' and '$' in the text of the receiver position expression. See [here](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax) for the specification of the snippet syntax (especially [this section](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#grammar) discusses escaping). Although not all occurrences of '\\' and '$' have to be replaced, I chose to replace all as that's simpler and easier to understand. There *are* more clever ways to implement it, but I thought they were premature optimization for the time being (maybe I should put FIXME notes?).
This commit is contained in:
commit
f3e9b38e26
3 changed files with 84 additions and 15 deletions
|
@ -17,7 +17,7 @@
|
|||
// "body": [
|
||||
// "thread::spawn(move || {",
|
||||
// "\t$0",
|
||||
// ")};",
|
||||
// "});",
|
||||
// ],
|
||||
// "description": "Insert a thread::spawn call",
|
||||
// "requires": "std::thread",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue