aboutsummaryrefslogtreecommitdiff
path: root/src/server/format.odin
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2021-11-28 16:43:50 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2021-11-28 16:43:50 +0100
commitbc55f5beea4ddd64ce4a2996d64095e145f26cfc (patch)
tree0bb22b38e5587d9d1dd1c2a2990f0e7f084ac456 /src/server/format.odin
parent5d03398e911c56134b8798a31fc87b85fe28675b (diff)
Add formatter to ols
Diffstat (limited to 'src/server/format.odin')
-rw-r--r--src/server/format.odin11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/server/format.odin b/src/server/format.odin
index 82857dc..6eb83de 100644
--- a/src/server/format.odin
+++ b/src/server/format.odin
@@ -2,7 +2,7 @@ package server
import "shared:common"
-import "core:odin/printer"
+import "shared:odin/printer"
FormattingOptions :: struct {
tabSize: uint,
@@ -22,8 +22,13 @@ TextEdit :: struct {
newText: string,
}
-get_complete_format :: proc(document: ^common.Document) -> ([]TextEdit, bool) {
- prnt := printer.make_printer(printer.default_style, context.temp_allocator);
+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;
+
+ prnt := printer.make_printer(style, context.temp_allocator);
if document.ast.syntax_error_count > 0 {
return {}, true;