Skip to content

Roll out LSP semantic highlighting in Visual Studio - #20965

Open
abonie wants to merge 50 commits into
mainfrom
lsp/semantic-tokens
Open

abonie wants to merge 50 commits into
mainfrom
lsp/semantic-tokens

Conversation

@abonie

@abonie abonie commented Nov 11, 2026

Copy link
Copy Markdown
Member

Description

Integration branch for rolling out LSP-based semantic highlighting in Visual Studio. The LSP server serves textDocument/semanticTokens again, follows the active project context so highlighting stays correct after switching target frameworks, and exposes project contexts and code actions. LSP diagnostics stay off by default in favor of the existing extension. Telemetry is shared between legacy and LSP highlighting so the two paths can be compared during rollout. Also moves the F# LSP extension to VS Extensibility 18.5 / .NET 10.

Checklist

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

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ No release notes required

abonie and others added 18 commits November 11, 2026 11:54
- Merge LSP VSIX into the old VSIX (CreateVsixContainer, AssemblyVSIXSubPath)
- Remove unfinished semantic tokens endpoint from LanguageFeaturesHandler
- Remove SemanticTokensOptions from CapabilitiesManager and VS provider
- Remove TokenTypes module from FSharpRequestContext
- Refactor ClassificationService: simplify classification logic
- Remove unused WorkspaceExtensions and SemanticHighlighting setting
- Rename config field SemanticHighlighting -> CodeActions (default false)
- Bump LSP protocol packages to 17.13.9, add Protocol.Extensions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ILspTelemetry abstraction with NullTelemetry default
- Rename ToLspDiagnostic -> ToVsDiagnostic with severity mapping and project info
- Add makeProjectContextId and snapshotsToProjectInfos shared helpers
- Add VSExtensionConverters to server serializer and formatter
- Expose GetProjectSnapshotsForFile in FSharpWorkspaceQuery
- Respect fsharp.getDiagnosticsFrom unified setting in DocumentDiagnosticAnalyzer
- Refactor LSP tests: extract ProtocolHelpers, add diagnostics tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add ProjectContextsHandler for the _vs_getProjectContexts LSP endpoint
- Register handler in FSharpLanguageServer DI container
- Remove duplicate project contexts handler from VsDiagnosticsHandler
- Add ProjectContextsProtocolTests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add CodeActionHandler with F# code fixes (quickfix actions)
- Register handler in FSharpLanguageServer and CapabilitiesManager
- Add CodeActionProvider capability to VS extension
- Enable CodeActions feature flag by default
- Add CodeActionProtocolTests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add VsTelemetryReporter for VS-side telemetry
- Instrument DocumentStateHandler with open/close events

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add FSharpApexTestBase for VS integration test scaffolding
- Add ErrorListDiagnosticsTests and LightBulbCodeActionTests
- Wire VsTelemetryReporter into VS extension server provider
- Fix whitespace and ordering in project files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Set the effective default of fsharp.getDiagnosticsFrom to 'old' so the
in-proc (old) extension serves diagnostics and the LSP diagnostics
endpoint stays off by default (but remains switchable to lsp/both).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stacks the semantic-tokens-rollout work on top of the diagnostics
rollout branch: adds the textDocument/semanticTokens endpoint and
disables the LSP diagnostics endpoint (the in-proc extension stays
authoritative for diagnostics until that rollout graduates).

This reconstructs the tree of the original semantic-tokens-rollout-prep
branch (preserved as backup) on top of lsp-diagnostics-rollout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove duplicate inline package pins, centralize LSP and Apex test dependencies, and adapt tokenizer and classification regression tests to current main APIs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: df139595-f788-456b-908f-83de4c89548c
Restore Visual Studio Extensibility 17.14.40313 and track CLaSP with the Roslyn dependency flow. Migrate LSP transports and protocol tests to System.Text.Json, adapting framework lifecycle and logger APIs while preserving VS extension metadata.

