diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 18:05:41 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 18:05:41 +0200 |
| commit | f5fe104fd6662156c2cb219f24f17769af2d30e6 (patch) | |
| tree | ce46cf82281535b7ec633d666e29cf75072d28d1 /src/server | |
| parent | f6f2eb760d4b11630dc0719c8893383bed20cd9a (diff) | |
Fix `->` gotos and some odinfmt fixes
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/analysis.odin | 23 | ||||
| -rw-r--r-- | src/server/format.odin | 28 |
2 files changed, 17 insertions, 34 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 6113b63..e3bfb9a 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1400,12 +1400,14 @@ get_local_lhs_and_rhs :: proc( if _, ok := ast_context.parameters[ident.name]; ok { - return local_stack[i - - previous].lhs, local_stack[i - previous].rhs + return local_stack[ + i - previous \ + ].lhs, local_stack[i - previous].rhs } } - return local_stack[i - - previous].lhs, local_stack[i - previous].rhs + return local_stack[ + i - previous \ + ].lhs, local_stack[i - previous].rhs } } } @@ -4348,6 +4350,14 @@ get_document_position_node :: proc( } get_document_position(n.expr, position_context) get_document_position(n.args, position_context) + case ^Selector_Call_Expr: + if position_context.hint == .Definition || position_context.hint == .Hover { + position_context.selector = n.expr + position_context.field = n.call + position_context.selector_expr = cast(^Selector_Expr)node + get_document_position(n.expr, position_context) + get_document_position(n.call, position_context) + } case ^Selector_Expr: if position_context.hint == .Completion { if n.field != nil && @@ -4356,9 +4366,8 @@ get_document_position_node :: proc( //position_context.selector = n.expr; //position_context.field = n.field; } - } else if (position_context.hint == .Definition || - position_context.hint == .Hover) && - n.field != nil { + } else if position_context.hint == .Definition || + position_context.hint == .Hover && n.field != nil { position_context.selector = n.expr position_context.field = n.field position_context.selector_expr = cast(^Selector_Expr)node diff --git a/src/server/format.odin b/src/server/format.odin index cbb4082..d0c939b 100644 --- a/src/server/format.odin +++ b/src/server/format.odin @@ -42,35 +42,9 @@ get_complete_format :: proc( src := printer.print(&prnt, &document.ast) - log.error(src) - - end_line := 0 - end_charcter := 0 - - last := document.text[0] - line := 0 - - for current_index := 0; - current_index < len(document.text); - current_index += 1 { - current := document.text[current_index] - - if last == '\r' && current == '\n' { - line += 1 - current_index += 1 - } else if current == '\n' { - line += 1 - } - - last = current - } - edit := TextEdit { newText = src, - range = { - start = {character = 0, line = 0}, - end = {character = 1, line = line + 1}, - }, + range = common.get_document_range(document.text[0:document.used_text]), } edits := make([dynamic]TextEdit, context.temp_allocator) |