include foo in completions as well as path/to/foo matches

This commit is contained in:
Paul Gauthier 2024-08-30 12:39:51 -07:00
parent f6b50fa4c6
commit dea8c0960b

View file

@ -150,15 +150,13 @@ class AutoCompleter(Completer):
for word_match, word_insert in candidates:
if word_match.lower().startswith(last_word.lower()):
rel_fnames = self.fname_to_rel_fnames.get(word_match, [])
yield Completion(word_insert, start_position=-len(last_word), display=word_match)
if rel_fnames:
for rel_fname in rel_fnames:
yield Completion(
rel_fname, start_position=-len(last_word), display=rel_fname
)
else:
yield Completion(
word_insert, start_position=-len(last_word), display=word_match
)
class InputOutput: