Draft
Conversation
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/19d44b3e-7bd1-4dc3-8327-ef40363fd5f7 Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/19d44b3e-7bd1-4dc3-8327-ef40363fd5f7 Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue 3250 in Typescript Go integration
Implement "find file references"
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the "find file references" feature (right-click a JS/TS file in VS Code explorer → Find File References), which finds all files that import or triple-slash-reference a given file.
The core challenge:
getReferencesForNonModulewas a stub, and the multi-project search logic required a document position (which file-level queries don't have).Changes
Core algorithm (
internal/ls/findallreferences.go)getReferencesForNonModule()usingprogram.GetNonModuleFileReferences()to enumerate triple-slash reference directives pointing to a fileGetFileReferences(ctx, uri)toLanguageService— dispatches togetReferencedSymbolsForModulefor module files (has exports), orgetReferencesForNonModulefor script filesCompiler helper (
internal/compiler/program.go)GetNonModuleFileReferences(referencedFile)→[]NonModuleFileReferenceto exposefileIncludeReasonsdata for non-module files (triple-slash refs only; imports are handled via module symbol)LSP protocol (
internal/lsp/lsproto/)custom/findFileReferencesrequest: params =FindFileReferencesParams{textDocument}(no position), result =Location[] | nullLSP server (
internal/lsp/server.go)handleFindFileReferences— queries all projects containing the file, callsGetFileReferenceson each, deduplicates resultsVS Code extension (
_extension/)Client.findFileReferences(uri)callingcustom/findFileReferences_typescript.findAllFileReferencescommand (the standard VS Code command hooked by the explorer context menu) that calls the above and shows results viaeditor.action.showReferencesSide effect
Implementing
getReferencesForNonModulealso fixesfindAllReferenceson triple-slash/// <reference path/types/lib>nodes — previously they returned no span and omitted transitive referencing files (e.g.require("./b")in a.jsfile). ThefindAllReferencesTripleSlashsubmodule baseline is updated to match TypeScript's expected output, and the stale diff file is removed.Original prompt
Created from VS Code.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.