aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-21 16:32:30 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-22 18:48:37 -0400
commitdbb3700f62559155871b6b27f4d65cc0db15aee9 (patch)
treee639d9ceb8e159aaee5c8ff7adcb30aa4bee9e90 /src
parentc54cca8ea6c04b59eabf0dc69080f12569e8663a (diff)
Only show the enriched proc information on hover and not on completions
Diffstat (limited to 'src')
-rw-r--r--src/server/documentation.odin56
1 files changed, 34 insertions, 22 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 9220f55..eba1855 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -233,12 +233,20 @@ get_signature :: proc(ast_context: ^AstContext, symbol: ^Symbol) -> string {
for symbol in v.symbols {
if value, ok := symbol.value.(SymbolProcedureValue); ok {
fmt.sbprintf(&sb, "\t%s :: ", symbol.name)
- write_procedure_symbol_signature(&sb, value)
+ write_procedure_symbol_signature(&sb, value, detailed_signature=false)
strings.write_string(&sb, ",\n")
}
}
strings.write_string(&sb, "}")
return strings.to_string(sb)
+ case SymbolProcedureValue:
+ sb := strings.builder_make(ast_context.allocator)
+ if symbol.type_pkg != "" && symbol.type_name != "" {
+ pkg_name := get_pkg_name(ast_context, symbol.type_pkg)
+ fmt.sbprintf(&sb, "%s%s.%s :: ", pointer_prefix, pkg_name, symbol.type_name)
+ }
+ write_procedure_symbol_signature(&sb, v, detailed_signature=true)
+ return strings.to_string(sb)
case SymbolBitFieldValue:
sb := strings.builder_make(ast_context.allocator)
if is_variable {
@@ -342,7 +350,7 @@ get_short_signature :: proc(ast_context: ^AstContext, symbol: ^Symbol) -> string
pkg_name := get_pkg_name(ast_context, symbol.type_pkg)
fmt.sbprintf(&sb, "%s%s.%s :: ", pointer_prefix, pkg_name, symbol.type_name)
}
- write_procedure_symbol_signature(&sb, v)
+ write_procedure_symbol_signature(&sb, v, detailed_signature=false)
return strings.to_string(sb)
case SymbolAggregateValue:
return "proc"
@@ -463,14 +471,16 @@ write_symbol_type_information :: proc(ast_context: ^AstContext, sb: ^strings.Bui
}
}
-write_procedure_symbol_signature :: proc(sb: ^strings.Builder, value: SymbolProcedureValue) {
- if value.inlining == .Inline {
- strings.write_string(sb, "#force_inline ")
- } else if value.inlining == .No_Inline {
- strings.write_string(sb, "#force_no_inline ")
+write_procedure_symbol_signature :: proc(sb: ^strings.Builder, value: SymbolProcedureValue, detailed_signature: bool) {
+ if detailed_signature {
+ if value.inlining == .Inline {
+ strings.write_string(sb, "#force_inline ")
+ } else if value.inlining == .No_Inline {
+ strings.write_string(sb, "#force_no_inline ")
+ }
}
strings.write_string(sb, "proc")
- if s, ok := value.calling_convention.(string); ok {
+ if s, ok := value.calling_convention.(string); ok && detailed_signature {
fmt.sbprintf(sb, " %s ", s)
}
strings.write_string(sb, "(")
@@ -502,20 +512,22 @@ write_procedure_symbol_signature :: proc(sb: ^strings.Builder, value: SymbolProc
} else if value.diverging {
strings.write_string(sb, " -> !")
}
- for tag in value.tags {
- s := ""
- switch tag {
- case .Optional_Ok:
- s = "#optional_ok"
- case .Optional_Allocator_Error:
- s = "#optional_allocator_error"
- case .Bounds_Check:
- s = "#bounds_check"
- case .No_Bounds_Check:
- s = "#no_bounds_check"
- }
-
- fmt.sbprintf(sb, " %s", s)
+ if detailed_signature {
+ for tag in value.tags {
+ s := ""
+ switch tag {
+ case .Optional_Ok:
+ s = "#optional_ok"
+ case .Optional_Allocator_Error:
+ s = "#optional_allocator_error"
+ case .Bounds_Check:
+ s = "#bounds_check"
+ case .No_Bounds_Check:
+ s = "#no_bounds_check"
+ }
+
+ fmt.sbprintf(sb, " %s", s)
+ }
}
}