diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-19 15:46:55 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-22 18:48:22 -0400 |
| commit | 4eda03d0564acbbd577edb54183f4443fbdd0e94 (patch) | |
| tree | 14cb81c9595722d407f6b277f4976cfd8b99aabf /src/server | |
| parent | 01dd0ca11f34a58c9470ed377142da4a144631f2 (diff) | |
Add proc calling convention to hover information
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/analysis.odin | 13 | ||||
| -rw-r--r-- | src/server/clone.odin | 16 | ||||
| -rw-r--r-- | src/server/collector.odin | 13 | ||||
| -rw-r--r-- | src/server/documentation.odin | 3 | ||||
| -rw-r--r-- | src/server/symbol.odin | 13 |
5 files changed, 40 insertions, 18 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 2edae61..0929a61 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2794,12 +2794,13 @@ make_symbol_procedure_from_ast :: proc( } symbol.value = SymbolProcedureValue { - return_types = return_types[:], - orig_return_types = return_types[:], - arg_types = arg_types[:], - orig_arg_types = arg_types[:], - generic = v.generic, - diverging = v.diverging, + return_types = return_types[:], + orig_return_types = return_types[:], + arg_types = arg_types[:], + orig_arg_types = arg_types[:], + generic = v.generic, + diverging = v.diverging, + calling_convention = v.calling_convention, } if _, ok := get_attribute_objc_name(attributes); ok { diff --git a/src/server/clone.odin b/src/server/clone.odin index 7baec58..3fdebdb 100644 --- a/src/server/clone.odin +++ b/src/server/clone.odin @@ -300,3 +300,19 @@ clone_comment_group :: proc( ) -> ^ast.Comment_Group { return cast(^ast.Comment_Group)clone_node(node, allocator, unique_strings) } + +clone_calling_convention :: proc( + cc: ast.Proc_Calling_Convention, allocator: mem.Allocator, unique_strings: ^map[string]string, +) -> ast.Proc_Calling_Convention { + if cc == nil { + return nil + } + + switch v in cc { + case string: + return get_index_unique_string(unique_strings, allocator, v) + case ast.Proc_Calling_Convention_Extra: + return v + } + return nil +} diff --git a/src/server/collector.odin b/src/server/collector.odin index 1995d54..91d948f 100644 --- a/src/server/collector.odin +++ b/src/server/collector.odin @@ -105,12 +105,13 @@ collect_procedure_fields :: proc( } value := SymbolProcedureValue { - return_types = returns[:], - orig_return_types = returns[:], - arg_types = args[:], - orig_arg_types = args[:], - generic = is_procedure_generic(proc_type), - diverging = proc_type.diverging, + return_types = returns[:], + orig_return_types = returns[:], + arg_types = args[:], + orig_arg_types = args[:], + generic = is_procedure_generic(proc_type), + diverging = proc_type.diverging, + calling_convention = clone_calling_convention(proc_type.calling_convention, collection.allocator, &collection.unique_strings), } return value diff --git a/src/server/documentation.odin b/src/server/documentation.odin index cd22b90..34a6752 100644 --- a/src/server/documentation.odin +++ b/src/server/documentation.odin @@ -465,6 +465,9 @@ write_symbol_type_information :: proc(ast_context: ^AstContext, sb: ^strings.Bui write_procedure_symbol_signature :: proc(sb: ^strings.Builder, value: SymbolProcedureValue) { strings.write_string(sb, "proc") + if s, ok := value.calling_convention.(string); ok { + fmt.sbprintf(sb, " %s ", s) + } strings.write_string(sb, "(") for arg, i in value.orig_arg_types { build_string_node(arg, sb, false) diff --git a/src/server/symbol.odin b/src/server/symbol.odin index b65349c..1cde72f 100644 --- a/src/server/symbol.odin +++ b/src/server/symbol.odin @@ -51,12 +51,13 @@ SymbolPackageValue :: struct { } SymbolProcedureValue :: struct { - return_types: []^ast.Field, - arg_types: []^ast.Field, - orig_return_types: []^ast.Field, //When generics have overloaded the types, we store the original version here. - orig_arg_types: []^ast.Field, //When generics have overloaded the types, we store the original version here. - generic: bool, - diverging: bool, + return_types: []^ast.Field, + arg_types: []^ast.Field, + orig_return_types: []^ast.Field, //When generics have overloaded the types, we store the original version here. + orig_arg_types: []^ast.Field, //When generics have overloaded the types, we store the original version here. + generic: bool, + diverging: bool, + calling_convention: ast.Proc_Calling_Convention, } SymbolProcedureGroupValue :: struct { |