aboutsummaryrefslogtreecommitdiff
path: root/src/server/completion.odin
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-12-14 21:34:18 +1100
committerGitHub <noreply@github.com>2025-12-14 21:34:18 +1100
commit79dc7bb79998428a96ab25f6c122dfc4c1909ac1 (patch)
treeedcdfe7cbf58dfacd96311cd4bccaab196f0aa0b /src/server/completion.odin
parent70efaf21cac9358b1b50e194e3401b07901b8f47 (diff)
parent54a2a8e940018f8984e51e21fe94abf1ff0055fe (diff)
Merge pull request #1218 from BradLewis/feat/directive-docs
Add documentation for directives
Diffstat (limited to 'src/server/completion.odin')
-rw-r--r--src/server/completion.odin81
1 files changed, 13 insertions, 68 deletions
diff --git a/src/server/completion.odin b/src/server/completion.odin
index 0324b23..6663be9 100644
--- a/src/server/completion.odin
+++ b/src/server/completion.odin
@@ -560,80 +560,25 @@ get_attribute_completion :: proc(
}
-DIRECTIVE_NAME_LIST :: []string {
- // basic directives
- "file",
- "directory",
- "line",
- "procedure",
- "caller_location",
- "reverse",
- // call directives
- "location",
- "caller_expression",
- "exists",
- "load",
- "load_directory",
- "load_hash",
- "hash",
- "assert",
- "panic",
- "defined",
- "config",
- /* type helper */
- "type",
- /* struct type */
- "packed",
- "raw_union",
- "align",
- "all_or_none",
- /* union type */
- "no_nil",
- "shared_nil",
- /* array type */
- "simd",
- "soa",
- "sparse",
- /* ptr type */
- "relative",
- /* field flags */
- "no_alias",
- "c_vararg",
- "const",
- "any_int",
- "subtype",
- "by_ptr",
- "no_broadcast",
- "no_capture",
- /* swich flags */
- "partial",
- /* block flags */
- "bounds_check",
- "no_bounds_check",
- "type_assert",
- "no_type_assert",
- /* proc inlining */
- "force_inline",
- "force_no_inline",
- /* return values flags */
- "optional_ok",
- "optional_allocator_error",
-}
-
completion_items_directives: []CompletionResult
@(init)
_init_completion_items_directives :: proc "contextless" () {
context = runtime.default_context()
- completion_items_directives = slice.mapper(DIRECTIVE_NAME_LIST, proc(name: string) -> CompletionResult {
- return CompletionResult {
- completion_item = CompletionItem {
- detail = strings.concatenate({"#", name}) or_else name,
- label = name,
- kind = .Constant,
+ directives := make([dynamic]CompletionResult, 0, len(directive_docs), allocator = context.allocator)
+ for name, doc in directive_docs {
+ documentation := MarkupContent {
+ kind = "markdown",
+ value = doc,
+ }
+ append(
+ &directives,
+ CompletionResult {
+ completion_item = CompletionItem{label = name, kind = .Constant, documentation = documentation},
},
- }
- })
+ )
+ }
+ completion_items_directives = directives[:]
}
get_directive_completion :: proc(