aboutsummaryrefslogtreecommitdiff
path: root/crates/libeditor/src/completion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libeditor/src/completion.rs')
-rw-r--r--crates/libeditor/src/completion.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/crates/libeditor/src/completion.rs b/crates/libeditor/src/completion.rs
index 2756e472a..7e8669822 100644
--- a/crates/libeditor/src/completion.rs
+++ b/crates/libeditor/src/completion.rs
@@ -14,6 +14,7 @@ use {
14#[derive(Debug)] 14#[derive(Debug)]
15pub struct CompletionItem { 15pub struct CompletionItem {
16 pub name: String, 16 pub name: String,
17 pub snippet: Option<String>
17} 18}
18 19
19pub fn scope_completion(file: &File, offset: TextUnit) -> Option<Vec<CompletionItem>> { 20pub fn scope_completion(file: &File, offset: TextUnit) -> Option<Vec<CompletionItem>> {
@@ -33,7 +34,10 @@ pub fn scope_completion(file: &File, offset: TextUnit) -> Option<Vec<CompletionI
33 let scope = ModuleScope::new(root); 34 let scope = ModuleScope::new(root);
34 res.extend( 35 res.extend(
35 scope.entries().iter() 36 scope.entries().iter()
36 .map(|entry| CompletionItem { name: entry.name().to_string() }) 37 .map(|entry| CompletionItem {
38 name: entry.name().to_string(),
39 snippet: None,
40 })
37 ) 41 )
38 } 42 }
39 Some(res) 43 Some(res)
@@ -43,7 +47,10 @@ fn complete_fn(name_ref: ast::NameRef, scopes: &FnScopes, acc: &mut Vec<Completi
43 acc.extend( 47 acc.extend(
44 scopes.scope_chain(name_ref.syntax()) 48 scopes.scope_chain(name_ref.syntax())
45 .flat_map(|scope| scopes.entries(scope).iter()) 49 .flat_map(|scope| scopes.entries(scope).iter())
46 .map(|entry| CompletionItem { name: entry.name().to_string() }) 50 .map(|entry| CompletionItem {
51 name: entry.name().to_string(),
52 snippet: None,
53 })
47 ) 54 )
48} 55}
49 56