@@ -133,12 +133,12 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
133
133
return UTF8String[], 0 : - 1 , false
134
134
end
135
135
136
- matches = UTF8String[]
136
+ matches = Dict { UTF8String,Bool} ()
137
137
for file in files
138
138
if startswith (file, prefix)
139
139
id = try isdir (joinpath (dir, file)) catch ; false end
140
140
# joinpath is not used because windows needs to complete with double-backslash
141
- push! ( matches, id ? file * (@windows ? " \\\\ " : " /" ) : file)
141
+ matches[ id ? file * (@windows ? " \\\\ " : " /" ) : file] = true
142
142
end
143
143
end
144
144
@@ -178,18 +178,18 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
178
178
# In a perfect world, we would filter on whether the file is executable
179
179
# here, or even on whether the current user can execute the file in question.
180
180
if startswith (file, prefix) && isfile (joinpath (pathdir, file))
181
- push! ( matches, file)
181
+ matches[ file] = true
182
182
end
183
183
end
184
184
end
185
185
end
186
186
187
- matches = UTF8String[replace (s, r" \s " , " \\ " ) for s in matches]
187
+ matchList = UTF8String[replace (s, r" \s " , " \\ " ) for s in keys ( matches) ]
188
188
startpos = pos - endof (prefix) + 1 - length (matchall (r" " , prefix))
189
189
# The pos - endof(prefix) + 1 is correct due to `endof(prefix)-endof(prefix)==0`,
190
190
# hence we need to add one to get the first index. This is also correct when considering
191
191
# pos, because pos is the `endof` a larger string which `endswith(path)==true`.
192
- return matches , startpos: pos, ! isempty (matches )
192
+ return matchList , startpos: pos, ! isempty (matchList )
193
193
end
194
194
195
195
# Determines whether method_complete should be tried. It should only be done if
0 commit comments