2222
2323import * as vscode from "vscode" ;
2424import { Commands } from "../../commands" ;
25+ import { sendInfo } from "vscode-extension-telemetry-wrapper" ;
2526
2627// Hard caps to keep tool responses within the < 200 token budget.
2728const MAX_SYMBOL_DEPTH = 3 ;
@@ -92,6 +93,7 @@ interface FileStructureInput {
9293
9394const fileStructureTool : vscode . LanguageModelTool < FileStructureInput > = {
9495 async invoke ( options , _token ) {
96+ sendInfo ( "" , { operationName : "lmTool.getFileStructure" } ) ;
9597 const uri = resolveFileUri ( options . input . uri ) ;
9698 const symbols = await vscode . commands . executeCommand < vscode . DocumentSymbol [ ] > (
9799 "vscode.executeDocumentSymbolProvider" , uri ,
@@ -148,6 +150,7 @@ interface FindSymbolInput {
148150
149151const findSymbolTool : vscode . LanguageModelTool < FindSymbolInput > = {
150152 async invoke ( options , _token ) {
153+ sendInfo ( "" , { operationName : "lmTool.findSymbol" } ) ;
151154 const symbols = await vscode . commands . executeCommand < vscode . SymbolInformation [ ] > (
152155 "vscode.executeWorkspaceSymbolProvider" , options . input . query ,
153156 ) ;
@@ -174,6 +177,7 @@ interface FileImportsInput {
174177
175178const fileImportsTool : vscode . LanguageModelTool < FileImportsInput > = {
176179 async invoke ( options , _token ) {
180+ sendInfo ( "" , { operationName : "lmTool.getFileImports" } ) ;
177181 const uri = resolveFileUri ( options . input . uri ) ;
178182 const result = await vscode . commands . executeCommand (
179183 Commands . EXECUTE_WORKSPACE_COMMAND ,
@@ -202,6 +206,7 @@ interface TypeAtPositionInput {
202206
203207const typeAtPositionTool : vscode . LanguageModelTool < TypeAtPositionInput > = {
204208 async invoke ( options , _token ) {
209+ sendInfo ( "" , { operationName : "lmTool.getTypeAtPosition" } ) ;
205210 const uri = resolveFileUri ( options . input . uri ) ;
206211 const position = new vscode . Position ( options . input . line , options . input . character ) ;
207212 const hovers = await vscode . commands . executeCommand < vscode . Hover [ ] > (
@@ -261,6 +266,7 @@ interface CallHierarchyInput {
261266
262267const callHierarchyTool : vscode . LanguageModelTool < CallHierarchyInput > = {
263268 async invoke ( options , _token ) {
269+ sendInfo ( "" , { operationName : "lmTool.getCallHierarchy" } ) ;
264270 const uri = resolveFileUri ( options . input . uri ) ;
265271 const position = new vscode . Position ( options . input . line , options . input . character ) ;
266272
@@ -319,6 +325,7 @@ interface TypeHierarchyInput {
319325
320326const typeHierarchyTool : vscode . LanguageModelTool < TypeHierarchyInput > = {
321327 async invoke ( options , _token ) {
328+ sendInfo ( "" , { operationName : "lmTool.getTypeHierarchy" } ) ;
322329 const uri = resolveFileUri ( options . input . uri ) ;
323330 const position = new vscode . Position ( options . input . line , options . input . character ) ;
324331
@@ -367,6 +374,7 @@ const typeHierarchyTool: vscode.LanguageModelTool<TypeHierarchyInput> = {
367374// ============================================================
368375
369376export function registerJavaContextTools ( context : vscode . ExtensionContext ) : void {
377+ sendInfo ( "" , { operationName : "lmTool.register" } ) ;
370378 context . subscriptions . push (
371379 vscode . lm . registerTool ( "lsp_java_getFileStructure" , fileStructureTool ) ,
372380 vscode . lm . registerTool ( "lsp_java_findSymbol" , findSymbolTool ) ,
0 commit comments