-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptDomain: LS: TSServerIssues related to the TSServerIssues related to the TSServerFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Search Terms
- find references (shift f12)
- TypeScript server
Problem
If you run find all references on an import path, tsserver will return a list of locations where this file is imported:
However it would also be useful to be able to run this command for a file without first having to find where it is imported. Some example use cases:
- Add a command to find references for the currently active file.
- Add a right click option in the explorer to find references to a selected file.
See microsoft/vscode#66150 for details on the VS Code side
Proposal
Add a new FileReferences request to the tsserver protocol. This command would take a file path (and optional project name) and return a list of references:
interface FileReferencesRequest extends FileRequest {
// empty
}
interface FileReferencesResponseBody {
/**
* The file locations referencing the symbol.
*/
refs: readonly ReferencesResponseItem[];
/**
* The name of the symbol.
*/
symbolName: string;
}
interface FileReferencesResponse extends Response {
body?: FileReferencesResponseBody;
}Running this command should return a list of locations where the given file is imported (this matches what running find all references on an import path does)
IllusionMH and carloslahrssen
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: APIRelates to the public API for TypeScriptRelates to the public API for TypeScriptDomain: LS: TSServerIssues related to the TSServerIssues related to the TSServerFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
