diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-03-04 12:17:00 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-03-04 12:17:00 +0100 |
| commit | 58287455d64ab16091522bf8a358b079ef05daad (patch) | |
| tree | 7b6655d6d34b5ad6d719523e4938b8002c43d8ab /src/server/format.odin | |
| parent | 63d0bd412a8817445d6dc18e79d5d54c94caf401 (diff) | |
strip colons and update ast to use unions
Diffstat (limited to 'src/server/format.odin')
| -rw-r--r-- | src/server/format.odin | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/server/format.odin b/src/server/format.odin index 1bf4892..5829793 100644 --- a/src/server/format.odin +++ b/src/server/format.odin @@ -19,39 +19,39 @@ DocumentFormattingParams :: struct { get_complete_format :: proc(document: ^common.Document, config: ^common.Config) -> ([]TextEdit, bool) { - style := printer.default_style; - style.max_characters = config.formatter.characters; - style.tabs = config.formatter.tabs; + style := printer.default_style + style.max_characters = config.formatter.characters + style.tabs = config.formatter.tabs - prnt := printer.make_printer(style, context.temp_allocator); + prnt := printer.make_printer(style, context.temp_allocator) if document.ast.syntax_error_count > 0 { - return {}, true; + return {}, true } if len(document.text) == 0 { - return {}, true; + return {}, true } - src := printer.print(&prnt, &document.ast); + src := printer.print(&prnt, &document.ast) - end_line := 0; - end_charcter := 0; + end_line := 0 + end_charcter := 0 - last := document.text[0]; - line := 0; + last := document.text[0] + line := 0 for current_index := 0; current_index < len(document.text); current_index += 1 { - current := document.text[current_index]; + current := document.text[current_index] if last == '\r' && current == '\n' { - line += 1; - current_index += 1; + line += 1 + current_index += 1 } else if current == '\n' { - line += 1; + line += 1 } - last = current; + last = current } edit := TextEdit { @@ -66,11 +66,11 @@ get_complete_format :: proc(document: ^common.Document, config: ^common.Config) line = line+1, }, }, - }; + } - edits := make([dynamic]TextEdit, context.temp_allocator); + edits := make([dynamic]TextEdit, context.temp_allocator) - append(&edits, edit); + append(&edits, edit) - return edits[:], true; + return edits[:], true } |