aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2024-09-29 22:21:57 +0200
committerDanielGavin <danielgavin5@hotmail.com>2024-09-29 22:21:57 +0200
commitfe1bee80a175a25ba5de9fb7fe63429436ee8af2 (patch)
treec5723139524c2c5fd0e0d449e379a22d735a0cff /src
parent632a1ca20e713430bdcfe6bca60ebf269f260c69 (diff)
parent0f20cb93208f3f1505ee5d1844f8df427006e9f5 (diff)
Merge branch 'master' of https://github.com/DanielGavin/ols
Diffstat (limited to 'src')
-rw-r--r--src/odin/printer/printer.odin13
-rw-r--r--src/server/completion.odin2
2 files changed, 11 insertions, 4 deletions
diff --git a/src/odin/printer/printer.odin b/src/odin/printer/printer.odin
index 8fb8baf..74f5853 100644
--- a/src/odin/printer/printer.odin
+++ b/src/odin/printer/printer.odin
@@ -129,13 +129,18 @@ build_disabled_lines_info :: proc(p: ^Printer) {
for group in p.comments {
for comment in group.list {
- comment_text, _ := strings.replace_all(comment.text[:], " ", "", context.temp_allocator)
- if strings.contains(comment_text, "//odinfmt:disable") {
+ if !strings.starts_with(comment.text, "//") do continue
+ comment_text := strings.trim_left_space(comment.text[len("//"):])
+
+ if !strings.starts_with(comment_text, "odinfmt:") do continue
+ action := strings.trim_space(comment_text[len("odinfmt:"):])
+
+ if action == "disable" {
found_disable = true
empty = true
disable_position = comment.pos
- } else if strings.contains(comment_text, "//odinfmt:enable") && found_disable {
+ } else if found_disable && action == "enable" {
begin := disable_position.offset - (comment.pos.column - 1)
end := comment.pos.offset + len(comment.text)
@@ -146,7 +151,7 @@ build_disabled_lines_info :: proc(p: ^Printer) {
empty = empty,
}
- for line := disable_position.line; line <= comment.pos.line; line += 1 {
+ for line in disable_position.line..=comment.pos.line {
p.disabled_lines[line] = disabled_info
}
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 1b7249d..c085881 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -178,8 +178,10 @@ DIRECTIVE_NAME_LIST :: []string {
"line",
"procedure",
"caller_location",
+ "reverse",
/* call directives */
"location",
+ "caller_expression",
"exists",
"load",
"load_directory",