aboutsummaryrefslogtreecommitdiff
path: root/src/server/format.odin
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-10-05 20:58:23 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-10-05 20:58:23 +0200
commit90c90ae5dd0619f246c2379f48a4f0a7b5f5e0b7 (patch)
treec989ed5cc3672827c848b277c27e0776245f3824 /src/server/format.odin
parent8508eb6004ec4dd3fa032d08cf7036daf94d97e5 (diff)
Add the ability to error out of the formatter.
Diffstat (limited to 'src/server/format.odin')
-rw-r--r--src/server/format.odin4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/format.odin b/src/server/format.odin
index c518532..d981b9c 100644
--- a/src/server/format.odin
+++ b/src/server/format.odin
@@ -38,6 +38,10 @@ get_complete_format :: proc(document: ^Document, config: ^common.Config) -> ([]T
src := printer.print(&prnt, &document.ast)
+ if prnt.errored_out {
+ return {}, true
+ }
+
edit := TextEdit {
newText = src,
range = common.get_document_range(document.text[0:document.used_text]),