From b0e274b53936eac2c751d3d04a7b1bcd432cfe91 Mon Sep 17 00:00:00 2001 From: Daniel Gavin Date: Wed, 22 Jun 2022 00:08:21 +0200 Subject: Use the default values if not specified in json --- src/server/format.odin | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/format.odin b/src/server/format.odin index 3cf8de6..0035545 100644 --- a/src/server/format.odin +++ b/src/server/format.odin @@ -19,10 +19,16 @@ 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.spaces = config.formatter.spaces + if characters, ok := config.formatter.characters.(int); ok { + style.max_characters = characters + } + + if spaces, ok := config.formatter.spaces.(int); ok { + style.spaces = spaces + } + prnt := printer.make_printer(style, context.temp_allocator) if document.ast.syntax_error_count > 0 { -- cgit v1.2.3