Skip to content

Commit

Permalink
allow context module in REPL tab completions
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Aug 28, 2019
1 parent 8093a7c commit bb6c268
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,15 @@ struct LatexCompletions <: CompletionProvider end

beforecursor(buf::IOBuffer) = String(buf.data[1:buf.ptr-1])

context_module = Main
function set_context_module(mod::Module=Main)
global context_module = mod
end

function complete_line(c::REPLCompletionProvider, s)
partial = beforecursor(s.input_buffer)
full = LineEdit.input_string(s)
ret, range, should_complete = completions(full, lastindex(partial))
ret, range, should_complete = completions(full, lastindex(partial), context_module)
return unique!(map(completion_text, ret)), partial[range], should_complete
end

Expand Down

0 comments on commit bb6c268

Please sign in to comment.