aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-06-29 19:27:27 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-06-29 19:27:27 -0400
commitc9af6de66b4ab64ed65a9ea118db9036f4ea414d (patch)
tree4dbd97e5094cb4f092ffa2c5cd3c36846aa91ae6
parente3f50ae0af0864091aafdbef043481e33a49a1a2 (diff)
Correct package information on types
-rw-r--r--src/server/documentation.odin12
-rw-r--r--tests/hover_test.odin2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index f671243..b50a18d 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -209,11 +209,17 @@ get_short_signature :: proc(ast_context: ^AstContext, symbol: Symbol) -> string
}
write_symbol_type_information :: proc(ast_context: ^AstContext, sb: ^strings.Builder, symbol: Symbol, pointer_prefix: string) {
+ append_type_pkg := false
pkg_name := get_pkg_name(ast_context, symbol.type_pkg)
- if pkg_name == "" || symbol.type_pkg == symbol.pkg {
- fmt.sbprintf(sb, "%s%s", pointer_prefix, symbol.type_name)
- } else {
+ if pkg_name != "" {
+ if _, ok := keyword_map[symbol.type_name]; !ok {
+ append_type_pkg = true
+ }
+ }
+ if append_type_pkg {
fmt.sbprintf(sb, "%s%s.%s", pointer_prefix, pkg_name, symbol.type_name)
+ } else {
+ fmt.sbprintf(sb, "%s%s", pointer_prefix, symbol.type_name)
}
}
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 2a109f7..32a37ad 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -1519,7 +1519,7 @@ ast_hover_struct_field_distinct :: proc(t: ^testing.T) {
`,
}
- test.expect_hover(t, &source, "S.fb: B // type: fb")
+ test.expect_hover(t, &source, "S.fb: test.B // type: fb")
}
@(test)