Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(z): WIP - Give zoxide z suggestions for path token as well as cwd #2301

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ScottRobinson03
Copy link
Contributor

@ScottRobinson03 ScottRobinson03 commented Mar 23, 2024

Assistance Required - Can't figure out why CloudWatch CLI won't display what I'm returning. See "Known Issues".

What

This PR is effectively a complete rewrite of the autocomplete logic for zoxide's z command.

In #2300, I made it so that the autocomplete included folders in the cwd. This PR takes it one step further, by also showing folders in the path token (i.e. z ~/Documents/ will give autocomplete for folders in ~/Documents/, e.g. ~/Documents/my-folder).

Known Issues

For some reason the paths I'm returning when there's a path token aren't being displayed by CloudWatch CLI, despite the format being the same as when there's not a path token. See images (taken from the devtools as per cw debug devtools autocomplete):

With a path token:

Result:

image

The array I'm returning:

image

Without a path token:

Result:

image

The array I'm returning:

image

@withfig-bot
Copy link
Collaborator

Overview

src/z.ts:

Info:

@withfig-bot
Copy link
Collaborator

Hello @ScottRobinson03,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

@ScottRobinson03
Copy link
Contributor Author

Have done a bit more debugging, and even with the entire generator as just

        return [
          {
            name: "test",
            description: "Test",
            path: "/test",
            icon: "💾",
            priority: 28,
          },
          {
            name: "other test",
            description: "Second Test",
            path: "/other/test",
            icon: "💾",
            priority: 30,
          },
        ];

it still only works when you've not started typing anything for the directory. I'm guessing there's some config or something that I'm missing to make it work even when you've started typing something...

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