Skip to content

Commit 6eeee77

Browse files
authored
Move terminal selection/command tools to core (#545)
* Move terminal selection/command tools to core Part of microsoft/vscode#259260 * Update baseline
1 parent d965d96 commit 6eeee77

File tree

12 files changed

+17
-168
lines changed

12 files changed

+17
-168
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"icon": "assets/copilot.png",
2323
"pricing": "Trial",
2424
"engines": {
25-
"vscode": "^1.104.0",
25+
"vscode": "^1.104.0-20250811",
2626
"npm": ">=9.0.0",
2727
"node": ">=22.14.0"
2828
},
@@ -495,24 +495,6 @@
495495
},
496496
"when": "config.github.copilot.chat.enableUserPreferences"
497497
},
498-
{
499-
"name": "copilot_getTerminalSelection",
500-
"toolReferenceName": "terminalSelection",
501-
"displayName": "%github.copilot.tools.terminalSelection.name%",
502-
"modelDescription": "Get the user's current selection in the active terminal.",
503-
"userDescription": "%github.copilot.tools.terminalSelection.description%",
504-
"canBeReferencedInPrompt": true,
505-
"icon": "$(terminal)"
506-
},
507-
{
508-
"name": "copilot_getTerminalLastCommand",
509-
"toolReferenceName": "terminalLastCommand",
510-
"displayName": "%github.copilot.tools.terminalLastCommand.name%",
511-
"modelDescription": "Get the active terminal's last run command.",
512-
"userDescription": "%github.copilot.tools.terminalLastCommand.description%",
513-
"canBeReferencedInPrompt": true,
514-
"icon": "$(terminal)"
515-
},
516498
{
517499
"name": "copilot_createNewWorkspace",
518500
"displayName": "%github.copilot.tools.createNewWorkspace.name%",
@@ -1834,26 +1816,11 @@
18341816
"icon": "$(inspect)",
18351817
"category": "Developer"
18361818
},
1837-
{
1838-
"command": "github.copilot.terminal.explainTerminalSelection",
1839-
"title": "%github.copilot.command.explainTerminalSelection%",
1840-
"category": "GitHub Copilot"
1841-
},
1842-
{
1843-
"command": "github.copilot.terminal.explainTerminalSelectionContextMenu",
1844-
"title": "%github.copilot.command.explainTerminalSelectionContextMenu%",
1845-
"category": "GitHub Copilot"
1846-
},
18471819
{
18481820
"command": "github.copilot.terminal.explainTerminalLastCommand",
18491821
"title": "%github.copilot.command.explainTerminalLastCommand%",
18501822
"category": "GitHub Copilot"
18511823
},
1852-
{
1853-
"command": "github.copilot.terminal.attachTerminalSelection",
1854-
"title": "%github.copilot.command.attachTerminalSelection%",
1855-
"category": "GitHub Copilot"
1856-
},
18571824
{
18581825
"command": "github.copilot.git.generateCommitMessage",
18591826
"title": "%github.copilot.git.generateCommitMessage%",
@@ -2847,16 +2814,6 @@
28472814
"group": "copilotAction@5"
28482815
}
28492816
],
2850-
"terminal/context/chat": [
2851-
{
2852-
"command": "github.copilot.terminal.explainTerminalSelectionContextMenu",
2853-
"group": "copilotAction@1"
2854-
},
2855-
{
2856-
"command": "github.copilot.terminal.attachTerminalSelection",
2857-
"group": "zEditContext@1"
2858-
}
2859-
],
28602817
"testing/item/result": [
28612818
{
28622819
"command": "github.copilot.tests.fixTestFailure.fromInline",
@@ -2888,10 +2845,6 @@
28882845
"command": "github.copilot.chat.startCopilotDebugCommand",
28892846
"when": "false"
28902847
},
2891-
{
2892-
"command": "github.copilot.terminal.explainTerminalSelectionContextMenu",
2893-
"when": "false"
2894-
},
28952848
{
28962849
"command": "github.copilot.git.generateCommitMessage",
28972850
"when": "false"

package.nls.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@
8080
"github.copilot.command.showContextInspectorView": "Inspect Language Context",
8181
"github.copilot.command.resetVirtualToolGroups": "Reset Virtual Tool Groups",
8282
"github.copilot.command.applySuggestionWithCopilot": "Apply Suggestion",
83-
"github.copilot.command.explainTerminalSelection": "Explain Terminal Selection",
84-
"github.copilot.command.explainTerminalSelectionContextMenu": "Explain",
8583
"github.copilot.command.explainTerminalLastCommand": "Explain Last Terminal Command",
86-
"github.copilot.command.attachTerminalSelection": "Add Terminal Selection to Chat",
8784
"github.copilot.command.collectWorkspaceIndexDiagnostics": "Collect Workspace Index Diagnostics",
8885
"github.copilot.git.generateCommitMessage": "Generate Commit Message",
8986
"github.copilot.devcontainer.generateDevContainerConfig": "Generate Dev Container Configuration",
@@ -225,10 +222,6 @@
225222
"github.copilot.chat.languageContext.inline.typescript.enabled": "Enables the TypeScript language context provider for inline chats (both generate and edit)",
226223
"github.copilot.command.rerunWithCopilotDebug": "Debug Last Terminal Command",
227224
"github.copilot.config.enableUserPreferences": "Enable remembering user preferences in agent mode.",
228-
"github.copilot.tools.terminalSelection.name": "Terminal Selection",
229-
"github.copilot.tools.terminalSelection.description": "The active terminal's selection",
230-
"github.copilot.tools.terminalLastCommand.name": "Terminal Last Command",
231-
"github.copilot.tools.terminalLastCommand.description": "The active terminal's last run command",
232225
"github.copilot.tools.createAndRunTask.name": "Create and Run Task",
233226
"github.copilot.tools.createAndRunTask.description": "Create and run a task in the workspace",
234227
"github.copilot.tools.createAndRunTask.userDescription": "Create and run a task in the workspace",

src/extension/conversation/vscode-node/conversationFeature.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import { InlineCodeSymbolLinkifier } from '../../linkify/vscode-node/inlineCodeS
3434
import { NotebookCellLinkifier } from '../../linkify/vscode-node/notebookCellLinkifier';
3535
import { SymbolLinkifier } from '../../linkify/vscode-node/symbolLinkifier';
3636
import { IntentDetector } from '../../prompt/node/intentDetector';
37-
import { ContributedToolName } from '../../tools/common/toolNames';
3837
import { SemanticSearchTextSearchProvider } from '../../workspaceSemanticSearch/node/semanticSearchTextSearchProvider';
3938
import { GitHubPullRequestProviders } from '../node/githubPullRequestProviders';
4039
import { startFeedbackCollection } from './feedbackCollection';
@@ -210,9 +209,6 @@ export class ConversationFeature implements IExtensionContribution {
210209
vscode.commands.registerCommand('github.copilot.interactiveSession.feedback', async () => {
211210
return vscode.env.openExternal(vscode.Uri.parse(FEEDBACK_URL));
212211
}),
213-
vscode.commands.registerCommand('github.copilot.terminal.explainTerminalSelection', async () => this.triggerTerminalChat({ query: `/${TerminalExplainIntent.intentName} #terminalSelection` })),
214-
// This command is an alias to use a different title in the context menu
215-
vscode.commands.registerCommand('github.copilot.terminal.explainTerminalSelectionContextMenu', () => vscode.commands.executeCommand('github.copilot.terminal.explainTerminalSelection')),
216212
vscode.commands.registerCommand('github.copilot.terminal.explainTerminalLastCommand', async () => this.triggerTerminalChat({ query: `/${TerminalExplainIntent.intentName} #terminalLastCommand` })),
217213
vscode.commands.registerCommand('github.copilot.terminal.fixTerminalLastCommand', async () => generateTerminalFixes(this.instantiationService)),
218214
vscode.commands.registerCommand('github.copilot.terminal.generateCommitMessage', async () => {
@@ -239,12 +235,6 @@ export class ConversationFeature implements IExtensionContribution {
239235
vscode.window.activeTerminal?.sendText(message, false);
240236
}
241237
}),
242-
vscode.commands.registerCommand('github.copilot.terminal.attachTerminalSelection', async () => {
243-
await vscode.commands.executeCommand('workbench.action.chat.open', {
244-
toolIds: [ContributedToolName.TerminalSelection],
245-
isPartialQuery: true
246-
});
247-
}),
248238
vscode.commands.registerCommand('github.copilot.git.generateCommitMessage', async (rootUri: vscode.Uri | undefined, _: vscode.SourceControlInputBoxValueProviderContext[], cancellationToken: vscode.CancellationToken | undefined) => {
249239
const repository = this.gitCommitMessageService.getRepository(rootUri);
250240
if (!repository) {

src/extension/tools/common/toolNames.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export const enum ToolName {
1919
GetScmChanges = 'get_changed_files',
2020
UpdateUserPreferences = 'update_user_preferences',
2121
ReadProjectStructure = 'read_project_structure',
22-
TerminalSelection = 'get_terminal_selection',
23-
TerminalLastCommand = 'get_terminal_last_command',
2422
CreateNewWorkspace = 'create_new_workspace',
2523
CreateNewJupyterNotebook = 'create_new_jupyter_notebook',
2624
SearchWorkspaceSymbols = 'search_workspace_symbols',
@@ -47,6 +45,8 @@ export const enum ToolName {
4745
CoreManageTodoList = 'manage_todo_list',
4846
CoreRunInTerminal = 'run_in_terminal',
4947
CoreGetTerminalOutput = 'get_terminal_output',
48+
CoreTerminalSelection = 'terminal_selection',
49+
CoreTerminalLastCommand = 'terminal_last_command',
5050
CoreCreateAndRunTask = 'create_and_run_task',
5151
CoreRunTask = 'run_task',
5252
CoreGetTaskOutput = 'get_task_output',
@@ -72,8 +72,6 @@ export const enum ContributedToolName {
7272
DocInfo = 'copilot_getDocInfo',
7373
GetScmChanges = 'copilot_getChangedFiles',
7474
ReadProjectStructure = 'copilot_readProjectStructure',
75-
TerminalSelection = 'copilot_getTerminalSelection',
76-
TerminalLastCommand = 'copilot_getTerminalLastCommand',
7775
CreateNewWorkspace = 'copilot_createNewWorkspace',
7876
CreateNewJupyterNotebook = 'copilot_createNewJupyterNotebook',
7977
EditFile = 'copilot_insertEdit',
@@ -113,8 +111,6 @@ const contributedToolNameToToolNames = new Map<ContributedToolName, ToolName>([
113111
[ContributedToolName.ReadProjectStructure, ToolName.ReadProjectStructure],
114112
[ContributedToolName.EditFile, ToolName.EditFile],
115113
[ContributedToolName.UpdateUserPreferences, ToolName.UpdateUserPreferences],
116-
[ContributedToolName.TerminalSelection, ToolName.TerminalSelection],
117-
[ContributedToolName.TerminalLastCommand, ToolName.TerminalLastCommand],
118114
[ContributedToolName.CreateNewWorkspace, ToolName.CreateNewWorkspace],
119115
[ContributedToolName.CreateNewJupyterNotebook, ToolName.CreateNewJupyterNotebook],
120116
[ContributedToolName.InstallExtension, ToolName.InstallExtension],

src/extension/tools/node/allTools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import './runNotebookCellTool';
3030
import './scmChangesTool';
3131
import './searchWorkspaceSymbolsTool';
3232
import './simpleBrowserTool';
33-
import './terminalStateTools';
3433
import './testFailureTool';
3534
import './thinkTool';
3635
import './usagesTool';

src/extension/tools/node/terminalStateTools.tsx

Lines changed: 0 additions & 87 deletions
This file was deleted.

src/extension/tools/node/test/testToolsService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ export function getPackagejsonToolsForTest() {
205205
// Since it can't get info like `canBeReferencedInPrompt` from the extension API, we have to hardcode tool names here.
206206
tools.add(ToolName.CoreRunInTerminal);
207207
tools.add(ToolName.CoreGetTerminalOutput);
208+
tools.add(ToolName.CoreTerminalLastCommand);
209+
tools.add(ToolName.CoreTerminalSelection);
208210
tools.add(ToolName.CoreCreateAndRunTask);
209211
tools.add(ToolName.CoreGetTaskOutput);
210212
tools.add(ToolName.CoreRunTask);

test/outcome/explain-expanded-context-panel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "explain (expanded context) [panel] [cpp] - includes and interprets variables",
44
"requests": [
5-
"bc518d1c072f945e5811dc213f87414fa1674b7bca593789d3a9afc2c3b092d1"
5+
"4db355fc22e8bdc2b7e9410ed48132224bc04db9097773d1a49c1c2974f668a5"
66
]
77
},
88
{

test/outcome/variables-panel.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"name": "variables [panel] [typescript] - Summarize #terminalSelection",
1010
"requests": [
11-
"1f86a4b500a352a69162c116252b2292057ae2265b23a084b79e53cd239c8c9c"
11+
"1acb67b50e0fda04a5e2a32a1222503b581596a473bea4730186ac240aec432f"
1212
]
1313
}
1414
]

0 commit comments

Comments
 (0)