Prefer CLI event resolutions over synthesized add/remove members, add instance/static event regression coverage, and include the previously untracked project-context tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: df139595-f788-456b-908f-83de4c89548c
Forward Roslyn active document contexts to the LSP server, resolve compiler output identities, and refresh classifications without stale responses. Add alternating-framework and refresh-retry protocol coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5a0d205e-f647-4704-a3f6-1dcd028a0b44
Upgrade the LSP client to 18.12.55 and protocol packages to 18.12.5 to resolve the assembly version conflict.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a8b27f92-13b7-400d-8af8-1f85b6162e46
Align dependent packages, require Visual Studio 18.5, and update VSIX metadata paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a8b27f92-13b7-400d-8af8-1f85b6162e46
Track eligible rollout exposure and provider outcomes, apply shared consent with the Microsoft-internal override, and keep policy forwarding alive beyond document views. Add bounded startup retries, regression tests, and telemetry documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6449d63c-e5d8-4984-b4f5-8330252348fc
@abonie
abonie force-pushed the lsp/semantic-tokens branch from 60112fb to c236379 Compare November 11, 2026 11:07

@abonie abonie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖🕵️ AI review — verify independently.

Comment thread eng/Version.Details.xml Resolved
abonie and others added 5 commits November 11, 2026 15:22
Disable the provider before returning no connection for legacy selections so VS does not repeatedly activate it. Keep exposure telemetry but avoid per-view LSP context wiring for the legacy provider.

Retain disabled diagnostics and code-action fixtures as ignored MSTest classes, discover vstest via vswhere, and build/run the LSP integration project through the shared Apex path with its runsettings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Insert fun before lambda arguments, validate writable assignment targets, preserve implemented interface members and document newlines, and rename all parameter uses to match signatures. Propagate cancellation and report named code-fix failures. Disable code actions by default and opt protocol tests in explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
abonie and others added 6 commits November 11, 2026 15:51
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Treat Host and MiscellaneousFiles as LSP-rendered editor workspaces when
open. Closed documents and other workspace kinds remain eligible for
legacy classification. Update predicate/provider tests and fallback docs.

Validation:
- .\Build.cmd -c Debug: passed, 0 warnings, 0 errors.
- dotnet test --project vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj -c Debug --no-build --filter-class '*Classification*' '*Telemetry*': 235 passed, 0 failed, 0 skipped.
- dotnet fantomas and --check on both touched F# files: passed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300

@abonie abonie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖🕵️ AI re-review — verify independently.

Comment thread eng/tests/TestSplit.fsx Resolved
static member ShouldClassify(provider, workspaceKind, isOpenDocument) =
let isLspEditorWorkspace =
workspaceKind = WorkspaceKind.Host
|| workspaceKind = WorkspaceKind.MiscellaneousFiles

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤖🕵️ Under lsp, open standalone scripts and loose .fs files lose semantic colouring. This predicate skips them, and SingleFileWorkspaceMap puts them in an "F# Miscellaneous Files" project. But the server only learns about .fsproj projects, so GetProjectSnapshotForFile returns None, GetSemanticClassification returns None, and only lexical tokens come back. The "file not in any project" protocol test only checks that the data is well-formed.

// Script.fsx opened with File > Open, not in any project
type Widget() = class end
let w = Widget()   // Widget and w get no type/value colouring; only keywords and literals

Fix: keep legacy classification for document.Project.IsFSharpMiscellaneousOrMetadata (Common/Extensions.fs:67) until the server serves script projects.

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.

🤖🕵️ Legacy fallback verified; LSP still marks active script code excluded

  • Loose.fsx, no project: #if INTERACTIVE / let answer = 42 / #endif
  • all 7 LSP tokens on line 2 = excluded code
  • cause: no defines without a snapshot (SemanticTokens.fs:319)
  • which tagger wins in VS: not tested

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.

🤖🕵️ Checked in VS 18.14 (lsp): active script code is shown as excluded

  • Loose.fsx via File > Open: answer = 42 is grey, only let is blue
  • LSP sends all 7 line-2 tokens as excluded code; legacy adds only the keyword

