diff options
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 0ba5f3ae6..34b207154 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -71,11 +71,11 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { | |||
71 | where | 71 | where |
72 | F: FnOnce(AssistCtx<DB>) -> T, | 72 | F: FnOnce(AssistCtx<DB>) -> T, |
73 | { | 73 | { |
74 | let source_file = &db.parse(frange.file_id).tree; | 74 | let parse = db.parse(frange.file_id); |
75 | let assist = | 75 | let assist = |
76 | if should_compute_edit { Assist::Resolved(vec![]) } else { Assist::Unresolved(vec![]) }; | 76 | if should_compute_edit { Assist::Resolved(vec![]) } else { Assist::Unresolved(vec![]) }; |
77 | 77 | ||
78 | let ctx = AssistCtx { db, frange, source_file, should_compute_edit, assist }; | 78 | let ctx = AssistCtx { db, frange, source_file: parse.tree(), should_compute_edit, assist }; |
79 | f(ctx) | 79 | f(ctx) |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index ba816eb65..7b743c9f0 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -278,8 +278,8 @@ impl AstBuilder<ast::NameRef> { | |||
278 | } | 278 | } |
279 | 279 | ||
280 | fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { | 280 | fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { |
281 | let file = SourceFile::parse(text).tree; | 281 | let parse = SourceFile::parse(text); |
282 | let res = file.syntax().descendants().find_map(N::cast).unwrap().to_owned(); | 282 | let res = parse.tree().syntax().descendants().find_map(N::cast).unwrap().to_owned(); |
283 | res | 283 | res |
284 | } | 284 | } |
285 | 285 | ||
@@ -287,7 +287,8 @@ mod tokens { | |||
287 | use once_cell::sync::Lazy; | 287 | use once_cell::sync::Lazy; |
288 | use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T}; | 288 | use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T}; |
289 | 289 | ||
290 | static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree); | 290 | static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = |
291 | Lazy::new(|| SourceFile::parse(",\n; ;").tree().to_owned()); | ||
291 | 292 | ||
292 | pub(crate) fn comma() -> SyntaxToken<'static> { | 293 | pub(crate) fn comma() -> SyntaxToken<'static> { |
293 | SOURCE_FILE | 294 | SOURCE_FILE |