-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Add terminal instance selection for @terminal context mention #10634
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
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -248,6 +248,19 @@ export function getContextMenuOptions( | |||||||||||||
| return commits.length > 0 ? [workingChanges, ...commits] : [workingChanges] | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (selectedType === ContextMenuOptionType.Terminal) { | ||||||||||||||
| const terminals = queryItems.filter((item) => item.type === ContextMenuOptionType.Terminal) | ||||||||||||||
|
Comment on lines
+251
to
+252
Contributor
Author
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. This filtering will include duplicate entries. The Consider filtering out the default terminal item before adding the explicit "All Terminals" option:
Suggested change
Fix it with Roo Code or mention @roomote and request a fix. |
||||||||||||||
| // Always include "All Terminals" option first, then specific terminals | ||||||||||||||
| const allTerminalsOption: ContextMenuQueryItem = { | ||||||||||||||
| type: ContextMenuOptionType.Terminal, | ||||||||||||||
| value: "terminal", | ||||||||||||||
| label: "All Terminals", | ||||||||||||||
| description: "Output from all terminal instances", | ||||||||||||||
| icon: "$(terminal)", | ||||||||||||||
| } | ||||||||||||||
| return terminals.length > 0 ? [allTerminalsOption, ...terminals] : [allTerminalsOption] | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| return [ | ||||||||||||||
| { type: ContextMenuOptionType.Problems }, | ||||||||||||||
| { type: ContextMenuOptionType.Terminal }, | ||||||||||||||
|
|
||||||||||||||
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 100ms delay is an arbitrary heuristic that may not reliably ensure the terminal is focused before
selectAllexecutes.Terminal.show()makes the terminal visible but doesn't guarantee it becomes the active terminal synchronously. On slower machines or busy VS Code instances, this timing may be insufficient, potentially causing content to be copied from the wrong terminal.Consider using a polling approach with
vscode.window.activeTerminalto verify the terminal is actually active, or document this as a known limitation. A more robust pattern might be:Fix it with Roo Code or mention @roomote and request a fix.