aboutsummaryrefslogtreecommitdiff
path: root/src/server/analysis.odin
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-12-09 14:16:56 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-12-09 14:16:56 +0100
commit705f77aae24e383e6adc3cb92a48b60d22699e82 (patch)
tree3316f8505dfff4a7a1fea0537ff82dfa36d17fe4 /src/server/analysis.odin
parent25eff04b182e035613ae70ffee1fad918df42942 (diff)
added fuzzy matcher
Diffstat (limited to 'src/server/analysis.odin')
-rw-r--r--src/server/analysis.odin32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 07f7f33..a75e475 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -553,15 +553,6 @@ resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Expr) -> (i
return index.Symbol {}, false;
case Selector_Expr:
- if ident, ok := v.expr.derived.(Ident); ok {
-
- if !resolve_ident_is_variable(ast_context, ident) && !resolve_ident_is_package(ast_context, ident) {
- log.debugf("not a variable or package %v", ident.name);
- return {}, false;
- }
-
- }
-
if selector, ok := resolve_type_expression(ast_context, v.expr); ok {
ast_context.use_locals = false;
@@ -611,15 +602,6 @@ resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Expr) -> (i
if ptr, ok := s.expr.derived.(Pointer_Type); ok {
- if ident, ok := v.expr.derived.(Ident); ok {
-
- if !resolve_ident_is_variable(ast_context, ident) && !resolve_ident_is_package(ast_context, ident) {
- log.debugf("not a variable or package %v", ident.name);
- return {}, false;
- }
-
- }
-
if symbol, ok := resolve_type_expression(ast_context, ptr.elem); ok {
#partial switch s2 in symbol.value {
@@ -1234,6 +1216,8 @@ get_locals_stmt :: proc(file: ast.File, stmt: ^ast.Stmt, ast_context: ^AstContex
get_locals_switch_stmt(file, v, ast_context, document_position);
case For_Stmt:
get_locals_for_stmt(file, v, ast_context, document_position);
+ case Inline_Range_Stmt:
+ get_locals_stmt(file, v.body, ast_context, document_position);
case Range_Stmt:
get_locals_for_range_stmt(file, v, ast_context, document_position);
case If_Stmt:
@@ -1275,6 +1259,7 @@ get_locals_using_stmt :: proc(file: ast.File, stmt: ast.Using_Stmt, ast_context:
selector.field = index.new_type(ast.Ident, v.types[i].pos, v.types[i].end, context.temp_allocator);
selector.field.name = name;
ast_context.locals[name] = selector;
+ ast_context.variables[name] = true;
}
}
@@ -1665,9 +1650,16 @@ get_completion_list :: proc(document: ^Document, position: common.Position) -> (
items := make([dynamic] CompletionItem, context.temp_allocator);
- //log.infof("ident %v", position_context.identifier);
if position_context.selector != nil {
+ if ident, ok := position_context.selector.derived.(ast.Ident); ok {
+
+ if !resolve_ident_is_variable(&ast_context, ident) && !resolve_ident_is_package(&ast_context, ident) {
+ return list, true;
+ }
+
+ }
+
symbols := make([dynamic] index.Symbol, context.temp_allocator);
selector: index.Symbol;
@@ -2070,7 +2062,7 @@ fallback_position_context_completion :: proc(document: ^Document, position: comm
}
if c == ' ' || c == '{' || c == ',' ||
- c == '}' || c == '^' ||
+ c == '}' || c == '^' || c == ':' ||
c == '\n' || c == '\r' {
start = i+1;
break;