diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-30 03:22:39 -0500 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-30 03:32:41 -0500 |
| commit | a23576849cec7cbe3d6f9e20afc28126ccb5a784 (patch) | |
| tree | f6e61e702e9ded2dd4a53963ef1fab9d96c7f6de /src | |
| parent | b7aacba5b604f04cb33604632cf16af359208682 (diff) | |
Fix indentation for doc comments using `/**/` within other procedures
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/ast.odin | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/server/ast.odin b/src/server/ast.odin index c6966fa..59e3de2 100644 --- a/src/server/ast.odin +++ b/src/server/ast.odin @@ -2,7 +2,6 @@ package server import "core:fmt" -import "core:log" import "core:mem" import "core:odin/ast" import "core:odin/parser" @@ -572,7 +571,26 @@ get_doc :: proc(comment: ^ast.Comment_Group, allocator: mem.Allocator) -> string tmp: string for doc in comment.list { - tmp = strings.concatenate({tmp, "\n", doc.text}, context.temp_allocator) + if strings.starts_with(doc.text, "/*") && doc.pos.column != 1 { + lines := strings.split(doc.text, "\n", context.temp_allocator) + for line, i in lines { + if i != 0 && len(line) > 0 { + column := 0 + for column < doc.pos.column - 1 { + if line[column] == '\t' || line[column] == ' ' { + column += 1 + } else { + break + } + } + tmp = strings.concatenate({tmp, "\n", line[column:]}, context.temp_allocator) + } else { + tmp = strings.concatenate({tmp, "\n", line}, context.temp_allocator) + } + } + } else { + tmp = strings.concatenate({tmp, "\n", doc.text}, context.temp_allocator) + } } if tmp != "" { |