aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-13 15:26:47 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-13 15:26:47 -0400
commit65912c3e7588c6c94ab28f1781d24ef4d4feb41d (patch)
treecfa0feb59582e268c8e555bc3f19209508490036 /src
parent3a3a5c1d97fce98d2f8b923953b03c139b24224f (diff)
Use a separate list of keywords for the documentation to not break analysis elsewhere
Diffstat (limited to 'src')
-rw-r--r--src/server/ast.odin38
-rw-r--r--src/server/documentation.odin99
2 files changed, 99 insertions, 38 deletions
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 791d1b5..8037d6f 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -10,6 +10,7 @@ import path "core:path/slashpath"
import "core:strings"
keyword_map: map[string]bool = {
+ "typeid" = true,
"int" = true,
"uint" = true,
"string" = true,
@@ -67,43 +68,6 @@ keyword_map: map[string]bool = {
"quaternion128" = true,
"quaternion256" = true,
"uintptr" = true,
- // taken from https://github.com/odin-lang/Odin/wiki/Keywords-and-Operators
- "asm" = true,
- "auto_cast" = true,
- "bit_field" = true,
- "bit_set" = true,
- "break" = true,
- "case" = true,
- "cast" = true,
- "context" = true,
- "continue" = true,
- "defer" = true,
- "distinct" = true,
- "do" = true,
- "dynamic" = true,
- "else" = true,
- "enum" = true,
- "fallthrough" = true,
- "for" = true,
- "foreign" = true,
- "if" = true,
- "import" = true,
- "in" = true,
- "map" = true,
- "not_in" = true,
- "or_else" = true,
- "or_return" = true,
- "package" = true,
- "proc" = true,
- "return" = true,
- "struct" = true,
- "switch" = true,
- "transmute" = true,
- "typeid" = true,
- "union" = true,
- "using" = true,
- "when" = true,
- "where" = true,
}
GlobalExpr :: struct {
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 5f24f7a..86dfe81 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -1,3 +1,4 @@
+#+feature dynamic-literals
package server
import "core:fmt"
@@ -6,6 +7,102 @@ import "core:odin/ast"
import path "core:path/slashpath"
import "core:strings"
+keywords_docs: map[string]bool = {
+ "int" = true,
+ "uint" = true,
+ "string" = true,
+ "cstring" = true,
+ "u64" = true,
+ "f32" = true,
+ "f64" = true,
+ "i64" = true,
+ "i128" = true,
+ "i32" = true,
+ "i16" = true,
+ "u16" = true,
+ "bool" = true,
+ "rawptr" = true,
+ "any" = true,
+ "u32" = true,
+ "u128" = true,
+ "b8" = true,
+ "b16" = true,
+ "b32" = true,
+ "b64" = true,
+ "true" = true,
+ "false" = true,
+ "nil" = true,
+ "byte" = true,
+ "u8" = true,
+ "i8" = true,
+ "rune" = true,
+ "f16be" = true,
+ "f16le" = true,
+ "f32be" = true,
+ "f32le" = true,
+ "f64be" = true,
+ "f64le" = true,
+ "i16be" = true,
+ "i16le" = true,
+ "i32be" = true,
+ "i32le" = true,
+ "i64be" = true,
+ "i64le" = true,
+ "u16be" = true,
+ "u16le" = true,
+ "u32be" = true,
+ "u32le" = true,
+ "u64be" = true,
+ "u64le" = true,
+ "i128be" = true,
+ "i128le" = true,
+ "u128be" = true,
+ "u128le" = true,
+ "complex32" = true,
+ "complex64" = true,
+ "complex128" = true,
+ "quaternion64" = true,
+ "quaternion128" = true,
+ "quaternion256" = true,
+ "uintptr" = true,
+ // taken from https://github.com/odin-lang/Odin/wiki/Keywords-and-Operators
+ "asm" = true,
+ "auto_cast" = true,
+ "bit_field" = true,
+ "bit_set" = true,
+ "break" = true,
+ "case" = true,
+ "cast" = true,
+ "context" = true,
+ "continue" = true,
+ "defer" = true,
+ "distinct" = true,
+ "do" = true,
+ "dynamic" = true,
+ "else" = true,
+ "enum" = true,
+ "fallthrough" = true,
+ "for" = true,
+ "foreign" = true,
+ "if" = true,
+ "import" = true,
+ "in" = true,
+ "map" = true,
+ "not_in" = true,
+ "or_else" = true,
+ "or_return" = true,
+ "package" = true,
+ "proc" = true,
+ "return" = true,
+ "struct" = true,
+ "switch" = true,
+ "transmute" = true,
+ "typeid" = true,
+ "union" = true,
+ "using" = true,
+ "when" = true,
+ "where" = true,
+}
get_signature :: proc(ast_context: ^AstContext, symbol: Symbol) -> string {
is_variable := symbol.type == .Variable
@@ -352,7 +449,7 @@ write_symbol_type_information :: proc(ast_context: ^AstContext, sb: ^strings.Bui
append_type_pkg := false
pkg_name := get_pkg_name(ast_context, symbol.type_pkg)
if pkg_name != "" {
- if _, ok := keyword_map[symbol.type_name]; !ok {
+ if _, ok := keywords_docs[symbol.type_name]; !ok {
append_type_pkg = true
}
}