abonie and others added 2 commits November 13, 2026 13:12
Add the LSP server, CLaSP proxy and LSP protocol tests to FSharp.slnx so
the Linux and macOS legs restore and run FSharp.Compiler.LanguageServer.Tests
(previously rejected there as a VSTest project because it was never built).
Exclude the server and proxy from source-only builds; their VS SDK,
StreamJsonRpc and MessagePack dependencies are not source-built.

Add FSharp.VisualStudio.Extension.Tests.dll to the AssemblyCheck embedded-PDB
skip list like the other test assemblies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
System.Text.Json writes Uri.OriginalString and reads it back with
UriKind.RelativeOrAbsolute, so on Unix a path-based Uri such as
/home/x/file.fs arrives as a relative Uri and setActiveProjectContext
rejects it. Encode the field as an absolute file URI, which fixes the
project-context tests on Linux and macOS.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
abonie and others added 3 commits November 13, 2026 17:46
The LSP server only knows the .fsproj projects VS reports, so documents in
the F# Miscellaneous Files and metadata projects (standalone scripts, loose
files, metadata-as-source) got lexical-only colouring with the lsp provider.
Keep legacy semantic classification for them until the server can synthesize
projects for such documents (#20972).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
@abonie
abonie requested a review from T-Gro November 19, 2026 15:06
Added SystemTextJsonPackageVersion to Version.Details.props.
Match FSharp.Editor.Apex.IntegrationTests: the CI hive setup and -deployExtensions target RoslynDev, and /NoSigninPrompt keeps the first-launch sign-in dialog from blocking DTE registration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
Setting RootSuffix splices /rootSuffix into CommandLineArguments, so assigning CommandLineArguments afterwards dropped it and VS launched the default hive with the in-box F# tools.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
The server classifies functions as FSharp.Function and printf specifiers as FSharp.Printf, matching the protocol tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
@abonie
abonie marked this pull request as ready for review November 24, 2026 17:47
@abonie
abonie requested a review from a team as a code owner November 24, 2026 17:47
| None -> [||]
| Some view ->
let items = ResizeArray<SemanticClassificationItem>()
view.ForEach items.Add

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.

🤖🕵️ Concurrent full + range pulls corrupt tokens

  • in-flight callers share one view → one scratch byte[] (SemanticClassificationKey.fs:17)
  • up to 74/80 responses ≠ serial pull; serial 0/10
  • fix: scratch local to ForEach, drop ReadItem → 0/80
do! changeDocument client uri text 2
let! rs =
    Array.init 8 (fun i -> if i % 2 = 0 then pullSemanticTokensFull client uri else pullSemanticTokensRange client uri visible)
    |> Task.WhenAll // rs[i].Data <> serial pull

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in eedb6c3: ForEach now uses a per-call buffer and ReadItem is gone. Added a regression test comparing concurrent full/range pulls with serial ones.

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.

🤖🕵️ Not observed with VS 18.14

  • full and range never overlapped for one document (0 of 1,521)
  • VS sends range only on open

AbstractLanguageServer<TRequestContext> server, AbstractHandlerProvider handlers)
: RequestExecutionQueue<TRequestContext>(server, handlers)
{
protected override bool CancelInProgressWorkUponMutatingRequest => true;

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.

🤖🕵️ Reads cancelled before start never get a response

  • CLaSP drops the queue item when Task.Run is cancelled before StartRequestAsync
  • Roslyn keeps this false
  • 21/295 pulls still pending 20 s after the last pull returned
for v in 2..60 do
    reads.Add(pullSemanticTokensFull client uri)
    do! changeDocument client uri (text + $"//{v}") v
let! _ = pullSemanticTokensFull client uri // returns; some `reads` never do

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d1baf60: the custom queue is gone, so CLaSP uses Roslyn's default and every request gets a response. Semantic-token requests now capture their project snapshot and active context when dequeued, so later edits can't leak into the result; if the active context changes before the response, they fail with ContentModified. Added your loop as a regression test.

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.

🤖🕵️ Not seen with the VS client

  • 1,174/1,174 token requests answered (3 sessions, incl. fast typing in a 3,000-line file)
  • VS sends no $/cancelRequest; edit-cancelled requests come back as -32800

context.SetActiveProjectContext(request.Uri, snapshot.Identifier)
report "refreshed"
return true
with error when (error :? RemoteInvocationException) || (error :? ConnectionLostException) ->

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.

🤖🕵️ One bad setActiveProjectContext kills the server

  • mutating handler: escaping exception → CLaSP shutdown
  • "C:\\" → ArgumentNullException (:79); "a\u0000b" → ArgumentException (:82)
  • refresh RemoteMethodNotFoundException is not caught here
  • fix: catch-all → false / invalid
let! _ = client.JsonRpc.InvokeWithParameterObjectAsync<bool>("textDocument/fsharp/setActiveProjectContext", { Uri = uri; ProjectFileName = "C:\\"; OutputFileName = "p.dll" })
let! _ = pullSemanticTokensFull client uri // ConnectionLostException

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in eedb6c3: any non-cancellation exception, including a failed refresh, now returns false instead of escaping the handler. Tests cover the root path, an embedded NUL and a client without the refresh method.


telemetry.ReportEvent(TelemetryEvents.GetProjectContexts, [| "project_count", projectContexts.Length :> obj |])

Task.FromResult(VSProjectContextList(ProjectContexts = projectContexts, DefaultIndex = 0))

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.

🤖🕵️ DefaultIndex ignores the active selection

  • select context 1 via setActiveProjectContext → DefaultIndex = 0 here
  • Roslyn sets it from the current context

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in eedb6c3: DefaultIndex now points at the active context and falls back to 0 when none is selected or it was removed.

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.

🤖🕵️ Checked in VS 18.14: no effect on VS colors

  • 0 _vs_projectContext in ~1,500 token requests (3 sessions)
  • navbar switches don't reach the server at all (LspProjectContextListener.fs:103)

System.Diagnostics.Trace.TraceWarning("F# LSP active project context was not accepted.")
}
:> Task)
.FileAndForget("vs/fsharp/lsp/projectContext")

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.

