diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-07-09 18:36:01 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-07-09 18:36:01 +0200 |
| commit | 28d4e76ecc635c1c386ff914d4db6c92eea092e8 (patch) | |
| tree | e7b181f43a0e65358917988c11ad2e04c0cbeabd /src/server/format.odin | |
| parent | 9e9f4958f0ff2686cd0ace5a247c54c5ab775106 (diff) | |
| parent | fb5b19056827afbad2133f486d68d2ea162930e7 (diff) | |
Merge branch 'master' into index-caching
Diffstat (limited to 'src/server/format.odin')
| -rw-r--r-- | src/server/format.odin | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/server/format.odin b/src/server/format.odin index e461044..57243ff 100644 --- a/src/server/format.odin +++ b/src/server/format.odin @@ -1,9 +1,10 @@ package server import "shared:common" - import "shared:odin/printer" +import "core:log" + FormattingOptions :: struct { tabSize: uint, insertSpaces: bool, //tabs or spaces @@ -19,9 +20,16 @@ DocumentFormattingParams :: struct { get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]TextEdit, bool) { style := printer.default_style - style.max_characters = config.formatter.characters style.tabs = config.formatter.tabs + if config.formatter.characters != 0 { + style.max_characters = config.formatter.characters + } + + if config.formatter.spaces != 0 { + style.spaces = config.formatter.spaces + } + prnt := printer.make_printer(style, context.temp_allocator) if document.ast.syntax_error_count > 0 { @@ -34,7 +42,9 @@ get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]T src := printer.print(&prnt, &document.ast) - end_line := 0 + log.error(src) + + end_line := 0 end_charcter := 0 last := document.text[0] |