Yash Thakur adc9bbdc18
Handle multiple exact matches (#15772)
# Description

Fixes #15734. With case-insensitive matching, when completing a
file/folder, there can be multiple exact matches. For example, if you
have three folders `aa/`, `AA/`, and `aaa/`, `aa/<TAB>` should match all
of them. But, as reported in #15734, when using prefix matching, only
`AA/` will be shown. This is because when there's an exact match in
prefix match mode, we only show the first exact match.

There are two options for fixing this:
- Show all matched suggestions (`aa/`, `AA/`, and `aaa/`)
  - I chose this option
- Show only the suggestions that matched exactly (`aa/` and `AA/`) but
not others (`aaa/`)
  - This felt unintuitive

# User-Facing Changes

As mentioned above, when:
- you have multiple folders with the same name but in different cases
- and you're using prefix matching
- and you're using case-insensitive matching
- and you type in the name of one of these folders exactly

then you'll be suggested every folder matching the typed text, rather
than just exact matches

# Tests + Formatting

I added a test that doesn't run on Windows or MacOS (to avoid
case-insensitive filesystems). While adding this test, I felt like using
`Playground` rather than adding files to `tests/fixtures`. To make this
easier, I refactored the `new_*_engine()` helpers in
`completion_helpers.rs` a bit. There was quite a bit of code duplication
there.

# After Submitting

N/A
2025-05-28 21:00:55 +08:00
..
2025-05-13 16:49:30 +02:00