mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: fix vcompletion for single-file directories (#16586)
This commit is contained in:
@@ -518,6 +518,17 @@ fn auto_complete_request(args []string) []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Handle special case, where there is only one file in the directory
|
||||||
|
// being completed - if it can be resolved we return that since
|
||||||
|
// handling it in the generalized logic below will result in
|
||||||
|
// more complexity.
|
||||||
|
if entries.len == 1 && os.is_file(os.join_path(ls_path, entries[0])) {
|
||||||
|
mut keep_input_path_format := ls_path
|
||||||
|
if !part.starts_with('./') && ls_path.starts_with('./') {
|
||||||
|
keep_input_path_format = keep_input_path_format.all_after('./')
|
||||||
|
}
|
||||||
|
return [os.join_path(keep_input_path_format, entries[0])]
|
||||||
|
}
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
if collect_all || entry.starts_with(last) {
|
if collect_all || entry.starts_with(last) {
|
||||||
list << append_separator_if_dir(entry)
|
list << append_separator_if_dir(entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user