Skip to content

Commit 2163ca5

Browse files
aviateskKristofferC
andcommitted
[REPLCompletions] allow symbol completions within incomplete macrocall expression (#51834)
fix #51827 --------- Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> (cherry picked from commit 3b1ba62)
1 parent 5c9602e commit 2163ca5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,11 @@ function complete_identifiers!(suggestions::Vector{Completion}, @nospecialize(ff
10411041
if isinfix
10421042
ex = ex.args[end]
10431043
end
1044+
elseif isexpr(ex, :macrocall) && length(ex.args) > 1
1045+
# allow symbol completions within potentially incomplete macrocalls
1046+
if s[end] '`' && s[end] ')'
1047+
ex = ex.args[end]
1048+
end
10441049
end
10451050
end
10461051
append!(suggestions, complete_symbol(ex, name, ffunc, context_module))

stdlib/REPL/test/replcompletions.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,3 +1920,15 @@ for (s, compl) in (("2*CompletionFoo.nam", "named"),
19201920
c, r = test_complete(s)
19211921
@test only(c) == compl
19221922
end
1923+
1924+
# allows symbol completion within incomplete :macrocall
1925+
# https://github.com/JuliaLang/julia/issues/51827
1926+
macro issue51827(args...)
1927+
length(args) 2 || error("@issue51827: incomplete arguments")
1928+
return args
1929+
end
1930+
let s = "@issue51827 Base.ac"
1931+
c, r, res = test_complete_context(s)
1932+
@test res
1933+
@test "acquire" in c
1934+
end

0 commit comments

Comments
 (0)