diff --git a/extensions/copilot/package.json b/extensions/copilot/package.json index 383ddd79610..89d72f7e400 100644 --- a/extensions/copilot/package.json +++ b/extensions/copilot/package.json @@ -1002,31 +1002,7 @@ ] } }, - { - "name": "copilot_getDocInfo", - "displayName": "%copilot.tools.getDocInfo.name%", - "icon": "$(beaker)", - "canBeReferencedInPrompt": false, - "toolReferenceName": "docInfo", - "userDescription": "%copilot.tools.getDocInfo.description%", - "modelDescription": "Find information about how to document it a symbol like a class or function. This tool is useful for generating documentation comments for code symbols. You should use this tool when you think the user is looking for information about how to document a specific code symbol.", - "tags": [], - "inputSchema": { - "type": "object", - "properties": { - "filePaths": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The file paths for which documentation information is needed." - } - }, - "required": [ - "filePaths" - ] - } - }, + { "name": "copilot_getSearchResults", "toolReferenceName": "searchResults", diff --git a/extensions/copilot/package.nls.json b/extensions/copilot/package.nls.json index d85fdd184c7..8d220afa9d4 100644 --- a/extensions/copilot/package.nls.json +++ b/extensions/copilot/package.nls.json @@ -278,7 +278,6 @@ "copilot.tools.applyPatch.description": "Edit text files in the workspace", "copilot.tools.openIntegratedBrowser.description": "Preview a locally hosted website in the Integrated Browser", "copilot.tools.findTestFiles.description": "For a source code file, find the file that contains the tests. For a test file, find the file that contains the code under test", - "copilot.tools.getDocInfo.description": "For a symbol like a class or function, find the information about how to document it", "copilot.tools.changes.description": "Get diffs of changed files", "copilot.tools.newJupyterNotebook.description": "Create a new Jupyter Notebook", "copilot.tools.editNotebook.description": "Edit a notebook file in the workspace", @@ -319,7 +318,6 @@ "copilot.tools.switchAgent.name": "Switch Agent", "copilot.tools.switchAgent.description": "Switch to a different agent mode. Currently only the Plan agent is supported.", "copilot.tools.findTestFiles.name": "Find Test Files", - "copilot.tools.getDocInfo.name": "Doc Info", "copilot.tools.createDirectory.name": "Create Directory", "copilot.tools.createDirectory.description": "Create new directories in your workspace", "github.copilot.config.agent.currentEditorContext.enabled": "When enabled, Copilot will include the name of the current active editor in the context for agent mode.", diff --git a/extensions/copilot/src/extension/intents/node/docIntent.tsx b/extensions/copilot/src/extension/intents/node/docIntent.tsx index a7a64f7eac4..b8dbba421a3 100644 --- a/extensions/copilot/src/extension/intents/node/docIntent.tsx +++ b/extensions/copilot/src/extension/intents/node/docIntent.tsx @@ -31,7 +31,6 @@ import { InlineReplyInterpreter } from '../../prompts/node/inline/promptingSumma import { ProjectedDocument } from '../../prompts/node/inline/summarizedDocument/summarizeDocument'; import { ChatToolReferences, ChatVariables } from '../../prompts/node/panel/chatVariables'; import { HistoryWithInstructions } from '../../prompts/node/panel/conversationHistory'; -import { ContributedToolName } from '../../tools/common/toolNames'; export class InlineDocIntent implements IIntent { @@ -40,7 +39,7 @@ export class InlineDocIntent implements IIntent { readonly id: string = InlineDocIntent.ID; readonly description: string = l10n.t('Add documentation comment for this symbol'); readonly locations: ChatLocation[] = [ChatLocation.Editor]; - readonly commandInfo: IIntentSlashCommandInfo = { toolEquivalent: ContributedToolName.DocInfo }; + readonly commandInfo: IIntentSlashCommandInfo = {}; constructor( @IEndpointProvider private readonly endpointProvider: IEndpointProvider, diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap index f3b9e8248b4..2e3c307cf26 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_non_edit_tools.spec.snap @@ -78,7 +78,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_tools.spec.snap index 81a9e7d1171..6a187dc3a79 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.5/all_tools.spec.snap @@ -77,7 +77,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_non_edit_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_non_edit_tools.spec.snap index e17858cb184..63fa59c6f1e 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_non_edit_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_non_edit_tools.spec.snap @@ -110,7 +110,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_tools.spec.snap index a85b0cd4790..6a369991016 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6-fast/all_tools.spec.snap @@ -109,7 +109,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_non_edit_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_non_edit_tools.spec.snap index e17858cb184..63fa59c6f1e 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_non_edit_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_non_edit_tools.spec.snap @@ -110,7 +110,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_tools.spec.snap index a85b0cd4790..6a369991016 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-opus-4.6/all_tools.spec.snap @@ -109,7 +109,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_non_edit_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_non_edit_tools.spec.snap index f3b9e8248b4..2e3c307cf26 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_non_edit_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_non_edit_tools.spec.snap @@ -78,7 +78,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_tools.spec.snap b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_tools.spec.snap index 81a9e7d1171..6a187dc3a79 100644 --- a/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_tools.spec.snap +++ b/extensions/copilot/src/extension/prompts/node/agent/test/__snapshots__/agentPrompts-claude-sonnet-4.5/all_tools.spec.snap @@ -77,7 +77,6 @@ create_directory create_new_jupyter_notebook create_new_workspace edit_notebook_file -get_doc_info get_project_setup_info get_search_view_results get_vscode_api diff --git a/extensions/copilot/src/extension/tools/common/toolNames.ts b/extensions/copilot/src/extension/tools/common/toolNames.ts index eefde393059..d451959f2ae 100644 --- a/extensions/copilot/src/extension/tools/common/toolNames.ts +++ b/extensions/copilot/src/extension/tools/common/toolNames.ts @@ -47,7 +47,6 @@ export enum ToolName { FindTestFiles = 'test_search', GetProjectSetupInfo = 'get_project_setup_info', SearchViewResults = 'get_search_view_results', - DocInfo = 'get_doc_info', GithubRepo = 'github_repo', IntegratedBrowser = 'open_integrated_browser', CreateDirectory = 'create_directory', @@ -84,7 +83,6 @@ export enum ContributedToolName { ReadFile = 'copilot_readFile', ListDirectory = 'copilot_listDirectory', GetErrors = 'copilot_getErrors', - DocInfo = 'copilot_getDocInfo', GetScmChanges = 'copilot_getChangedFiles', ReadProjectStructure = 'copilot_readProjectStructure', CreateNewWorkspace = 'copilot_createNewWorkspace', @@ -214,9 +212,6 @@ export const toolCategories: Record = { [ToolName.FindTestFiles]: ToolCategory.Testing, [ToolName.CoreRunTest]: ToolCategory.Testing, - // Redundant but Specific - [ToolName.DocInfo]: ToolCategory.RedundantButSpecific, - // Other tools - categorize appropriately [ToolName.ToolReplay]: ToolCategory.RedundantButSpecific, [ToolName.CoreConfirmationTool]: ToolCategory.VSCodeInteraction, diff --git a/extensions/copilot/src/extension/tools/node/allTools.ts b/extensions/copilot/src/extension/tools/node/allTools.ts index 309b01464fe..c1b02609457 100644 --- a/extensions/copilot/src/extension/tools/node/allTools.ts +++ b/extensions/copilot/src/extension/tools/node/allTools.ts @@ -7,7 +7,6 @@ import './applyPatchTool'; import './codebaseTool'; import './createDirectoryTool'; import './createFileTool'; -import './docTool'; import './editNotebookTool'; import './findFilesTool'; import './findTestsFilesTool'; @@ -18,6 +17,7 @@ import './getSearchViewResultsTool'; import './githubRepoTool'; import './insertEditTool'; import './installExtensionTool'; +import './integratedBrowserTool'; import './listDirTool'; import './manageTodoListTool'; import './memoryTool'; @@ -33,8 +33,8 @@ import './runNotebookCellTool'; import './scmChangesTool'; import './searchSubagentTool'; import './searchWorkspaceSymbolsTool'; -import './integratedBrowserTool'; import './testFailureTool'; import './toolReplayTool'; import './vscodeAPITool'; import './vscodeCmdTool'; + diff --git a/extensions/copilot/src/extension/tools/node/docTool.tsx b/extensions/copilot/src/extension/tools/node/docTool.tsx deleted file mode 100644 index 8cc79b4de27..00000000000 --- a/extensions/copilot/src/extension/tools/node/docTool.tsx +++ /dev/null @@ -1,103 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import type * as vscode from 'vscode'; -import { IPromptPathRepresentationService } from '../../../platform/prompts/common/promptPathRepresentationService'; -import { IWorkspaceService } from '../../../platform/workspace/common/workspaceService'; -import { isLocation } from '../../../util/common/types'; -import { URI } from '../../../util/vs/base/common/uri'; -import { LanguageModelTextPart, LanguageModelToolResult } from '../../../vscodeTypes'; -import { IBuildPromptContext } from '../../prompt/common/intents'; -import { ToolName } from '../common/toolNames'; -import { ToolRegistry } from '../common/toolsRegistry'; -import { checkCancellation } from './toolUtils'; - - -interface IDocInfoTool { - readonly filePaths: string[]; -} - -class DocInfoTool implements vscode.LanguageModelTool { - - static readonly toolName = ToolName.DocInfo; - - private static _docTypeNames = new Map([ - ['typescript', 'TSDoc comment'], - ['typescriptreact', 'TSDoc comment'], - ['javascript', 'JSDoc comment'], - ['javascriptreact', 'JSDoc comment'], - ['python', 'docstring'], - ]); - - constructor( - @IWorkspaceService private readonly workspaceService: IWorkspaceService, - @IPromptPathRepresentationService private readonly _promptPathRepresentationService: IPromptPathRepresentationService, - ) { } - - async invoke(options: vscode.LanguageModelToolInvocationOptions, token: vscode.CancellationToken) { - - const docNames = new Set(); - - for (const filePath of options.input.filePaths) { - const uri = this._promptPathRepresentationService.resolveFilePath(filePath); - if (!uri) { - continue; - } - const doc = await this.workspaceService.openTextDocumentAndSnapshot(uri); - const docName: string = DocInfoTool._docTypeNames.get(doc.languageId) || 'documentation comment'; - docNames.add(docName); - } - - checkCancellation(token); - return new LanguageModelToolResult([ - new LanguageModelTextPart(`Please generate ${Array.from(docNames).join(', ')} for the respective files. ONLY add documentation and do not change the code.`) - ]); - } - - async prepareInvocation(options: vscode.LanguageModelToolInvocationPrepareOptions, token: vscode.CancellationToken): Promise { - return { - presentation: 'hidden', - }; - } - - async provideInput(promptContext: IBuildPromptContext): Promise { - const seen = new Set(); - - const filePaths: string[] = []; - const ranges: ([a: number, b: number, c: number, d: number] | undefined)[] = []; - - function addPath(path: string, range: vscode.Range | undefined) { - if (!seen.has(path)) { - seen.add(path); - filePaths.push(path); - ranges.push(range && [range.start.line, range.start.character, range.end.line, range.end.character]); - } - } - - for (const ref of promptContext.chatVariables) { - if (URI.isUri(ref.value)) { - addPath(this._promptPathRepresentationService.getFilePath(ref.value), undefined); - } else if (isLocation(ref.value)) { - addPath(this._promptPathRepresentationService.getFilePath(ref.value.uri), ref.value.range); - } - } - - if (promptContext.workingSet) { - for (const file of promptContext.workingSet) { - addPath(this._promptPathRepresentationService.getFilePath(file.document.uri), file.range); - } - } - - if (!filePaths.length) { - // no context variables or working set - } - - return { - filePaths, - }; - } -} - -ToolRegistry.registerTool(DocInfoTool);