Steps to reproduce
In live preview mode, and with the options to automatically created the paired characters (so that typing [[
will automatically insert ]]
after the cursor, when typing in a new link to a non-existent file, sometimes the suggestion box comes up with files that don’t match the filename being typed. The filename in the suggestion is a partial match but not a full match, so the suggestion shouldn’t still be there. E.g., I have an existing file named 1-23-23 Daily Tasks
and I type in a new link for a file named 3-23-23 Daily Tasks
for a file that doesn’t exist yet, and the suggestion box shows the 1-23-23 Daily Tasks
file despite it not matching the filename I’ve entered. See screenshot below:
Expected result
When I finish typing the filename, e.g., [[3-23-23 Daily Tasks
for the link and press enter, it should complete the link tag with the non-existent filename I typed, allowing me to click-to-create that file and open it to be edited.
Actual result
When I finish typing the filename for the link and press enter (prior to entering the ]]
to close the tag manually), it “corrects” the filename to the mismatched suggestion instead, thus inserting the incorrect link to a file that already exists but isn’t intended to be linked.
In the past, this worked as expected, but for at least a month or two, possibly a little longer, this has been happening to me instead. Based on the highlighted characters from my screenshot above, it may be something in the matching logic taking the 3-
and using it to match the 3
in the folder name, and then the remainder of the filename 23-23 Daily Tasks
to match the already existing 1-23-23 Daily Tasks
file which is not intended or expected.
Environment
- Operating system:
Windows 10
- Debug info:
SYSTEM INFO:
Obsidian version: v1.1.16
Installer version: v1.1.16
Operating system: Windows 10 Enterprise 10.0.19044
Login status: not logged in
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: light
Community theme: none
Snippets enabled: 0
Restricted mode: on
RECOMMENDATIONS:
In the example from the attached screenshot, the expected behavior would be to match no file since the complete filename doesn’t match a file that already exists, so the auto-suggestions should be blank so that pressing enter with the cursor inside the tag will just exit the tag, leaving the link as it was typed originally, so that the non-existent file can be created and opened/edited by clicking.
Or, alternatively, the default selection in the auto-suggestion box should be to enter the filename as typed, with the other partial matches still offered for selection below, so that simply pressing enter doesn’t alter what was typed. That way, if I did intend to link to one of the existing files, I can still do that by selecting it with the mouse or arrow keys and hitting enter to correct the link to the suggested file.