Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/postfix.rs')
-rw-r--r--crates/ide-completion/src/completions/postfix.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/crates/ide-completion/src/completions/postfix.rs b/crates/ide-completion/src/completions/postfix.rs
index 540089cf91..5a3a3ac39c 100644
--- a/crates/ide-completion/src/completions/postfix.rs
+++ b/crates/ide-completion/src/completions/postfix.rs
@@ -8,6 +8,7 @@ use ide_db::{
RootDatabase, SnippetCap,
documentation::{Documentation, HasDocs},
imports::insert_use::ImportScope,
+ source_change::SnippetEdit,
syntax_helpers::suggest_name::NameGenerator,
text_edit::TextEdit,
ty_filter::TryEnum,
@@ -401,7 +402,7 @@ fn get_receiver_text(
// The receiver texts should be interpreted as-is, as they are expected to be
// normal Rust expressions.
- escape_snippet_bits(&mut text);
+ SnippetEdit::escape_snippet_bits(&mut text);
return text;
fn indent_of_tail_line(text: &str) -> usize {
@@ -411,15 +412,6 @@ fn get_receiver_text(
}
}
-/// Escapes `\` and `$` so that they don't get interpreted as snippet-specific constructs.
-///
-/// Note that we don't need to escape the other characters that can be escaped,
-/// because they wouldn't be treated as snippet-specific constructs without '$'.
-fn escape_snippet_bits(text: &mut String) {
- stdx::replace(text, '\\', "\\\\");
- stdx::replace(text, '$', "\\$");
-}
-
fn receiver_accessor(receiver: &ast::Expr) -> ast::Expr {
receiver
.syntax()