Remove unused doc info tool (#3892)

* Remove unused doc info tool

* Fix tests

* Fix whitespace

---------

Co-authored-by: João Moreno <joaomoreno@users.noreply.github.com>
This commit is contained in:
Alex Ross
2026-02-20 18:09:46 +01:00
committed by GitHub
parent 45bbb4f4da
commit 88c598c0dd
14 changed files with 4 additions and 147 deletions
+1 -25
View File
@@ -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",
-2
View File
@@ -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.",
@@ -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,
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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, ToolCategory> = {
[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,
@@ -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';
@@ -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<IDocInfoTool> {
static readonly toolName = ToolName.DocInfo;
private static _docTypeNames = new Map<string, string>([
['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<IDocInfoTool>, token: vscode.CancellationToken) {
const docNames = new Set<string>();
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<IDocInfoTool>, token: vscode.CancellationToken): Promise<vscode.PreparedToolInvocation> {
return {
presentation: 'hidden',
};
}
async provideInput(promptContext: IBuildPromptContext): Promise<IDocInfoTool | undefined> {
const seen = new Set<string>();
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);