aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/inlay_hints.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 8cb0c70dd..e2da96129 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir::{HirDisplay, SourceAnalyzer}; 3use hir::{HirDisplay, SourceAnalyzer, SourceBinder};
4use once_cell::unsync::Lazy; 4use once_cell::unsync::Lazy;
5use ra_prof::profile; 5use ra_prof::profile;
6use ra_syntax::{ 6use ra_syntax::{
@@ -29,22 +29,23 @@ pub(crate) fn inlay_hints(
29 file: &SourceFile, 29 file: &SourceFile,
30 max_inlay_hint_length: Option<usize>, 30 max_inlay_hint_length: Option<usize>,
31) -> Vec<InlayHint> { 31) -> Vec<InlayHint> {
32 let mut sb = SourceBinder::new(db);
32 file.syntax() 33 file.syntax()
33 .descendants() 34 .descendants()
34 .flat_map(|node| get_inlay_hints(db, file_id, &node, max_inlay_hint_length)) 35 .flat_map(|node| get_inlay_hints(&mut sb, file_id, &node, max_inlay_hint_length))
35 .flatten() 36 .flatten()
36 .collect() 37 .collect()
37} 38}
38 39
39fn get_inlay_hints( 40fn get_inlay_hints(
40 db: &RootDatabase, 41 sb: &mut SourceBinder<RootDatabase>,
41 file_id: FileId, 42 file_id: FileId,
42 node: &SyntaxNode, 43 node: &SyntaxNode,
43 max_inlay_hint_length: Option<usize>, 44 max_inlay_hint_length: Option<usize>,
44) -> Option<Vec<InlayHint>> { 45) -> Option<Vec<InlayHint>> {
45 let _p = profile("get_inlay_hints"); 46 let _p = profile("get_inlay_hints");
46 let analyzer = 47 let db = sb.db;
47 Lazy::new(|| SourceAnalyzer::new(db, hir::InFile::new(file_id.into(), node), None)); 48 let analyzer = Lazy::new(move || sb.analyze(hir::InFile::new(file_id.into(), node), None));
48 match_ast! { 49 match_ast! {
49 match node { 50 match node {
50 ast::LetStmt(it) => { 51 ast::LetStmt(it) => {