diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-04-02 20:47:01 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-04-02 20:47:01 +0200 |
| commit | 1781dfbec5be1d06b854a1fe474fe8cf5cb9014a (patch) | |
| tree | 1f230f2cbbcb39d950782fd9842890088ed27ffa /src/server | |
| parent | 111f6ccb5221734ba5ef8f95a03253df83df1a70 (diff) | |
Improve on aliasing
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/analysis.odin | 29 | ||||
| -rw-r--r-- | src/server/completion.odin | 7 |
2 files changed, 29 insertions, 7 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 8e5f38b..116225e 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -978,6 +978,12 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: index.Symbol, ok return symbol, ok; } + symbol := symbol; + + if symbol.type == .Unresolved { + fix_symbol_unresolved_type(&symbol); + } + #partial switch v in symbol.value { case index.SymbolProcedureGroupValue: if symbol, ok := resolve_function_overload(ast_context, v.group.derived.(ast.Proc_Group)); ok { @@ -1009,6 +1015,29 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: index.Symbol, ok return symbol, true; } +fix_symbol_unresolved_type :: proc(symbol: ^index.Symbol) { + + using index; + + switch v in symbol.value { + case SymbolStructValue: + symbol.type = .Struct; + case SymbolPackageValue: + symbol.type = .Package; + case SymbolProcedureValue, SymbolProcedureGroupValue: + symbol.type = .Function; + case SymbolGenericValue: + symbol.type = .Variable; + case SymbolUnionValue: + symbol.type = .Enum; + case SymbolEnumValue: + symbol.type = .Enum; + case SymbolBitSetValue: + symbol.type = .Enum; + } + +} + resolve_location_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (index.Symbol, bool) { symbol: index.Symbol; diff --git a/src/server/completion.odin b/src/server/completion.odin index 4494bf4..1d93d95 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -737,12 +737,8 @@ get_implicit_completion :: proc(ast_context: ^AstContext, position_context: ^Doc if proc_value, ok := symbol.value.(index.SymbolProcedureValue); ok { - log.error("procedure symbol"); - if enum_value, ok := unwrap_enum(ast_context, proc_value.arg_types[parameter_index].type); ok { - log.error("unwrap"); - for name in enum_value.names { item := CompletionItem { label = name, @@ -810,10 +806,7 @@ get_identifier_completion :: proc(ast_context: ^AstContext, position_context: ^D append(&pkgs, u); } - append(&pkgs, ast_context.document_package); - if results, ok := index.fuzzy_search(lookup, pkgs[:]); ok { - for r in results { append(&combined, CombinedResult {score = r.score, symbol = r.symbol}); } |