Skip to content

Commit 12e6b9c

Browse files
committed
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.
1 parent dcb043c commit 12e6b9c

24 files changed

Lines changed: 81 additions & 12 deletions

packages/types/src/vscode.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export const commandIds = [
4646
"acceptInput",
4747
"focusPanel",
4848
"toggleAutoApprove",
49+
50+
"showRipgrepDiagnostic",
4951
] as const
5052

5153
export type CommandId = (typeof commandIds)[number]

src/activate/registerCommands.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ export const registerCommands = (options: RegisterCommandOptions) => {
7373
context.subscriptions.push(registerRipgrepDiagnosticCommand())
7474
}
7575

76-
const getCommandsMap = ({ context, outputChannel, provider }: RegisterCommandOptions): Record<CommandId, any> => ({
76+
// `showRipgrepDiagnostic` is registered separately by
77+
// `registerRipgrepDiagnosticCommand` (above), which owns the OutputChannel
78+
// lifecycle alongside the command registration, so it's intentionally
79+
// excluded from this map.
80+
const getCommandsMap = ({
81+
context,
82+
outputChannel,
83+
provider,
84+
}: RegisterCommandOptions): Record<Exclude<CommandId, "showRipgrepDiagnostic">, any> => ({
7785
activationCompleted: () => {},
7886
plusButtonClicked: async () => {
7987
const visibleProvider = getVisibleProviderOrLog(outputChannel)

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
},
163163
{
164164
"command": "zoo-code.showRipgrepDiagnostic",
165-
"title": "Show Ripgrep Diagnostic",
165+
"title": "%command.showRipgrepDiagnostic.title%",
166166
"category": "%configuration.title%"
167167
},
168168
{

src/package.nls.ca.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.de.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.es.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.fr.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.hi.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.id.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.nls.it.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)