diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 13:13:26 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-20 13:13:26 +0200 |
| commit | f6f2eb760d4b11630dc0719c8893383bed20cd9a (patch) | |
| tree | f3738e1fa057671d182a7161f9ff02ffa7b56020 /src/server/format.odin | |
| parent | 8e8360dba88feb0334a222e9f990250cf65f32bf (diff) | |
Finally make the move to use odinfmt in ols.
Diffstat (limited to 'src/server/format.odin')
| -rw-r--r-- | src/server/format.odin | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/server/format.odin b/src/server/format.odin index 236bee2..cbb4082 100644 --- a/src/server/format.odin +++ b/src/server/format.odin @@ -20,7 +20,13 @@ DocumentFormattingParams :: struct { options: FormattingOptions, } -get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]TextEdit, bool) { +get_complete_format :: proc( + document: ^Document, + config: ^common.Config, +) -> ( + []TextEdit, + bool, +) { if document.ast.syntax_error_count > 0 { return {}, true } @@ -29,7 +35,9 @@ get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]T return {}, true } - style := format.find_config_file_or_default(filepath.dir(document.fullpath, context.temp_allocator)) + style := format.find_config_file_or_default( + filepath.dir(document.fullpath, context.temp_allocator), + ) prnt := printer.make_printer(style, context.temp_allocator) src := printer.print(&prnt, &document.ast) @@ -42,7 +50,9 @@ get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]T last := document.text[0] line := 0 - for current_index := 0; current_index < len(document.text); current_index += 1 { + for current_index := 0; + current_index < len(document.text); + current_index += 1 { current := document.text[current_index] if last == '\r' && current == '\n' { @@ -58,14 +68,8 @@ get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]T edit := TextEdit { newText = src, range = { - start = { - character = 0, - line = 0, - }, - end = { - character = 1, - line = line+1, - }, + start = {character = 0, line = 0}, + end = {character = 1, line = line + 1}, }, } |