Skip to content

Commit 2ce76a7

Browse files
authored
Merge pull request #8 from JunoLab/fix7
fix #7
2 parents 4f2cd37 + aca8c20 commit 2ce76a7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/FuzzyCompletions.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,16 @@ function complete_keyword(s::Union{String,SubString{String}})
253253
end
254254

255255
function complete_path(path::AbstractString, pos; use_envpath=false, shell_escape=false)
256+
# https://github.com/JunoLab/FuzzyCompletions.jl/issues/7
257+
if endswith(path, ' ')
258+
# in order to keep type stability, we just return empty completion for this case
259+
return Completion[], 0:-1, false
260+
# return REPL.REPLCompletions.complete_path(
261+
# path, pos;
262+
# use_envpath = use_envpath,
263+
# shell_escape = shell_escape)
264+
end
265+
256266
if Base.Sys.isunix() && occursin(r"^~(?:/|$)", path)
257267
# if the path is just "~", don't consider the expanded username as a prefix
258268
if path == "~"

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,8 @@ end
102102
@inferred FuzzyCompletions.completions("foo", lastindex("foo"), @__MODULE__)
103103
end
104104

105+
@static Sys.isunix() && @testset "https://github.com/JunoLab/FuzzyCompletions.jl/issues/7" begin
106+
(comp(string(@__DIR__, " ")); @test true)
107+
end
108+
105109
end

0 commit comments

Comments
 (0)