aboutsummaryrefslogtreecommitdiff
path: root/crates/libeditor
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-26 17:04:44 +0100
committerAleksey Kladov <[email protected]>2018-08-26 17:04:44 +0100
commit9b69c7df194d5f9081698745ed20414d7c7c2f1c (patch)
tree23e4c98b4acea9bb73f03ba57b46f4b7d5dd3903 /crates/libeditor
parent71722c047f96cb754c958c52591ca53f2a9c4d3c (diff)
fix curly braces parsing
Diffstat (limited to 'crates/libeditor')
-rw-r--r--crates/libeditor/src/completion.rs53
1 files changed, 52 insertions, 1 deletions
diff --git a/crates/libeditor/src/completion.rs b/crates/libeditor/src/completion.rs
index aeed19559..351781ec4 100644
--- a/crates/libeditor/src/completion.rs
+++ b/crates/libeditor/src/completion.rs
@@ -1,5 +1,7 @@
1use std::collections::HashMap;
2
1use libsyntax2::{ 3use libsyntax2::{
2 File, TextUnit, AstNode, SyntaxNodeRef, 4 File, TextUnit, AstNode, SyntaxNodeRef, SyntaxNode, SmolStr,
3 ast::{self, NameOwner}, 5 ast::{self, NameOwner},
4 algo::{ 6 algo::{
5 ancestors, 7 ancestors,
@@ -59,3 +61,52 @@ fn process_scope(node: SyntaxNodeRef, sink: &mut Vec<CompletionItem>) {
59 sink.extend(items); 61 sink.extend(items);
60 } 62 }
61} 63}
64
65// fn compute_scopes(fn_def: ast::FnDef) -> FnScopes {
66// let mut scopes = FnScopes::new();
67// }
68
69// type ScopeId = usize;
70
71// struct FnScopes {
72// scopes: Vec<ScopeData>,
73// scope_for_expr: HashMap<SyntaxNode, ScopeId>,
74// }
75
76// impl FnScopes {
77// fn new() -> FnScopes {
78// FnScopes {
79// scopes: vec![],
80// scope_for_expr: HashMap::new(),
81// }
82// }
83
84// fn new_scope(&mut Self) -> ScopeId {
85// let res = self.scopes.len();
86// self.scopes.push(ScopeData { parent: None, entries: vec![] })
87// }
88
89// fn set_parent
90// }
91
92// struct ScopeData {
93// parent: Option<ScopeId>,
94// entries: Vec<ScopeEntry>
95// }
96
97// struct ScopeEntry {
98// syntax: SyntaxNode
99// }
100
101// impl ScopeEntry {
102// fn name(&self) -> SmolStr {
103// self.ast().name()
104// .unwrap()
105// .text()
106// }
107
108// fn ast(&self) -> ast::BindPat {
109// ast::BindPat::cast(self.syntax.borrowed())
110// .unwrap()
111// }
112// }