Conversation
|
commit: |
|
i do not understand what this PR does! could you explain a bit? |
Hey! |
src/index.ts
Outdated
| toComplete: string | ||
| ) { | ||
| const commandParts = [...previousArgs]; | ||
| const commandParts = [...previousArgs].filter(arg => arg !== ''); |
There was a problem hiding this comment.
we can just do .filter(Boolean)
src/index.ts
Outdated
| let match = true; | ||
|
|
||
| // For root completion, just match the first part of each command | ||
| if (isRootCompletion) { |
There was a problem hiding this comment.
I do not think this is necessary or it should be that explicit! The while loop below that handles subcommands should already handle this.
|
And I wonder why we did not caught this already in the tests, so there should be tests for this. |
f8e021f to
628b546
Compare
| toComplete: string | ||
| ) { | ||
| const commandParts = [...previousArgs]; | ||
| const commandParts = [...previousArgs].filter(Boolean); |
There was a problem hiding this comment.
This fixes the vite autocompletion issue because when you type vite , the shell might pass something like "vite", "" as the arguments array to the completion function (where the empty string represents the position where TAB was pressed) without this, those empty strings would be treated as actual command parts causing the matching logic to fail when comparing against available commands since no match would be found, no subcommands would be shown here! this cleans up the arguments array to only contain actual command parts like "vite" to make the matching logic to work correctly
* fix root cmd completions * update
No description provided.