Commit f737649
feat(ripgrep): add Show Ripgrep Diagnostic command (#281)
* feat: add Zoo Code: Show Ripgrep Diagnostic command
Adds a user-triggerable diagnostic for the "Could not find ripgrep
binary" error class. The command runs the same hybrid resolution
that #248 tested — try require("@vscode/ripgrep"), then probe
known appRoot-relative paths — and writes a verbose report to a
dedicated output channel, also copying it to the clipboard.
Motivated by #248: debugging that bug required a custom test build
to inspect resolution state on the user's machine. With this
command shipped, future users hitting weird ripgrep-resolution
behavior can paste the diagnostic into a bug report without us
needing to build instrumented VSIXs.
Reintroduces the @vscode/ripgrep devDep and esbuild external entry
that #248 dropped — the diagnostic needs to call require() to
report what happens. The require attempt also serves as forward-
compat: when VS Code completes the @vscode/ripgrep → @vscode/
ripgrep-universal package-rename migration, it will start
succeeding broadly, and the diagnostic output will be the signal
that we can revisit the require approach in getBinPath itself.
- src/services/ripgrep/diagnostic.ts: new module (data fn + cmd wrapper)
- src/services/ripgrep/internal/loadRipgrep.ts: testable require wrapper
- zoo-code.showRipgrepDiagnostic command wired up in registerCommands.ts
and contributed via package.json
- Tests for the data function
* fix: address review feedback on ripgrep diagnostic command
- diagnostic.ts: fix .asar->.asar.unpacked regex (the \b boundary was
matching inside node_modules.asar.unpacked too, producing
.unpacked.unpacked). Replaced with a path-separator lookahead.
- diagnostic.ts: create the OutputChannel once at registration and
return a composite Disposable that disposes both the command and
the channel; clear the channel before appending so repeated runs
are readable.
- diagnostic.ts: route the command ID through getCommand() instead
of hardcoding 'zoo-code.showRipgrepDiagnostic', and add
'showRipgrepDiagnostic' to the CommandId union in @roo-code/types.
Exclude it from getCommandsMap so the diagnostic's separate
registration owns the OutputChannel lifecycle.
- package.json + package.nls.*.json: switch the command title to a
%command.showRipgrepDiagnostic.title% NLS key across all 18 locale
files.
- loadRipgrep.ts: preserve the require() error message in a
loadError field instead of swallowing it; surface it in the
diagnostic report.
- Tests updated for the loadError case, the already-unpacked path
guard, and widened the mock value type.
* test(ripgrep diagnostic): add Windows-path coverage + appRoot validation
Two polish items from review:
- getRipgrepDiagnostic now early-returns an explanatory message
when vscode.env.appRoot is empty, instead of silently producing
a report with a meaningless path probe. Closes the input-
validation gap surfaced in re-reading the diagnostic.
- New test exercises the .asar->.asar.unpacked substitution on
Windows-style backslash paths. The regex already handles both
separators via [\\/], this just pins it.
* refactor(registerCommands): tighten command map value type
Replace the residual `any` in the command-callback map value with a
`CommandCallback` alias of `(...args: any[]) => unknown`. Mirrors
VS Code's own `commands.registerCommand` signature while narrowing
the return to `unknown` so callers must inspect before use.
Rest-args stay `any[]` intentionally: the callbacks in this map are
heterogeneous (`importSettings` takes an optional `filePath?: string`,
the rest take none), and VS Code dispatches positional args
dynamically — a single tight per-arity type would be lossy without
splitting the map.
* feat(ripgrep): add Show Ripgrep Diagnostic command and translations
---------
Co-authored-by: 0xMink <260166390+0xMink@users.noreply.github.com>
Co-authored-by: edelauna <54631123+edelauna@users.noreply.github.com>
Co-authored-by: Elliott de Launay <edelauna@gmail.com>1 parent 8cc2a4a commit f737649
28 files changed
Lines changed: 612 additions & 14 deletions
File tree
- packages/types/src
- src
- activate
- __tests__
- services/ripgrep
- __tests__
- internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
172 | 176 | | |
173 | 177 | | |
174 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
175 | 187 | | |
176 | 188 | | |
177 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
74 | 93 | | |
75 | 94 | | |
76 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments