Skip to content

Commit

Permalink
Display output channel when addons are clicked (#2850)
Browse files Browse the repository at this point in the history
This way, when users see that an addon is errored, they can quickly
navigate to the output channel to see the error.
  • Loading branch information
st0012 authored Nov 20, 2024
1 parent 3f62b8e commit 5704eb3
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions vscode/src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,24 +263,32 @@ export class RubyLsp {
}

const options: vscode.QuickPickItem[] = client.addons
.sort((addon) => {
// Display errored addons last
if (addon.errored) {
return 1;
}

return -1;
})
.sort((addon) => (addon.errored ? 1 : -1))
.map((addon) => {
const icon = addon.errored ? "$(error)" : "$(pass)";
return {
label: `${icon} ${addon.name} ${addon.version ? `v${addon.version}` : ""}`,
};
});

await vscode.window.showQuickPick(options, {
placeHolder: "Addons (readonly)",
const quickPick = vscode.window.createQuickPick();
quickPick.items = options;
quickPick.placeholder = "Addons (click to view output)";

quickPick.onDidAccept(() => {
const selected = quickPick.selectedItems[0];
// Ideally, we should display information that's specific to the selected addon
if (selected) {
this.currentActiveWorkspace()?.outputChannel.show();
}
quickPick.hide();
});

quickPick.onDidHide(() => {
quickPick.dispose();
});

quickPick.show();
}),
vscode.commands.registerCommand(Command.ToggleFeatures, async () => {
// Extract feature descriptions from our package.json
Expand Down

0 comments on commit 5704eb3

Please sign in to comment.