-
Notifications
You must be signed in to change notification settings - Fork 684
Explain files port #1566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain files port #1566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the --explainFiles
feature by porting the corresponding functionality from the TypeScript compiler. The implementation adds file inclusion reasoning and diagnostic capabilities to explain why specific files are included in the compilation, along with supporting infrastructure for explaining diagnostics with file include reasons.
- File inclusion tracking: Adds comprehensive tracking of why each file is included (root file, import, reference, etc.)
- Explain files output: Implements
--explainFiles
flag to show file inclusion reasons and diagnostic explanations - Diagnostic infrastructure: Creates processing diagnostics system to handle file inclusion explanations
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
internal/compiler/program.go |
Adds ExplainFiles method and file inclusion processor integration |
internal/compiler/includeprocessor.go |
New file inclusion processing system with caching for diagnostic generation |
internal/compiler/fileInclude.go |
Core file inclusion reason tracking and diagnostic generation logic |
internal/compiler/processingDiagnostic.go |
Processing diagnostic infrastructure for file inclusion explanations |
internal/compiler/fileloader.go |
Updates file loading to track inclusion reasons for each file |
internal/compiler/filesparser.go |
Integrates inclusion reason tracking into file parsing workflow |
internal/execute/tsc.go |
Updates CLI to call ExplainFiles when --explainFiles flag is used |
internal/tsoptions/parsedcommandline.go |
Adds methods to get matched file and include specs for diagnostic generation |
internal/tsoptions/tsconfigparsing.go |
Refactors config parsing to support file spec tracking before substitution |
internal/modulespecifiers/specifiers.go |
Updates module specifier generation to use project reference source tracking |
Test baselines | Updated baselines showing new explain files output in various test scenarios |
Comments suppressed due to low confidence (1)
internal/tsoptions/tsconfigparsing.go:17
- The scanner package import was removed but is still being used in line 1188. This will cause a compilation error.
"github.com/microsoft/typescript-go/internal/parser"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM though with https://chromewebstore.google.com/detail/codecov/gedikamndpbemklijjkncpnolildpbgo installed looking at the PR, it seems like a bunch of this code is uncovered so has no tests.
...module/compiler/tripleSlashTypesReferenceWithMissingExports(module=commonjs).errors.txt.diff
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but will need a merge from main (maybe after the trace resolutions code goes in too)
yep waitng on that one to do merge |
Ah, smoke test has pointed to a bug:
|
It seems weird that |
Oh, |
That task is to discover and add types from Would have caught it but i have so many terminals open that i thought previous successful run was the run so didnt notice it right away |
I confused it for ATA, my mistake! |
Porting of --explainFiles
And some of the porting for explaining diagnsotics with file include reason.
TODOs that can be done in another PR