Repository navigation
Let the editor answer reference timestamps for the incremental builder - #20761
Conversation
✅ Release-note check exemptedThe NO_RELEASE_NOTES label or localization-bot authorship exempts this pull request. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new optional callback representation conflicts with the compiler’s required voption convention and needs a thread-safe multi-file adjustment.
1 open finding
What changed in this PR
Adds an internal host-provided reference timestamp source to reduce repeated filesystem access during incremental checking.
Changes:
- Routes the provider through
FSharpCheckerand background compilers. - Uses host stamps for non-framework references while preserving project-reference stamps.
- Adds integration tests and release notes.
| File | Description |
|---|---|
ReferenceStampProviderTests.fs |
Tests provider behavior and invalidation. |
FSharp.Compiler.Service.Tests.fsproj |
Includes the new tests. |
TransparentCompiler.fs |
Forwards provider configuration. |
service.fsi |
Declares and documents the internal API. |
service.fs |
Exposes the checker method. |
IncrementalBuild.fsi |
Extends builder creation parameters. |
IncrementalBuild.fs |
Applies host-provided reference stamps. |
BackgroundCompiler.fsi |
Declares provider plumbing. |
BackgroundCompiler.fs |
Stores and forwards the provider. |
11.0.200.md |
Documents the addition. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
T-Gro
left a comment
There was a problem hiding this comment.
The diff is still way too big - apply the NoBloat instructions and CodeCompaction skill.
Especially the massive code comments would benefit not just with drastic reduction, but ideally with well named functions/arguments/bindings/types making the intention clear.
If a well named piece of code just tells what the comment says - delete the comment.
- Excluding 7 public API documentation lines, this diff still adds 16 implementation and test comment lines and 1513 comment chars.
- Comments bypass the type system and become stale maintenance state. Keep only durable public contracts; express implementation intent through names, functions, active patterns, discriminated unions, and types.
The incremental builder decides whether a project's imports are stale by stat'ing every non-framework reference on every request: IsReferencesInvalidated runs per getOrCreateBuilder with a fresh TimeStampCache. A host that already watches those files can now answer instead. FSharpChecker.SetReferenceStampProvider - internal, for the editor - hands builders a `string -> DateTime` they use both when they are created and when they check for staleness, so the two never disagree and a host view that lags the disk cannot recreate a builder on every request. Project references keep their logical stamps, and a checker nobody gave a provider stats as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parameter is a new optional value, so it is a voption like the other optional values of this compiler. The host's field keeps the option it had: the host's thread writes it and any thread that creates a builder reads it, without a lock, which a single-reference option carries and a struct does not. It is converted once, where the builder is created. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
849a136 to
f4a9961
Compare
The setter's doc states what a host must provide. The notes on the option field, on the shared stamper and on the steps of each test go, as does the release note of an internal API. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Addressed the NoBloat / CodeCompaction review in
|
T-Gro
left a comment
There was a problem hiding this comment.
🤖🕵️ LGTM ✅
Dimensions covered (expand)
- Delta scope, feedback resolution, and pinned-map exclusions (Grok 4.7 High)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al builder Integration only: on the PR branches this waits for dotnet#20459 and dotnet#20761 to merge. A snapshot built from scratch takes its `-r:` stamps from the tracker through FromOptionsWithReferenceStamps, and the checker is given the tracker as its reference stamp provider, so the incremental builder no longer stats every non-framework reference on every request. With that the stamps have readers in every configuration, so references are watched whether or not the transparent compiler and snapshot reuse are on, and the test of that condition goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cherry-pick kept the unlinked copy of the bullet beside the linked one (release notes merge with merge=union). Drop the unlinked copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al builder Integration only: on the PR branches this waits for dotnet#20459 and dotnet#20761 to merge. A snapshot built from scratch takes its `-r:` stamps from the tracker through FromOptionsWithReferenceStamps, and the checker is given the tracker as its reference stamp provider, so the incremental builder no longer stats every non-framework reference on every request. With that the stamps have readers in every configuration, so references are watched whether or not the transparent compiler and snapshot reuse are on, and the test of that condition goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cherry-pick kept the unlinked copy of the bullet beside the linked one (release notes merge with merge=union). Drop the unlinked copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

With the background compiler, every request re-reads the last-write time of each non-framework reference of the project to decide whether its imports are stale.
FSharpChecker.SetReferenceStampProvider(internal) lets a host that already watches those files answer instead.Details
IVsAsyncFileChangeEx2watcher for snapshot reuse #20457 once both are in.🤖 Generated with Claude Code