-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display output channel when addons are clicked #2850
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,24 +287,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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sort callback needs to handle the case where both addons have the same error state. The current implementation only looks at a single addon at a time, which isn't sufficient for a proper sort. Here's the correct implementation: .sort((a, b) => (a.errored === b.errored ? 0 : a.errored ? 1 : -1)) This ensures stable sorting by comparing both addons and maintaining their relative positions when they share the same error state. Spotted by Graphite Reviewer |
||
.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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sort callback needs to handle the case where both addons have the same error state. The current implementation only looks at a single addon at a time, which isn't sufficient for a proper sort. Here's the correct implementation:
This ensures stable sorting by comparing both addons and maintaining their relative positions when they share the same error state.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.