aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/analysis.odin11
-rw-r--r--src/server/documentation.odin12
-rw-r--r--tests/hover_test.odin10
3 files changed, 24 insertions, 9 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 44063d6..db37ef7 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -297,7 +297,7 @@ resolve_type_comp_literal :: proc(
}
// odinfmt: disable
-untyped_map: map[SymbolUntypedValueType][]string = {
+untyped_map: [SymbolUntypedValueType][]string = {
.Integer = {
"int", "uint", "u8", "i8", "u16", "i16", "u32", "i32", "u64", "i64", "u128", "i128", "byte",
"i16le", "i16be", "i32le", "i32be", "i64le", "i64be", "i128le", "i128be",
@@ -882,19 +882,12 @@ resolve_basic_lit :: proc(ast_context: ^AstContext, basic_lit: ast.Basic_Lit) ->
value.type = .Integer
} else if v, ok := strconv.parse_bool(basic_lit.tok.text); ok {
value.type = .Bool
- } else if v, ok := strconv.parse_int(basic_lit.tok.text[0:1]); ok {
+ } else if v, ok := strconv.parse_f64(basic_lit.tok.text); ok {
value.type = .Float
} else {
value.type = .String
}
- /*
- out commented because of an infinite loop in parse_f64
- else if v, ok := strconv.parse_f64(basic_lit.tok.text); ok {
- value.type = .Float
- }
- */
-
symbol.pkg = ast_context.current_package
symbol.value = value
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 0dc058f..25d9de3 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -478,6 +478,18 @@ get_bit_field_field_signature :: proc(
write_proc_param_list_and_return :: proc(sb: ^strings.Builder, value: SymbolProcedureValue) {
strings.write_string(sb, "(")
for arg, i in value.orig_arg_types {
+ if .Any_Int in arg.flags {
+ strings.write_string(sb, "#any_int ")
+ }
+ if .By_Ptr in arg.flags {
+ strings.write_string(sb, "#by_ptr ")
+ }
+ if .C_Vararg in arg.flags {
+ strings.write_string(sb, "#c_vararg ")
+ }
+ if .No_Alias in arg.flags {
+ strings.write_string(sb, "#no_alias ")
+ }
build_string_node(arg, sb, false)
if i != len(value.orig_arg_types) - 1 {
strings.write_string(sb, ", ")
diff --git a/tests/hover_test.odin b/tests/hover_test.odin
index 071bcba..f348447 100644
--- a/tests/hover_test.odin
+++ b/tests/hover_test.odin
@@ -4834,6 +4834,16 @@ ast_hover_if_ternary_expr :: proc(t: ^testing.T) {
}
test.expect_hover(t, &source, "test.bar: int")
}
+
+@(test)
+ast_hover_proc_param_tags :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ f{*}oo :: proc (#by_ptr a: int, #any_int b: int) {}
+ `,
+ }
+ test.expect_hover(t, &source, "test.foo: proc(#by_ptr a: int, #any_int b: int)")
+}
/*
Waiting for odin fix