aboutsummaryrefslogtreecommitdiff
path: root/src/server/format.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/format.odin')
-rw-r--r--src/server/format.odin26
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},
},
}