diff options
| author | cornishon <zadroznyadam@pm.me> | 2025-02-02 11:28:24 +0100 |
|---|---|---|
| committer | cornishon <zadroznyadam@pm.me> | 2025-02-02 11:28:24 +0100 |
| commit | 100f2183e07cd3347fe7e988588187ea8594a2f4 (patch) | |
| tree | 032739aaaad7feac1c5d5d6dc064d8944d2fbc55 /src/server | |
| parent | 10b6763d365782a6af2d9d1d97b1d1905da8c26c (diff) | |
Add `cap` magic completion for dynamic arrays and maps.
Also add `len` to map, since it was missing.
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/completion.odin | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin index 05a8fe6..1f65af9 100644 --- a/src/server/completion.odin +++ b/src/server/completion.odin @@ -1743,6 +1743,36 @@ append_magic_map_completion :: proc( append(items, item) } + + //len + { + text := fmt.tprintf("len(%v)", symbol_str) + + item := CompletionItem { + label = "len", + kind = .Function, + detail = "len", + textEdit = TextEdit{newText = text, range = {start = range.end, end = range.end}}, + additionalTextEdits = additionalTextEdits, + } + + append(items, item) + } + + //cap + { + text := fmt.tprintf("cap(%v)", symbol_str) + + item := CompletionItem { + label = "cap", + kind = .Function, + detail = "cap", + textEdit = TextEdit{newText = text, range = {start = range.end, end = range.end}}, + additionalTextEdits = additionalTextEdits, + } + + append(items, item) + } } get_expression_string_from_position_context :: proc(position_context: ^DocumentPositionContext) -> string { src := position_context.file.src @@ -1820,6 +1850,21 @@ append_magic_dynamic_array_completion :: proc( return } + //cap + { + text := fmt.tprintf("cap(%v)", symbol_str) + + item := CompletionItem { + label = "cap", + kind = .Function, + detail = "cap", + textEdit = TextEdit{newText = text, range = {start = range.end, end = range.end}}, + additionalTextEdits = additionalTextEdits, + } + + append(items, item) + } + // allocator { item := CompletionItem { |