Skip to content

Commit

Permalink
even more completion error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pfitzseb committed Jan 7, 2019
1 parent 53932b7 commit 4af4d3e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ end

using REPL.REPLCompletions
function basecompletionadapter(line, mod)
cs = REPL.REPLCompletions.completions(line, lastindex(line), mod)
pre = line[cs[2]]
comps, replace, shouldcomplete = try
REPL.REPLCompletions.completions(line, lastindex(line), mod)
catch err
# might error when e.g. type inference fails
[], 1:0, false
end

pre = line[replace]
d = []
for c in cs[1]
for c in comps
# TODO: get local completions from CSTParser or similar
# TODO: would be cool to provide `descriptionMoreURL` here to open the docpane
if REPLCompletions.afterusing(line, first(cs[2]))
if REPLCompletions.afterusing(line, first(replace))
c isa REPLCompletions.PackageCompletion || continue
end
push!(d, completion(mod, line, c))
try
push!(d, completion(mod, line, c))
catch err
continue
end
end
d, pre
end
Expand Down

0 comments on commit 4af4d3e

Please sign in to comment.