darlal / obsidian-switcher-plus

Enhanced Quick Switcher plugin for Obsidian.md
GNU General Public License v3.0
413 stars 11 forks source link

Autocomplete filepaths #74

Open Kamuish opened 1 year ago

Kamuish commented 1 year ago

Is there any way to autocomplete the filepaths with a given hotkey?

For example, something similar to what was requested in the official forums:

https://forum.obsidian.md/t/auto-complete-path-parts-from-quick-switcher/34135

darlal commented 1 year ago

@Kamuish Thanks for the feature request. I'll take a look at that post.

Kamuish commented 1 year ago

Is there any update on the status of this feature request?

darlal commented 1 year ago

This is still in the backlog for possible future implementation, just haven't gotten to it yet.

Syphdias commented 1 year ago

Someone wrote a PoC and published it here. It is by far not perfect – again poc – and I am not sure which it interferes with Quick Switcher++ .

darlal commented 1 year ago

Thanks for the link! As far as I can tell that PoC just updates the search text prefix with the path from a specific user chosen suggestion. It doesn't seem to do what's being requested, the vault wide path completion using canonical path completion rules similar to a Linux shell. As is, I'm not sure how well it will work with Switcher++, but if it does part of work and it useful in your workflow then that's awesome 👍

Kamuish commented 1 year ago

Thank you for the follow-up, @darlal and @Syphdias . @darlal I am failing to see how that differs from a (simple) tab completion, but I will try to test it out and report back!

Syphdias commented 1 year ago

@darlal is right. The PoC is different than what the initial post suggested. There are multiple things different, but for example the PoC does no partial completion and just picks the next directory of the selected note or file. As an example you could have the note hay/stack/needle.md and you search for "needle" and press tab to get "hay" (deleting "needle"). This is sufficient enough for my uses but indeed not what was suggested. I might even want to get "hay/stack/" after pressing tab, but this is my use case.

The PoC might be close enough for what you are after, too, @Kamuish. I was only searching for similar functionality in different Switcher plugins and stumbled over this issue. Later I found the PoC code and found it useful and thought I would mention it here. But it is different, has bugs (switcher does not update file list), and cannot be installed easily through the community plugins. Which is why I would prefer a project to implement is properly but this takes work of course.

darlal commented 1 year ago

Adding a hotkey to replace/insert the path of the currently highlighted suggestion into the Switcher textbox could be done, if that's would be helpful. A full implementation of path completion as described in the linked post likely won't be a near term item (though well-tested PRs are always welcomed!).