Skip to content

Offer F# declarations to the Copilot chat "#" mention picker - #20409

Open
xperiandri wants to merge 3 commits into
dotnet:mainfrom
xperiandri:copilot-mentions
Open

Offer F# declarations to the Copilot chat "#" mention picker#20409
xperiandri wants to merge 3 commits into
dotnet:mainfrom
xperiandri:copilot-mentions

Conversation

@xperiandri

Copy link
Copy Markdown
Contributor

Description

GitHub Copilot Chat's # mention picker in Visual Studio lets you attach a symbol as context. Copilot's built-in provider reads symbols straight off the Roslyn Compilation, which F# projects do not have, so F# types, modules, members and values never showed up there.

This adds FSharpCopilotContextProvider, a brokered service proffered from FSharp.Editor that implements Copilot's ICopilotContextProvider / ICopilotMentionQueryable / ICopilotMentionBatchQueryable contracts directly, backed by the existing NavigateTo parse-tree cache (no project-wide typecheck needed, so the picker answers as fast as you type). A picked mention resolves by fully qualified name against the current solution and attaches the whole declaration — doc comment included — as its snippet.

Solution-wide document scanning in search/declarationsOf runs across documents concurrently, throttled the same way FindReferencesAsync throttles its per-document typechecks, so a query does not launch a parse per document all at once.

FSharpNavigableItemsCache's per-document cache entries move to struct tuples on this hot, per-keystroke path, and its null-workspace check moves to a match per this repo's conventions.

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

xperiandri and others added 2 commits September 1, 2026 00:47
Copilot's built-in symbol provider reads symbols off the Roslyn
compilation, which F# projects do not have, so F# declarations never
appeared in the picker shown for "#".

Proffer a brokered service from FSharp.Editor implementing Copilot's
context-provider and mention-queryable contracts. Declarations come from
the NavigateTo parse-tree cache, so the picker answers without waiting
for a project check; that cache moves into a shared
FSharpNavigableItemsCache used by both features.

A picked mention resolves by fully qualified name against the current
solution, so it survives a file moving, and carries the whole
declaration - doc comment included - as its snippet.

FSharpPackage now registers the provider moniker with Copilot after
package load. The override is no longer DEBUG-only, so it calls its base
implementation, which registers the editor factories.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e path

Sequential per-document scanning made "search" and "declarationsOf" as
slow as the slowest single file; run them across documents concurrently
instead, throttled the same way FindReferencesAsync throttles its
per-document typechecks, so a solution-wide scan does not launch a parse
per document all at once.

FSharpNavigableItemsCache's version-stamp entries move to struct tuples
and its null workspace check to a match, matching this repo's allocation
and null-narrowing conventions on a path every keystroke in the mention
picker hits.

CopilotSymbolMapping collapses its wrapping module into a single
qualified top-level module declaration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ Found changes and release notes in following paths:

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

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@xperiandri

Copy link
Copy Markdown
Contributor Author
image image

@github-actions github-actions Bot added ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Restore Tooling check: PR touches NuGet packages or feeds labels Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Build-Infra, Affects-Restore
Affects-Build-Infra: adds PackageReference and EmbeddedResource to fsproj
Affects-Restore: new package version in eng/Packages.props

Generated by PR Tooling Safety Check · opus46 5.3M ·

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

Labels

⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Restore Tooling check: PR touches NuGet packages or feeds

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant