Classify each Find All References line while the search runs - #20533
Draft
xperiandri wants to merge 2 commits into
Draft
xperiandri wants to merge 2 commits into
xperiandri wants to merge 2 commits into
Conversation
C# and VB classify the line of each reference as they find it and hand it to Find All References. F# handed nothing, so the window asked the F# classification service for every line again after the search, one reference at a time. ClassifiedReferenceLine classifies the line the way Roslyn does for them: from the first non-whitespace character to the end of the line, semantic spans over syntactic ones, gaps filled with text. Needs the FSharpSourceReferenceItem constructor that takes the classified line, from dotnet/roslyn#85281. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
xperiandri
commented
Sep 13, 2026
Comment on lines
48
to
50
| |> Array.tryFind (snd >> (=) doc.Project.FilePath) | ||
| |> Option.map (fun (definitionItem, _) -> definitionItem) | ||
| |> Option.defaultValue externalDefinitionItem |
Contributor
Author
There was a problem hiding this comment.
Suggested change
| |> Option.defaultValue externalDefinitionItem | |
| |> Array.tryFindV (snd >> (=) doc.Project.FilePath) | |
| |> ValueOption.map (fun (definitionItem, _) -> definitionItem) | |
| |> ValueOption.defaultValue externalDefinitionItem |
Contributor
Author
There was a problem hiding this comment.
Split out as #20534 — this line isn't touched by this PR.
3 tasks
T-Gro
requested changes
Sep 15, 2026
T-Gro
left a comment
Member
There was a problem hiding this comment.
🤖🕵️ Please shorten the description using this guidance. Focus on the problem and why the change is needed, in simplified technical English. Leave the implementation inventory to the Files tab and retain necessary caveats.
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.
Description
Find All References lists each reference with its line classified. C# and VB classify that line as they find the reference and hand it over. F# handed nothing, so after the search the window asked the F# classification service for the syntactic and semantic classification of every line again, one reference at a time. For a file that is not open, the semantic part comes from a whole-file classification kept for five seconds, so a long result list can outlive it and pay for it again.
dotnet/roslyn#85281 adds a
FSharpSourceReferenceItemconstructor that takes the classified line. This fills it while the search still has the checked file at hand.ClassifiedReferenceLineclassifies the line the way Roslyn'sClassifiedSpansAndHighlightSpanFactoryandClassifierHelperdo:The references found in C# and VB projects are still classified by the window, which asks Roslyn.
Checklist
ClassifiedReferenceLineTestschecks that an indented reference line is covered from its first non-whitespace character to its end, that the reference keeps its semantic classification, and that a literal keeps its syntactic one.Draft
This cannot build until dotnet/roslyn#85281 has flowed. Against a local build of dotnet/roslyn#85280 and #85281 together, the affected
FSharp.Editor.Testsclasses pass (145): Navigate To search, persistent cache, loading search and multi-target search, Find All References and multi-target Find All References, semantic classification, Copilot mentions, and the new tests.🤖 Generated with Claude Code