diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-03-30 15:52:51 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-03-30 15:52:51 +0200 |
| commit | 7c7893ff8f09e403dacc751b3c0c1a0233221450 (patch) | |
| tree | 7a81b57f7754d5e39f77fc9065e44401da33039d /src/server | |
| parent | 9cca606864a6ce95355f3bf2fdb2e2854a572c68 (diff) | |
Enum completion now only happens on the type and not the variable of an enum
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/completion.odin | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index 9e64696..7dac1b9 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -238,13 +238,6 @@ get_selector_completion :: proc(ast_context: ^AstContext, position_context: ^Doc ast_context.current_package = ast_context.document_package; - 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) && ident.name != "" { - return; - } - } - symbols := make([dynamic]index.Symbol, context.temp_allocator); selector: index.Symbol; @@ -259,6 +252,17 @@ get_selector_completion :: proc(ast_context: ^AstContext, position_context: ^Doc return; } + if ident, ok := position_context.selector.derived.(ast.Ident); ok { + + is_variable := resolve_ident_is_variable(ast_context, ident); + is_package := resolve_ident_is_package(ast_context, ident); + + if (!is_variable && !is_package && selector.type != .Enum && ident.name != "") || (is_variable && selector.type == .Enum) { + return; + } + + } + if selector.pkg != "" { ast_context.current_package = selector.pkg; } else { |