aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/analysis.odin6
-rw-r--r--tests/hover_test.odin48
2 files changed, 54 insertions, 0 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 80370d9..a6f3a64 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -2658,6 +2658,12 @@ resolve_unresolved_symbol :: proc(ast_context: ^AstContext, symbol: ^Symbol) ->
symbol.value = ret.value
symbol.pkg = ret.pkg
symbol.flags |= ret.flags
+ if symbol.doc == "" {
+ symbol.doc = ret.doc
+ }
+ if symbol.comment == "" {
+ symbol.comment = ret.comment
+ }
} else {
return false
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index e5e986f..8a54ad4 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -5804,6 +5804,54 @@ ast_hover_nested_proc_docs_spaces :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.foo :: proc()\n\nDocs!\n Docs2\n")
}
+
+@(test)
+ast_hover_propagate_docs_alias_in_package :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(&packages, test.Package{pkg = "my_package", source = `package my_package
+ // Docs!
+ foo :: proc() {} // Comment!
+
+ bar :: foo
+ `})
+ source := test.Source {
+ main = `package test
+ import "my_package"
+
+ main :: proc() {
+ my_package.ba{*}r()
+ }
+ `,
+ packages = packages[:],
+ }
+ test.expect_hover(t, &source, "my_package.bar :: proc()\n Docs!\n\n// Comment!")
+}
+
+@(test)
+ast_hover_propagate_docs_alias_in_package_override :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(&packages, test.Package{pkg = "my_package", source = `package my_package
+ // Docs!
+ foo :: proc() {} // Comment!
+
+ // Overridden
+ bar :: foo
+ `})
+ source := test.Source {
+ main = `package test
+ import "my_package"
+
+ main :: proc() {
+ my_package.ba{*}r()
+ }
+ `,
+ packages = packages[:],
+ }
+ test.expect_hover(t, &source, "my_package.bar :: proc()\n Overridden\n\n// Comment!")
+}
+
/*
Waiting for odin fix