Skip to content

Commit

Permalink
[REPLCompletions] allow symbol completions within incomplete macrocal…
Browse files Browse the repository at this point in the history
…l expression (#51834)

fix #51827

---------

Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com>
(cherry picked from commit 3b1ba62)
  • Loading branch information
aviatesk authored and KristofferC committed Nov 27, 2023
1 parent 5c9602e commit 2163ca5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stdlib/REPL/src/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,11 @@ function complete_identifiers!(suggestions::Vector{Completion}, @nospecialize(ff
if isinfix
ex = ex.args[end]
end
elseif isexpr(ex, :macrocall) && length(ex.args) > 1
# allow symbol completions within potentially incomplete macrocalls
if s[end] '`' && s[end] ')'
ex = ex.args[end]
end
end
end
append!(suggestions, complete_symbol(ex, name, ffunc, context_module))
Expand Down
12 changes: 12 additions & 0 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1920,3 +1920,15 @@ for (s, compl) in (("2*CompletionFoo.nam", "named"),
c, r = test_complete(s)
@test only(c) == compl
end

# allows symbol completion within incomplete :macrocall
# https://github.com/JuliaLang/julia/issues/51827
macro issue51827(args...)
length(args) 2 || error("@issue51827: incomplete arguments")
return args
end
let s = "@issue51827 Base.ac"
c, r, res = test_complete_context(s)
@test res
@test "acquire" in c
end

0 comments on commit 2163ca5

Please sign in to comment.