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

fix #51827
  • Loading branch information
aviatesk committed Oct 24, 2023
1 parent abd00d0 commit cf3052a
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 @@ -1053,6 +1053,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 @@ -2085,6 +2085,18 @@ for (s, compl) in (("2*CompletionFoo.nam", "named"),
@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
"aquire" in c
end

let t = REPLCompletions.repl_eval_ex(:(`a b`), @__MODULE__; limit_aggressive_inference=true)
@test t isa Core.Const
@test t.val == `a b`
Expand Down

0 comments on commit cf3052a

Please sign in to comment.