aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-20 15:37:04 -0400
committerGitHub <noreply@github.com>2025-09-20 15:37:04 -0400
commit789113379206b43f5e1988d807ae3a316174aa7e (patch)
tree381c9c2668bc936b0e9d3671599b4fd91f20bf02
parentc8060630c01f8f46ae12dcc60b96b77a22f29751 (diff)
parentb0ba0838c467c43a92563baf84401e10aae23050 (diff)
Merge pull request #1034 from BradLewis/fix/simd-hover
Add simd tag to simd array hover information
-rw-r--r--src/server/analysis.odin3
-rw-r--r--src/server/ast.odin9
-rw-r--r--src/server/documentation.odin3
-rw-r--r--src/server/symbol.odin1
-rw-r--r--tests/hover_test.odin20
5 files changed, 36 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 7798be9..20c7749 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -3224,6 +3224,9 @@ make_symbol_array_from_ast :: proc(ast_context: ^AstContext, v: ast.Array_Type,
if array_is_soa(v) {
symbol.flags |= {.Soa}
}
+ if array_is_simd(v) {
+ symbol.flags |= {.Simd}
+ }
return symbol
}
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 1ecbb42..91c413f 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -268,6 +268,15 @@ array_is_soa :: proc(array: ast.Array_Type) -> bool {
return false
}
+array_is_simd :: proc(array: ast.Array_Type) -> bool {
+ if array.tag != nil {
+ if basic, ok := array.tag.derived.(^ast.Basic_Directive); ok && basic.name == "simd" {
+ return true
+ }
+ }
+ return false
+}
+
dynamic_array_is_soa :: proc(array: ast.Dynamic_Array_Type) -> bool {
if array.tag != nil {
if basic, ok := array.tag.derived.(^ast.Basic_Directive); ok && basic.name == "soa" {
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 25d9de3..3c75ae3 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -407,6 +407,9 @@ write_short_signature :: proc(sb: ^strings.Builder, ast_context: ^AstContext, sy
strings.write_string(sb, "#soa")
}
strings.write_string(sb, pointer_prefix)
+ if .Simd in symbol.flags {
+ strings.write_string(sb, "#simd")
+ }
if .Soa in symbol.flags {
strings.write_string(sb, "#soa")
}
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index f140694..dac9e7d 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -204,6 +204,7 @@ SymbolFlag :: enum {
ObjCIsClassMethod, // should be set true only when ObjC is enabled
Soa,
SoaPointer,
+ Simd,
Parameter, //If the symbol is a procedure argument
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index f348447..323fe81 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4844,6 +4844,26 @@ ast_hover_proc_param_tags :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.foo: proc(#by_ptr a: int, #any_int b: int)")
}
+
+@(test)
+ast_hover_simd_array :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ f{*}oo := #simd[2]f32{}
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo: #simd[2]f32")
+}
+
+@(test)
+ast_hover_simd_array_pointer :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ f{*}oo := &#simd[4]f32{}
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo: ^#simd[4]f32")
+}
/*
Waiting for odin fix