From f5669dfc56b2b64d79f368eefed13dd75a6f027b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Sep 2018 12:46:43 +0300 Subject: No self-imports in completion --- crates/libeditor/src/completion.rs | 8 ++++++++ crates/libeditor/src/scope/mod_scope.rs | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'crates/libeditor') diff --git a/crates/libeditor/src/completion.rs b/crates/libeditor/src/completion.rs index f3058c023..be37fb6bf 100644 --- a/crates/libeditor/src/completion.rs +++ b/crates/libeditor/src/completion.rs @@ -42,6 +42,7 @@ pub fn scope_completion(file: &File, offset: TextUnit) -> Option; + ", r#"[]"#); + } + #[test] fn test_complete_type() { check_scope_completion(r" diff --git a/crates/libeditor/src/scope/mod_scope.rs b/crates/libeditor/src/scope/mod_scope.rs index 052f70569..67baa8678 100644 --- a/crates/libeditor/src/scope/mod_scope.rs +++ b/crates/libeditor/src/scope/mod_scope.rs @@ -1,5 +1,5 @@ use libsyntax2::{ - AstNode, SyntaxNode, SmolStr, ast + AstNode, SyntaxNode, SyntaxNodeRef, SmolStr, ast }; pub struct ModuleScope { @@ -67,6 +67,9 @@ impl Entry { .text(), } } + pub fn syntax(&self) -> SyntaxNodeRef { + self.node.borrowed() + } } fn collect_imports(tree: ast::UseTree, acc: &mut Vec) { -- cgit v1.2.3