Repository navigation
Rank and highlight F# Navigate To results like C# and VB - #85280
xperiandri wants to merge 7 commits into
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Preserve the existing internal constructor API and record the new external-access API surface.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds C#/VB-equivalent secondary sorting for F# Navigate To results.
Changes:
- Centralizes secondary-sort computation.
- Propagates active-document context and declaration counts.
- Adds sorting tests and C# workspace test support.
File summaries
| File | Summary |
|---|---|
src/VisualStudio/ExternalAccess/Test/Microsoft.VisualStudio.LanguageServices.ExternalAccess.UnitTests.csproj |
Adds C# workspace support for tests. |
src/VisualStudio/ExternalAccess/Test/FSharp/FSharpNavigateToSearchResultTests.cs |
Tests F# secondary-sort ordering. |
src/VisualStudio/ExternalAccess/Core/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs |
Adds declaration-count metadata and compatibility overload; documentation and API tracking comments remain. |
src/VisualStudio/ExternalAccess/Core/FSharp/Internal/NavigateTo/InternalFSharpNavigateToSearchResult.cs |
Computes F# secondary-sort keys; existing constructor compatibility requires attention. |
src/VisualStudio/ExternalAccess/Core/FSharp/Internal/NavigateTo/FSharpNavigateToSearchService.cs |
Passes active-document context during conversion. |
src/Features/Core/Portable/NavigateTo/RoslynNavigateToItem.cs |
Uses the shared sorting helper. |
src/Features/Core/Portable/NavigateTo/INavigateToSearchResult.cs |
Provides shared secondary-sort computation. |
Review details
Suppressed comments (1)
src/VisualStudio/ExternalAccess/Core/FSharp/NavigateTo/FSharpNavigateToSearchResult.cs:30
- This project explicitly tracks its IVT surface through
InternalAPI.Shipped.txt/InternalAPI.Unshipped.txt, but this new overload and theParameterCount/TypeParameterCountproperties are not added toInternalAPI.Unshipped.txtfor either the Unified or VisualStudio F# namespace entries. Please add those corresponding entries so the external-access contract and the F# side's upcoming use are recorded.
public FSharpNavigateToSearchResult(
string additionalInformation,
string kind,
FSharpNavigateToMatchKind matchKind,
string name,
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The F# result constructor contract must be coordinated with the downstream consumer to avoid a compilation failure.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
c79eec0 to
8695c61
Compare
8695c61 to
3ade1a3
Compare
|
Both points from the last Copilot pass are fixed in
While there: three files carried no byte order mark, which All 189 tests in |
This reverts commit 9eea74ce32. Roslyn now computes the secondary sort from the active document itself, as it does for C# and VB (dotnet/roslyn#85280), so F# no longer tracks the focused file for Navigate To. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… lines Navigate To results pass the parameter and type parameter counts FCS now records, which Roslyn sorts equal matches by (dotnet/roslyn#85280); the persistent index stores them, so its format changes. Find All References reports each F# reference with its line already classified, as C# and VB do (dotnet/roslyn#85281). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This reverts commit 9eea74ce32. Roslyn now computes the secondary sort from the active document itself, as it does for C# and VB (dotnet/roslyn#85280), so F# no longer tracks the focused file for Navigate To. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… lines Navigate To results pass the parameter and type parameter counts FCS now records, which Roslyn sorts equal matches by (dotnet/roslyn#85280); the persistent index stores them, so its format changes. Find All References reports each F# reference with its line already classified, as C# and VB do (dotnet/roslyn#85281). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This reverts commit 9eea74ce32. Roslyn now computes the secondary sort from the active document itself, as it does for C# and VB (dotnet/roslyn#85280), so F# no longer tracks the focused file for Navigate To. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… lines Navigate To results pass the parameter and type parameter counts FCS now records, which Roslyn sorts equal matches by (dotnet/roslyn#85280); the persistent index stores them, so its format changes. Find All References reports each F# reference with its line already classified, as C# and VB do (dotnet/roslyn#85281). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6c2ff65 to
ee22f51
Compare
|
@CyrusNajmabadi I simplified PR description and fixed all remarks. |
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dotnet/roslyn#85280 takes the counts in the same constructor as whether the match kept the name's case and where in the name it landed, so the results window can highlight F# names and rank a case-exact match first. The pattern matcher reports the spans in the candidate it was given, container first, so they move to the name's own offsets; the substring fallback for operators and backticked names reports the span it found itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 9eea74ce32. Roslyn now computes the secondary sort from the active document itself, as it does for C# and VB (dotnet/roslyn#85280), so F# no longer tracks the focused file for Navigate To. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… lines Navigate To results pass the parameter and type parameter counts FCS now records, which Roslyn sorts equal matches by (dotnet/roslyn#85280); the persistent index stores them, so its format changes. Find All References reports each F# reference with its line already classified, as C# and VB do (dotnet/roslyn#85281). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Among results of the same match kind the platform orders by the secondary sort, which RoslynNavigateToItem builds from the folder distance to the active document, the parameter and type parameter counts, the name and the file name. The F# adapter returned null there, so a match in the file being edited was not listed before the same name elsewhere. ComputeSecondarySort moves unchanged to NavigateToSearchResultHelpers. The F# adapter computes it from the active document the searcher already passes, and FSharpNavigateToSearchResult gets a constructor that takes the counts; the old constructor stays and passes zero. The EA test project references the C# workspace layer, because AdhocWorkspace can only create a document for a language whose services are loaded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Also reword the typeParameterCount documentation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
InternalFSharpNavigateToSearchResult reported every F# match as case-insensitive and without matched spans. Navigate To ranks a case-sensitive match ahead of an otherwise equal one (PatternMatch.CompareTo), and highlights the name from the spans, so F# results lost both. The constructor that takes the parameter and type parameter counts now takes isCaseSensitive and nameMatchSpans as well; it has not shipped, so it changes in place. The five-argument constructor stays and passes a case-insensitive match without spans. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The tests needed a document, and `AdhocWorkspace.AddProject` needs language services for the language it names, so they named C# and the test project referenced C# Workspaces - a dependency nothing in these tests is about. They now compose a language service of their own for a language Roslyn has no compilation for, which is what F# is here, and the reference is gone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…byte order mark `InternalFSharpNavigateToSearchResult` takes no active document when the search was not invoked from a document - it checks for that - but said `Document` in a file with nullability disabled. The file is nullable-enabled now and the parameter says so. Three files carried no byte order mark, which `.editorconfig` asks for; one of them had lost the mark it came with. The test's document path is rooted with a forward slash: the sort key ends with the parts of the file name, and a backslash would leave the name attached to the drive letter where a backslash is not a separator. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ions in the API baseline The class has been nullable-enabled since the active document became optional, but the baseline still listed its reference-typed members as oblivious and the constructor with a non-null active document. Record them as the source declares them: `Document? activeDocument` and `Summary` as `string?`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… fixtures once The documentation of ComputeSecondarySort and of the active document parameter repeats the names and the nullable annotation, and the count parameters keep only the part the signature cannot say. The project already enables nullable, so the file no longer needs its own directive. In the tests, one workspace and one result factory replace the setup each test repeated, and the shared test language states what it is without defending why it exists and uses MefConstruction.ImportingConstructorMessage. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ee22f51 to
abfd498
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The change crosses the Roslyn–F# ExternalAccess and IVT boundaries, while downstream compilation, Visual Studio insertion/runtime compatibility, and UI ranking/highlighting remain unverified.
No open issues 🎉
2 resolved since last review
Review effort: Lite
|
@baronfel could you help with merge? |
Navigate To orders matches of the same kind by the folder distance to the file being edited, then by parameter and type parameter count and name, for C# and VB. Roslyn computes the same key for F# results once they carry the counts, which NavigableItem now records. Needs the FSharpNavigateToSearchResult constructor that takes the counts, from dotnet/roslyn#85280. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dotnet/roslyn#85280 takes the counts in the same constructor as whether the match kept the name's case and where in the name it landed, so the results window can highlight F# names and rank a case-exact match first. The pattern matcher reports the spans in the candidate it was given, container first, so they move to the name's own offsets; the substring fallback for operators and backticked names reports the span it found itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Navigate To sorts equal F# matches in a different way than equal C# and VB matches. A match in the active file does not come first. The window does not highlight the matched characters. A match that uses the case of the search pattern does not rank above a match with a different case.
This change gives F# results the same secondary sort as C# and VB results. It also lets F# report if the case matched, and which spans matched. Older F# language services load without a change.
The F# side is dotnet/fsharp#20531 and dotnet/fsharp#20532. The second one can merge only after this change reaches Visual Studio.
Details
INavigateToSearchResult.SecondarySort.RoslynNavigateToItembuilds this key for C# and VB. The key joins the folder distance to the active document, the parameter count, the type parameter count, the name, and the file name.InternalFSharpNavigateToSearchResultreturnednull.ComputeSecondarySortmoves fromRoslynNavigateToItemtoNavigateToSearchResultHelpers. It takes the active document, the item document, the two counts, and the name as arguments. Its logic does not change. Both languages call it.InternalFSharpNavigateToSearchResultbuilds the key from the active document. The searcher already gave this document toFSharpNavigateToSearchService, and the service dropped it.SearchDocumentAsyncpasses the document that it searches, asAbstractNavigateToSearchServicedoes.FSharpNavigateToSearchResultgets a constructor that also takesisCaseSensitive,nameMatchSpans,parameterCountandtypeParameterCount. The old constructor stays. It passes a case-insensitive match, no spans, and zero counts. Results from the old constructor also sort by folder distance.FSharpNavigateToSearchResultis a class. The new constructor is an overload that old binaries never call. The change needs no versioned interface.PatternMatch.CompareTocould not prefer a match that uses the case of the pattern.FSharpNavigateToSearchResultTestsuse the folder layouts ofNavigateToPrioritizeResultInCurrentDocument1to5for an F# result. They also test the case flag, the spans, and the old constructor. The test documents use a language that has no Roslyn compilation. The tests compose a language service for it, so the test project needs no new reference.🤖 Generated with Claude Code