From cf2e2cc7e8cafd5f517a200fcc7a9407b4e250ea Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Tue, 30 Mar 2021 23:04:55 +0200 Subject: no completion in comments --- src/server/analysis.odin | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 78c4329..3fd6a56 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2049,17 +2049,24 @@ get_document_position_context :: proc(document: ^Document, position: common.Posi position_context.position = absolute_position; + exists_in_decl := false; + for decl in document.ast.decls { if position_in_node(decl, position_context.position) { get_document_position(decl, &position_context); - + exists_in_decl = true; switch v in decl.derived { case ast.Expr_Stmt: position_context.global_lhs_stmt = true; } + break; } } + if !exists_in_decl { + position_context.abort_completion = true; + } + if !position_in_node(position_context.comp_lit, position_context.position) { position_context.comp_lit = nil; } -- cgit v1.2.3