aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/ast.odin2
-rw-r--r--src/server/symbol.odin2
-rw-r--r--tests/hover_test.odin29
3 files changed, 31 insertions, 2 deletions
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 59e3de2..d1846f7 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -446,9 +446,9 @@ collect_value_decl :: proc(
global_expr.name_expr = name
if len(value_decl.values) > i {
+ global_expr.value_expr = value_decl.values[i]
if is_variable_declaration(value_decl.values[i]) {
global_expr.flags += {.Variable}
- global_expr.value_expr = value_decl.values[i]
}
}
if value_decl.type != nil {
diff --git a/src/server/symbol.odin b/src/server/symbol.odin
index d2f44ae..2a7cfc6 100644
--- a/src/server/symbol.odin
+++ b/src/server/symbol.odin
@@ -947,7 +947,7 @@ construct_ident_symbol_info :: proc(symbol: ^Symbol, ident: string, document_pkg
symbol.type_name = symbol.name
symbol.type_pkg = symbol.pkg
symbol.name = ident
- if symbol.type == .Variable {
+ if symbol.type == .Variable || symbol.type == .Constant {
symbol.pkg = document_pkg
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 842360b..75b3341 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -5865,6 +5865,35 @@ ast_hover_deferred_attributes :: proc(t: ^testing.T) {
test.expect_hover(t, &source, "test.foo :: proc()")
}
+@(test)
+ast_hover_const_aliases :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: 3 + 4
+ B{*}ar :: Foo
+ `,
+ }
+ test.expect_hover(t, &source, "test.Bar :: Foo")
+}
+
+@(test)
+ast_hover_const_aliases_from_other_pkg :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(&packages, test.Package{pkg = "my_package", source = `package my_package
+ Foo :: 3 + 4
+ `})
+ source := test.Source {
+ main = `package test
+ import "my_package"
+
+ B{*}ar :: my_package.Foo
+ `,
+ packages = packages[:],
+ }
+ test.expect_hover(t, &source, "test.Bar :: my_package.Foo")
+}
+
/*
Waiting for odin fix