🤖🕵️ Faults here (and :123) skip the F# telemetry checkbox

  • docs/lsp.md: new F# faults need checkbox or internal user
.FileAndForget("vs/fsharp/lsp/projectContext", fileOnlyIf = Func<Exception, bool>(fun _ -> HighlightingTelemetry.instance.IsEnabled options))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in eedb6c3: both FileAndForget calls are now gated on HighlightingTelemetry.instance.IsEnabled options.

"textSpanLength", spanLength :> obj
match range with
| Some r ->
"range_start_line", r.Start.Line :> obj

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.

🤖🕵️ Single-line range sends textSpanLength and all 4 positions

  • docs/lsp.md: positions only for multi-line ranges
  • uri_hash (5 events) is undocumented

Assert.NotNull(result)

Assert.True(
not supportsDelta || not (String.IsNullOrEmpty(result.ResultId)),

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.

🤖🕵️ Always passes

  • Full = SumType(true) (CapabilitiesManager.fs:49) → supportsDelta = false
  • delete ResultId → still green

@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.

🤖🕵️ Split out?

  • CodeActionHandler.fs: 923 lines, ~30 fixes copied from FSharp.Editor, off by default
  • .github/skills: ~400 lines of agent tooling
  • neither needed for highlighting

let server = context.LspServices.GetRequiredService<JsonRpc>()

try
do! server.InvokeWithParameterObjectAsync("workspace/semanticTokens/refresh", null, cancellationToken)

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.

🤖🕵️ workspace/semanticTokens/refresh awaited inside a blocking (mutating) request

  • a client that re-pulls before replying deadlocks until timeout (my test client: 5 s, switch lost)
  • Roslyn sends refresh from a separate queue
  • send it after the mutation, or does the VS client always reply first?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in d31aa95: the handler records the selection and returns without awaiting the client. A SemanticTokensRefreshQueue sends the refresh outside the request queue, coalescing bursts and retrying failed or unanswered attempts (10 s timeout each). A regression test uses a client that pulls tokens before replying to the refresh.

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.

🤖🕵️ Checked in VS 18.14: VS replies first

  • refresh answered in 2-3 ms, re-pull arrives 1 ms later (2 sessions)
  • no deadlock with the VS client; other clients can still hit it

}

