Skip to content

Classify each Find All References line while the search runs - #20533

Draft
xperiandri wants to merge 3 commits into
dotnet:mainfrom
xperiandri:feature/find-references-classified-lines
Draft

xperiandri wants to merge 3 commits into
dotnet:mainfrom
xperiandri:feature/find-references-classified-lines

Conversation

@xperiandri

@xperiandri xperiandri commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

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 constructor that takes the classified line; this fills it while the search still has the checked file at hand, classifying the way Roslyn's own factory does — the line runs from its first non-whitespace character to its end, spans are sorted and clipped, a span overlapping the one before is dropped, semantic spans win over the syntactic spans they overlap, and gaps are filled with plain text. References found in C# and VB projects are still classified by the window.

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.Tests classes pass (145).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Release notes checked


✅ Found changes and release notes in following paths:

Change path Release notes path Description
`vsintegration/src` docs/release-notes/.VisualStudio/18.vNext.md

Comment on lines 48 to 50
@@ -48,11 +49,21 @@ module FSharpFindUsagesService =
|> Option.map (fun (definitionItem, _) -> definitionItem)
|> Option.defaultValue externalDefinitionItem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|> Option.defaultValue externalDefinitionItem
|> Array.tryFindV (snd >> (=) doc.Project.FilePath)
|> ValueOption.map (fun (definitionItem, _) -> definitionItem)
|> ValueOption.defaultValue externalDefinitionItem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split out as #20534 — this line isn't touched by this PR.

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖🕵️ 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.

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Sep 15, 2026
@T-Gro T-Gro added the vsintegration-only Changes only Visual Studio integration, plus optional docs, release notes, or tests label Sep 21, 2026
@xperiandri
xperiandri force-pushed the feature/find-references-classified-lines branch from 6627906 to 9ee88cb Compare September 22, 2026 11:34
xperiandri and others added 2 commits September 26, 2026 03:01
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>
@xperiandri
xperiandri force-pushed the feature/find-references-classified-lines branch from 9ee88cb to db208c0 Compare September 26, 2026 01:01
Linking the note added a copy of it instead of editing the first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vsintegration-only Changes only Visual Studio integration, plus optional docs, release notes, or tests

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants