Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
`Find all usages (references, definitions, and implementations) of a code symbol across the workspace. This tool locates where a symbol is referenced, defined, or implemented.
Input:
- "symbol": The exact name of the symbol to search for (function, class, method, variable, type, etc.).
- "uri": A full URI (e.g. "file:///path/to/file.ts") of a file within the current workspace or working directory where the symbol appears. Provide either "uri" or "filePath".
- "filePath": A file path relative to the current working directory when one is set, otherwise the first workspace folder (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".
- "lineContent": A substring of the line of code where the symbol appears. This is used to locate the exact position in the file. Must be the actual text from the file - do NOT fabricate it.
IMPORTANT: The file and line do NOT need to be the definition of the symbol. Any occurrence works - a usage, an import, a call site, etc. You can pick whichever occurrence is most convenient.
If the tool returns an error, retry with corrected input - ensure the file path is correct, the line content matches the actual file content, and the symbol name appears in that line.`
;
/**
* Static description that does not depend on the set of registered reference
* providers, so it stays byte-stable across requests as language extensions
* activate during a turn.
*/
const
=
+
`
If the file's language has no reference provider registered, the tool returns an error.`
;
export
class
UsagesTool
extends
Disposable
implements
IToolImpl
{
constructor
(
@ILanguageFeaturesService
private
readonly
:
,
@IModelService
private
readonly
:
,
@ISearchService
private
readonly
:
,
@ITextModelService
private
readonly
:
,
@IWorkspaceContextService
private
readonly
:
,
@IUriIdentityService
private
readonly
:
,
)
{
super
(
)
;
}
getToolData
(
)
:
{
return
this
.
_buildToolData
(
,
localize
(
'tool.usages.userDescription'
,
'Find references, definitions, and implementations of a symbol'
)
,
)
;
}
private
_buildToolData
(
:
string
,
:
string
)
:
{
return
{
:
,
:
'usages'
,
:
false
,
:
.
fromId
(
.
.
)
,
:
localize
(
'tool.usages.displayName'
,
'List Code Usages'
)
,
,
,
:
.
,
:
{
:
'object'
,
:
{
symbol
:
{
:
'string'
,
:
'The exact name of the symbol (function, class, method, variable, type, etc.) to find usages of.'
}
,
:
{
:
'string'
,
:
'A full URI of a file within the current workspace or working directory where the symbol appears (e.g. "file:///path/to/file.ts"). Provide either "uri" or "filePath".'
}
,
:
{
:
'string'
,
:
'A file path relative to the current working directory when one is set, otherwise the first workspace folder, where the symbol appears (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".'
}
,
:
{
:
'string'
,
:
'A substring of the line of code where the symbol appears. Used to locate the exact position. Must be actual text from the file.'
}
}
,
:
[
'symbol'
,
'lineContent'
]
}
}
;
}
async
prepareToolInvocation
(
:
,
:
)
:
Promise
<
|
undefined
>
{
const
=
.
as
;
return
{
:
localize
(
'tool.usages.invocationMessage'
,
'Analyzing usages of `{0}`'
,
.
symbol
)
,
}
;
}
async
invoke
(
:
,
:
,
:
,
:
)
:
Promise
<
>
{
const
=
.
as
;
// --- resolve URI ---
const
=
resolveSymbolToolFileUri
(
,
this
.
,
this
.
,
.
?.
)
;
if
(
!
)
{
return
errorResult
(
localize
(
'tool.usages.invalidFile'
,
'Provide either "uri" (a full URI) or "filePath" (a workspace-relative path) to identify a file within the current workspace or working directory.'
)
)
;
}
// --- open text model ---
const
=
await
this
.
.
createModelReference
(
)
;
try
{
const
=
.
.
;
if
(
!
this
.
.
.
has
(
)
)
{
return
errorResult
(
`No reference provider available for this file's language. The usages tool may not support this language.`
)
;
}
// --- find line containing lineContent ---
const
=
findLineNumber
(
,
.
)
;
if
(
===
undefined
)
{
return
errorResult
(
`Could not find line content "${input.lineContent}" in ${uri.toString()}. Provide the exact text from the line where the symbol appears.`
)
;
}
// --- find symbol in that line ---
const
=
.
getLineContent
(
)
;
const
=
findSymbolColumn
(
,
.
symbol
)
;
if
(
===
undefined
)
{
return
errorResult
(
`Could not find symbol "${input.symbol}" in the matched line. Ensure the symbol name is correct and appears in the provided line content.`
)
;
}
const
=
new
Position
(
,
)
;
// --- query references, definitions, implementations in parallel ---
const
[
,
,
]
=
await
Promise
.
all
(
[
getDefinitionsAtPosition
(
this
.
.
,
,
,
false
,
)
,
getReferencesAtPosition
(
this
.
.
,
,
,
false
,
false
,
)
,
getImplementationsAtPosition
(
this
.
.
,
,
,
false
,
)
,
]
)
;
const
=
.
?.
;
const
=
.
filter
(
=>
isSymbolToolResourceInScope
(
.
,
this
.
,
this
.
,
)
)
;
if
(
.
===
0
)
{
const
=
createToolSimpleTextResult
(
`No usages found for \`${input.symbol}\`.`
)
;
.
=
new
MarkdownString
(
localize
(
'tool.usages.noResults'
,
'Analyzed usages of `{0}`, no results'
,
.
symbol
)
)
;
return
;
}
// --- classify and format results with previews ---
const
=
await
this
.
_getLinePreviews
(
.
symbol
,
,
,
)
;
const
:
string
[
]
=
[
]
;
.
push
(
`${references.length} usages of \`${input.symbol}\`:\n`