withfig / autocomplete

IDE-style autocomplete for your existing terminal & shell
https://fig.io
MIT License
24.39k stars 5.4k forks source link

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

Open ScottRobinson03 opened 3 months ago

ScottRobinson03 commented 3 months ago

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 commented 3 months ago

Overview

## src/z.ts: ### Info:
withfig-bot commented 3 months ago

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:

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

ScottRobinson03 commented 3 months ago

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...