Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ext/REPLExt/completions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ function complete_expanded_local_dir(s, i1, i2, expanded_user, oldi2)
cmp = REPL.REPLCompletions.complete_path(s, i2, shell_escape=true)
cmp2 = cmp[2]
completions = [REPL.REPLCompletions.completion_text(p) for p in cmp[1]]
completions = filter!(x -> isdir(s[1:prevind(s, first(cmp2)-i1+1)]*x), completions)
completions = filter!(completions) do x
try
isdir(s[1:prevind(s, first(cmp2)-i1+1)]*x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this function return true or false? Does it always do that now or is the fall through returning nothing which would error in filter!?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It throws if it doesn't have perms to stat the path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and it should return false in that case, but right now it isn't I think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vtjnash perhaps you have an opinion on what to do here?

catch e
if e isa Base.IOError && e.code == Base.UV_EACCES
return false
else
rethrow()
end
end
end
if expanded_user
if length(completions) == 1 && endswith(joinpath(homedir(), ""), first(completions))
completions = [joinpath(s, "")]
Expand Down