diff options
| -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 | ||||
| -rw-r--r-- | tests/hover_test.odin | 10 |
6 files changed, 50 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 { diff --git a/tests/hover_test.odin b/tests/hover_test.odin index dc31880..df7aeae 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -2793,6 +2793,16 @@ ast_hover_overloading_struct_with_usings_with_pointers :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.foobar: proc(b: ^Bar)") } + +@(test) +ast_hover_proc_calling_convention :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + f{*}oo :: proc "contextless" (a: int) {} + `, + } + test.expect_hover(t, &source, "test.foo: proc \"contextless\" (a: int)") +} /* Waiting for odin fix |