From 12ee36558111931f2ecaf0cfd5f12dfbd80649c7 Mon Sep 17 00:00:00 2001 From: Ben Peachey Higdon Date: Fri, 28 Oct 2022 19:44:42 -0400 Subject: [PATCH] fix hover on arguments of qualified call --- src/requests/hover.jl | 7 ++++++- test/requests/test_hover.jl | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/requests/hover.jl b/src/requests/hover.jl index 1596db49..ac73626a 100644 --- a/src/requests/hover.jl +++ b/src/requests/hover.jl @@ -267,7 +267,12 @@ function get_fcall_position(x::EXPR, documentation, visited=Set{EXPR}()) documentation = string("Datatype field `$(dts.fieldnames[arg_i])`", "\n", documentation) end else - documentation = string("Argument $arg_i of $(minargs) in call to `", CSTParser.str_value(fname), "`\n", documentation) + callname = if CSTParser.is_getfield(fname) + CSTParser.str_value(fname.args[1]) * "." * CSTParser.str_value(CSTParser.get_rhs_of_getfield(fname)) + else + CSTParser.str_value(fname) + end + documentation = string("Argument $arg_i of $(minargs) in call to `", callname, "`\n", documentation) end return documentation else diff --git a/test/requests/test_hover.jl b/test/requests/test_hover.jl index e273db41..3c4d425f 100644 --- a/test/requests/test_hover.jl +++ b/test/requests/test_hover.jl @@ -51,7 +51,7 @@ end @testitem "hover docs" begin include("../test_shared_server.jl") - + settestdoc(""" "I have a docstring" Base.@kwdef struct SomeStruct @@ -60,3 +60,15 @@ end """) @test startswith(hover_test(1, 20).contents.value, "I have a docstring") end + +@testitem "hover argument qualified function" begin + include("../test_shared_server.jl") + + settestdoc(""" + module M + f(a,b,c,d,e) = 1 + end + M.f(1,2,3,4,5) + """) + @test hover_test(3, 5).contents.value == "Argument 1 of 5 in call to `M.f`\n" +end