diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-12 01:24:58 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-12 01:24:58 +0200 |
| commit | 12a1db1e284e4ce2af9a51bb60f9817e76c1a481 (patch) | |
| tree | 442d055f164e24d5e082c610ef90a8678fdc1066 /src | |
| parent | 7f3d3d2c5c88e528d59ca5fd5ae823f2e1b21ea9 (diff) | |
Fix bugs with range loop in switch statement not completing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 8 | ||||
| -rw-r--r-- | src/server/completion.odin | 3 | ||||
| -rw-r--r-- | src/server/semantic_tokens.odin | 2 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index bd700fe..09564ba 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2347,10 +2347,6 @@ get_locals_type_switch_stmt :: proc(file: ast.File, stmt: ast.Type_Switch_Stmt, if block, ok := stmt.body.derived.(^Block_Stmt); ok { for block_stmt in block.stmts { if cause, ok := block_stmt.derived.(^Case_Clause); ok && cause.pos.offset <= document_position.position && document_position.position <= cause.end.offset { - for b in cause.body { - get_locals_stmt(file, b, ast_context, document_position) - } - tag := stmt.tag.derived.(^Assign_Stmt) if len(tag.lhs) == 1 && len(cause.list) == 1 { @@ -2358,6 +2354,10 @@ get_locals_type_switch_stmt :: proc(file: ast.File, stmt: ast.Type_Switch_Stmt, store_local(ast_context, cause.list[0], ident.pos.offset, ident.name, ast_context.local_id) ast_context.variables[ident.name] = true } + + for b in cause.body { + get_locals_stmt(file, b, ast_context, document_position) + } } } } diff --git a/src/server/completion.odin b/src/server/completion.odin index f42fbb3..c8d9d11 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -290,7 +290,6 @@ get_selector_completion :: proc(ast_context: ^AstContext, position_context: ^Doc expr_len = save for k in swizzle_coord_components { - if expr_len <= 0 { break } @@ -308,7 +307,6 @@ get_selector_completion :: proc(ast_context: ^AstContext, position_context: ^Doc if containsColor > 1 { for k in swizzle_color_components { - if expr_len <= 0 { break } @@ -324,7 +322,6 @@ get_selector_completion :: proc(ast_context: ^AstContext, position_context: ^Doc } } else if containsCoord > 1 { for k in swizzle_coord_components { - if expr_len <= 0 { break } diff --git a/src/server/semantic_tokens.odin b/src/server/semantic_tokens.odin index 321858e..55d94d3 100644 --- a/src/server/semantic_tokens.odin +++ b/src/server/semantic_tokens.odin @@ -513,7 +513,7 @@ visit_selector :: proc(selector: ^ast.Selector_Expr, builder: ^SemanticTokenBuil if symbol_and_node, ok := builder.symbols[cast(uintptr)selector]; ok { if symbol_and_node.symbol.type == .Variable { - write_semantic_node(builder, selector.field, ast_context.file.src, .Method, .None) + write_semantic_node(builder, selector.field, ast_context.file.src, .Property, .None) } #partial switch v in symbol_and_node.symbol.value { case SymbolPackageValue: |