rust-analyzer/crates/ide-completion/src/completions
bors f3e9b38e26 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?).
2022-07-20 10:51:31 +00:00
..
attribute fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30
item_list fix: Improve self param completion applicability 2022-07-16 12:28:41 +02:00
postfix fix: escape receiver texts in format string completion 2022-06-27 23:20:23 +09:00
attribute.rs fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30
dot.rs Check for local IDs belong to same definition 2022-07-17 11:43:08 +05:00
expr.rs fix: variants rendering in pattern path 2022-07-02 20:31:24 +09:00
extern_abi.rs Only run completion functions if their corresponding context is active 2022-06-17 23:36:39 +02:00
field.rs Even more completion context filtering 2022-06-20 14:23:46 +02:00
flyimport.rs Fix config keys regarding imports in docs 2022-07-11 15:43:25 +09:00
fn_param.rs fix: Improve self param completion applicability 2022-07-16 12:28:41 +02:00
format_string.rs Only run completion functions if their corresponding context is active 2022-06-17 23:36:39 +02:00
item_list.rs fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30
keyword.rs Even more completion context filtering 2022-06-20 14:23:46 +02:00
lifetime.rs Only run completion functions if their corresponding context is active 2022-06-17 23:36:39 +02:00
mod_.rs Split remaining completion calls on the context kinds 2022-06-20 13:17:30 +02:00
pattern.rs fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30
postfix.rs Add comments 2022-07-20 19:11:14 +09:00
record.rs internal: Simplify some completions 2022-06-20 21:55:33 +02:00
snippet.rs internal: Simplify some completions 2022-06-20 21:55:33 +02:00
type.rs check arg_idx >= n_params only if arg_idx >= n_required_params 2022-07-07 00:54:46 +08:00
use_.rs fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30
vis.rs fix(completion): super:: completion at crate root and module depth 2022-07-14 17:07:43 +05:30