Skip to content

feat(lookup): always enable path completion even if a spec isn't registered - #176

Merged
versenilvis merged 2 commits into
versenilvis:mainfrom
magnus-rattlehead:always-autocomplete-paths
Oct 13, 2026
Merged

versenilvis merged 2 commits into
versenilvis:mainfrom
magnus-rattlehead:always-autocomplete-paths

Conversation

@magnus-rattlehead

Copy link
Copy Markdown
Contributor

Currently, path autocompletion doesn't work unless a spec is registered for a command. I think we shouldn't have to register a spec for a command just to get path completion. This adds the option to always complete paths

@versenilvis

versenilvis commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

yeah you're right
but I think it's better be a default feature, not a config option (maybe you should open a new PR, idk)

also a bug, the path completion block runs before checking if a spec exists, so for commands that already have a spec (like git), it replaces the entire spec with a stub if any files match. Should be guarded with !exists:

if !exists && config.Get().Core.PathCompletion && partial != "" && !strings.HasPrefix(partial, "-") {

Also the partial redeclaration inside if !exists can be removed now (check lint to understand)

Additional: FileGenerator() is called with the full list of tokens, but partial represents only the last token. This works fine when the user is in the middle of typing a path, but it fails to handle cases like sometool arg1 (where partial is "") due to the partial != "" guard

@magnus-rattlehead

Copy link
Copy Markdown
Contributor Author

yeah you're right but I think it's better be a default feature, not a config option (maybe you should open a new PR, idk)

also a bug, the path completion block runs before checking if a spec exists, so for commands that already have a spec (like git), it replaces the entire spec with a stub if any files match. Should be guarded with !exists:

if !exists && config.Get().Core.PathCompletion && partial != "" && !strings.HasPrefix(partial, "-") {

Also the partial redeclaration inside if !exists can be removed now (check lint to understand)

Additional: FileGenerator() is called with the full list of tokens, but partial represents only the last token. This works fine when the user is in the middle of typing a path, but it fails to handle cases like sometool arg1 (where partial is "") due to the partial != "" guard

I've updated the PR, this actually made the implementation much cleaner

@magnus-rattlehead magnus-rattlehead changed the title add the option to enable path completion even if a spec isn't registered always enable path completion even if a spec isn't registered Oct 13, 2026

@versenilvis versenilvis left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the title to conventional style so I can merge as a commit

@magnus-rattlehead magnus-rattlehead changed the title always enable path completion even if a spec isn't registered feat(lookup): always enable path completion even if a spec isn't registered Oct 13, 2026
@versenilvis
versenilvis merged commit 96597b4 into versenilvis:main Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants