Repository navigation
Conversation
67aab9c to
fb794e5
Compare
|
Could you demonstrate this new feature in a video? |
liangmiQwQ
left a comment
There was a problem hiding this comment.
Sorry for late responding 🙇
I'll start by pointing out a few nitpicks, and then I'll use agents tools to check for any edge cases.
I think the most important part of this PR is to ensure the structure of test.json remains as stable as possible. One Rust vp global CLI needs to be compatible with multiple vite-plus local cli. It would possibly bring legacy if the schema changes in the later version for cross-version composition.
|
According to the the discussion, this PR essentially is not an integration with This overall LGTM as the first version. However, since completion data is released with In my opinion, if we proceed with this approach, we could also introduce cc @fengmk2 needs your determination 🙇 |
|
🤔 Did I misunderstand the requirements? I thought it was about integrating with vitest (they already support |
|
Video demo of the feature introduced in this PR. completion-demo.mp4 |
packages/cli/build/completion-metadata.ts Looking at the code, the meta data is generated based on vitest, so there shouldn't be any problem, right? @liangmiQwQ |
liangmiQwQ
left a comment
There was a problem hiding this comment.
Thanks for this. I found four completion problems. Only the first one blocks merging:
- Blocking: with
VP_COMPLETE=0(or empty), a normal command can run in the wrong directory (main.rs:440,completion.rs:53). - Kebab-case Vitest spellings aren't in the completion grammar, and the hand-written alias table is already out of date for Vitest 5.1.1.
- Optional
<boolean>values on nested options are marked as required. - Follow-up:
-C <dir>breaks when the directory name is also a subcommand. This comes from upstream clap_complete and already happens on main.
I'd fix 1–3 in this PR and leave 4 for a follow-up issue or a note in the PR description. Locally, the Rust tests, integration tests and JS unit tests all pass.
🤖 Generated with Codex and Claude Code
| } | ||
|
|
||
| /// Only the leading global -C grammar belongs to the launcher. | ||
| pub(crate) fn command_words(words: &[String]) -> Option<&[String]> { |
There was a problem hiding this comment.
Not blocking, can be a follow-up: -C completion breaks when the directory name is also a top-level subcommand. vp -C dev test --reporte<Tab> returns nothing, while vp -C ./dev test --reporte<Tab> returns --reporter.
The cause is upstream. clap_complete 4.6.11 (src/engine/complete.rs:63) checks whether a word is a subcommand name before it checks whether the word is a pending option's value. So dev is read as vp dev, and test becomes one of its positional arguments. vp -C dev run <Tab> breaks the same way on main today.
A related older case: in bash, -C "team web" reaches us with the quote marks still in the word, so chdir fails and completion falls back to the default.
The PR description lists -C as supported, so either note this limitation there and open an issue, or work around it. One workaround is to rewrite the -C value (for example to its resolved absolute path) and call try_complete with the rewritten arguments. Rewriting in place keeps _CLAP_COMPLETE_INDEX correct.
🤖 Generated with Codex and Claude Code
Closes #2953
Based on the
createCLI()approach discussed with Vitest.Implementation
vitest/node.createCLI()and package them asdist/completion/test.json.-C; use the global package when no runnable local CLI exists.Capabilities
vp env setupvp testandrun,watch,dev,related,bench,list,doctor--no-color), and nested options (--coverage.reporter)--respectedExamples:
vp test --reporte<Tab>→--reporter;vp test list --filesO<Tab>→--filesOnly.Support boundary
init/completeexpansion. Nushell changes and test execution compatibility are outside this PR.