[<Fact>]
let ``Namespace is classified as namespace name for VS highlighting`` () =

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.

🤖🕵️ 13 [<Fact>]s repeat the Keywords are classified as keyword [<Theory>] body → one theory row each (and rename the theory)

  • Record field … field name (:683) asserts "property name"

@@ -0,0 +1,7 @@
# Closes all devenv.exe processes launched with /rootsuffix (experimental instances).
Get-CimInstance Win32_Process -Filter "Name = 'devenv.exe'" |
Where-Object { $_.CommandLine -match '/rootsuffix\s+\S+' } |

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.

🤖🕵️ Kills every /rootsuffix devenv, incl. RoslynDev used by the PR's integration tests

  • scope to exp / one PID?


let handler =
EventHandler<DocumentActiveContextChangedEventArgs>(fun _ args ->
if args.SourceTextContainer = view.TextBuffer.AsTextContainer() then

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.

🤖🕵️ Navbar target switch never reaches the server (VS 18.14, lsp)

  • net8.0 → net10.0: no setActiveProjectContext, no refresh (3 switches, 2 sessions); only opening a view sends one
  • Error List follows net10.0, but #if NET8_0 keeps LSP colors and #else turns grey
// <TargetFrameworks>net8.0;net10.0</TargetFrameworks>, navbar switched to net10.0
#if NET8_0
let net8Function (x: int) = x + 8    // still colored as active
#else
let otherFunction (x: int) = x + 10  // grey
#endif

this.ReportState("lsp", "unavailable", [||], enabled)
with
| :? OperationCanceledException when cancellationToken.IsCancellationRequested -> ()
| _ -> this.ReportState("lsp", "unavailable", [||], enabled)

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.

🤖🕵️ providerstate is lsp/unavailable and never ready while the server is up

  • 3/3 VS 18.14 lsp sessions; every fsharp/telemetry/configure reply was {"Generation":N,"SemanticTokensEnabled":true}
  • unavailable came ~0.3 s after the first reply (the retry path needs ≥3.5 min), so it is this catch-all

abonie and others added 3 commits November 30, 2026 18:47
Isolate concurrent classification reads, contain project-context failures and reflect active selections. Gate VS project-context faults on F# telemetry consent and align System.Text.Json provenance with the flowed BCL dependencies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
CLaSP's CancelInProgressWorkUponMutatingRequest cancels reads whose Task.Run
had not started; their queue items never complete, so those requests never get a
response. Restore the default queue and instead capture the semantic-token
document's project snapshot and active context when the queue dequeues the
request. Responses are computed from that snapshot, and requests whose active
project context changed before they respond fail with ContentModified (-32801),
reported as the content_modified telemetry outcome.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300
setActiveProjectContext awaited workspace/semanticTokens/refresh inside a
mutating request, so a client that re-pulls tokens before replying deadlocked
until the request timed out. The handler now records the selection and hands
the refresh to SemanticTokensRefreshQueue, which coalesces bursts, sends the
request outside CLaSP's queue, times out unanswered attempts (cancelling the
in-flight call), retries failed or timed-out attempts with bounded backoff,
stops asking a client without the method, and cancels on shutdown. Refresh
outcomes (refreshed, refresh_failed, refresh_unsupported) and attempts are
reported asynchronously on the existing active-context event.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0c106877-ba3b-418c-9716-697da9c76300

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

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants