diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2021-03-13 02:06:06 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2021-03-13 02:06:06 +0100 |
| commit | 71858cbde659212a5ee0eec2ee6fd9498b41107e (patch) | |
| tree | 5b458ba51b39a8733162234d09901ccc5f31d577 /src | |
| parent | 6fc43a00c225fa0b19c2044315a55313e1416c7b (diff) | |
fix bug where the new case clause wouldn't complete
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 517d10d..0745944 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2019,7 +2019,7 @@ fallback_position_context_completion :: proc (document: ^Document, position: com empty_arrow: bool; last_dot: bool; last_arrow: bool; - dots_seen: int; + dots_seen: int; i := position_context.position - 1; @@ -2157,9 +2157,7 @@ fallback_position_context_completion :: proc (document: ^Document, position: com if e == nil { return; - } - - else if e, ok := e.derived.(ast.Bad_Expr); ok { + } else if e, ok := e.derived.(ast.Bad_Expr); ok { return; } @@ -2411,7 +2409,14 @@ get_document_position_node :: proc (node: ^ast.Node, position_context: ^Document get_document_position(n.expr, position_context); get_document_position(n.body, position_context); case Case_Clause: - position_context.case_clause = cast(^Case_Clause)node; + + for elem in n.list { + if position_in_node(elem, position_context.position) { + position_context.case_clause = cast(^Case_Clause)node; + break; + } + } + get_document_position(n.list, position_context); get_document_position(n.body, position_context); case Switch_Stmt: |