diff options
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index e744e82d0..1d58d9e71 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -71,7 +71,7 @@ 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); | 74 | let source_file = &db.parse(frange.file_id).tree; |
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 | ||
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index 9afcac01a..cabb3d862 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -283,7 +283,7 @@ impl AstBuilder<ast::NameRef> { | |||
283 | } | 283 | } |
284 | 284 | ||
285 | fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { | 285 | fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> { |
286 | let file = SourceFile::parse(text); | 286 | let file = SourceFile::parse(text).tree; |
287 | let res = file.syntax().descendants().find_map(N::cast).unwrap().to_owned(); | 287 | let res = file.syntax().descendants().find_map(N::cast).unwrap().to_owned(); |
288 | res | 288 | res |
289 | } | 289 | } |
@@ -292,7 +292,7 @@ mod tokens { | |||
292 | use once_cell::sync::Lazy; | 292 | use once_cell::sync::Lazy; |
293 | use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T}; | 293 | use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T}; |
294 | 294 | ||
295 | static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;")); | 295 | static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree); |
296 | 296 | ||
297 | pub(crate) fn comma() -> SyntaxToken<'static> { | 297 | pub(crate) fn comma() -> SyntaxToken<'static> { |
298 | SOURCE_FILE | 298 | SOURCE_FILE |
@@ -326,7 +326,7 @@ mod tokens { | |||
326 | 326 | ||
327 | impl WsBuilder { | 327 | impl WsBuilder { |
328 | pub(crate) fn new(text: &str) -> WsBuilder { | 328 | pub(crate) fn new(text: &str) -> WsBuilder { |
329 | WsBuilder(SourceFile::parse(text)) | 329 | WsBuilder(SourceFile::parse(text).ok().unwrap()) |
330 | } | 330 | } |
331 | pub(crate) fn ws(&self) -> SyntaxToken<'_> { | 331 | pub(crate) fn ws(&self) -> SyntaxToken<'_> { |
332 | self.0.syntax().first_child_or_token().unwrap().as_token().unwrap() | 332 | self.0.syntax().first_child_or_token().unwrap().as_token().unwrap() |