aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/call_info.rs4
-rw-r--r--crates/ra_ide_api/src/imp.rs2
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs14
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index 798fb7c13..0449c1902 100644
--- a/crates/ra_ide_api/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
@@ -23,8 +23,8 @@ pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<Cal
23 .into_iter() 23 .into_iter()
24 .find(|it| it.ptr.kind() == FN_DEF)?; 24 .find(|it| it.ptr.kind() == FN_DEF)?;
25 let fn_file = db.source_file(symbol.file_id); 25 let fn_file = db.source_file(symbol.file_id);
26 let fn_def = symbol.ptr.resolve(&fn_file); 26 let fn_def = symbol.ptr.to_node(&fn_file);
27 let fn_def = ast::FnDef::cast(&fn_def).unwrap(); 27 let fn_def = ast::FnDef::cast(fn_def).unwrap();
28 let mut call_info = CallInfo::new(fn_def)?; 28 let mut call_info = CallInfo::new(fn_def)?;
29 // If we have a calling expression let's find which argument we are on 29 // If we have a calling expression let's find which argument we are on
30 let num_params = call_info.parameters.len(); 30 let num_params = call_info.parameters.len();
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index fa79908a1..ddd9354ec 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -153,7 +153,7 @@ impl db::RootDatabase {
153 source_binder::function_from_child_node(db, position.file_id, name_ref.syntax())?; 153 source_binder::function_from_child_node(db, position.file_id, name_ref.syntax())?;
154 let scope = descr.scopes(db); 154 let scope = descr.scopes(db);
155 let resolved = scope.resolve_local_name(name_ref)?; 155 let resolved = scope.resolve_local_name(name_ref)?;
156 let resolved = resolved.ptr().resolve(source_file); 156 let resolved = resolved.ptr().to_node(source_file);
157 let binding = find_node_at_offset::<ast::BindPat>(syntax, resolved.range().end())?; 157 let binding = find_node_at_offset::<ast::BindPat>(syntax, resolved.range().end())?;
158 Some((binding, descr)) 158 Some((binding, descr))
159 } 159 }
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index b563dfe88..1b5d1eb1d 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -27,13 +27,13 @@ use std::{
27 27
28use fst::{self, Streamer}; 28use fst::{self, Streamer};
29use ra_syntax::{ 29use ra_syntax::{
30 SyntaxNode, SourceFile, SmolStr, TreeArc, AstNode, 30 SyntaxNode, SyntaxNodePtr, SourceFile, SmolStr, TreeArc, AstNode,
31 algo::{visit::{visitor, Visitor}, find_covering_node}, 31 algo::{visit::{visitor, Visitor}, find_covering_node},
32 SyntaxKind::{self, *}, 32 SyntaxKind::{self, *},
33 ast::{self, NameOwner}, 33 ast::{self, NameOwner},
34}; 34};
35use ra_db::{ 35use ra_db::{
36 SourceRootId, FilesDatabase, LocalSyntaxPtr, 36 SourceRootId, FilesDatabase,
37 salsa::{self, ParallelDatabase}, 37 salsa::{self, ParallelDatabase},
38}; 38};
39use rayon::prelude::*; 39use rayon::prelude::*;
@@ -62,7 +62,7 @@ fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex>
62 62
63 for (name, text_range) in hir::source_binder::macro_symbols(db, file_id) { 63 for (name, text_range) in hir::source_binder::macro_symbols(db, file_id) {
64 let node = find_covering_node(source_file.syntax(), text_range); 64 let node = find_covering_node(source_file.syntax(), text_range);
65 let ptr = LocalSyntaxPtr::new(node); 65 let ptr = SyntaxNodePtr::new(node);
66 symbols.push(FileSymbol { file_id, name, ptr }) 66 symbols.push(FileSymbol { file_id, name, ptr })
67 } 67 }
68 68
@@ -196,13 +196,13 @@ fn is_type(kind: SyntaxKind) -> bool {
196pub(crate) struct FileSymbol { 196pub(crate) struct FileSymbol {
197 pub(crate) file_id: FileId, 197 pub(crate) file_id: FileId,
198 pub(crate) name: SmolStr, 198 pub(crate) name: SmolStr,
199 pub(crate) ptr: LocalSyntaxPtr, 199 pub(crate) ptr: SyntaxNodePtr,
200} 200}
201 201
202fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, LocalSyntaxPtr)> { 202fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr)> {
203 fn decl<N: NameOwner>(node: &N) -> Option<(SmolStr, LocalSyntaxPtr)> { 203 fn decl<N: NameOwner>(node: &N) -> Option<(SmolStr, SyntaxNodePtr)> {
204 let name = node.name()?.text().clone(); 204 let name = node.name()?.text().clone();
205 let ptr = LocalSyntaxPtr::new(node.syntax()); 205 let ptr = SyntaxNodePtr::new(node.syntax());
206 Some((name, ptr)) 206 Some((name, ptr))
207 } 207 }
208 visitor() 208 visitor()