Skip to content

Commit 5704eb3

Browse files
authored
Display output channel when addons are clicked (#2850)
This way, when users see that an addon is errored, they can quickly navigate to the output channel to see the error.
1 parent 3f62b8e commit 5704eb3

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

vscode/src/rubyLsp.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,32 @@ export class RubyLsp {
263263
}
264264

265265
const options: vscode.QuickPickItem[] = client.addons
266-
.sort((addon) => {
267-
// Display errored addons last
268-
if (addon.errored) {
269-
return 1;
270-
}
271-
272-
return -1;
273-
})
266+
.sort((addon) => (addon.errored ? 1 : -1))
274267
.map((addon) => {
275268
const icon = addon.errored ? "$(error)" : "$(pass)";
276269
return {
277270
label: `${icon} ${addon.name} ${addon.version ? `v${addon.version}` : ""}`,
278271
};
279272
});
280273

281-
await vscode.window.showQuickPick(options, {
282-
placeHolder: "Addons (readonly)",
274+
const quickPick = vscode.window.createQuickPick();
275+
quickPick.items = options;
276+
quickPick.placeholder = "Addons (click to view output)";
277+
278+
quickPick.onDidAccept(() => {
279+
const selected = quickPick.selectedItems[0];
280+
// Ideally, we should display information that's specific to the selected addon
281+
if (selected) {
282+
this.currentActiveWorkspace()?.outputChannel.show();
283+
}
284+
quickPick.hide();
283285
});
286+
287+
quickPick.onDidHide(() => {
288+
quickPick.dispose();
289+
});
290+
291+
quickPick.show();
284292
}),
285293
vscode.commands.registerCommand(Command.ToggleFeatures, async () => {
286294
// Extract feature descriptions from our package.json

0 commit comments

Comments
 (0)