Skip to content

Conversation

@dibarbet
Copy link
Member

No description provided.

@dibarbet dibarbet force-pushed the restore_server_side branch from 94d8046 to f88f252 Compare November 18, 2025 18:15
languageServer.registerOnRequest(ProjectNeedsRestoreRequest.type, async (params) => {
let projectFilePaths = params.projectFilePaths;
if (getCSharpDevKit()) {
// Only restore '.cs' files (file-based apps) if CDK is loaded.
Copy link
Member

Choose a reason for hiding this comment

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

really nice to delete this also.

showOutput: boolean
projectFiles: string[]
): Promise<void> {
if (_restoreInProgress) {
Copy link
Member

Choose a reason for hiding this comment

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

Now this tracks only restores initiated by the client. Parallel restores on different things are still permitted on the server side. Perhaps that is what we want? At least there doesn't seem to be a need to make a change to that in this PR.

Copy link
Member Author

@dibarbet dibarbet Nov 18, 2025

Choose a reason for hiding this comment

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

right. don't want really multiple manually initiated restores running at once. But server can run automatic restores for diff projects

dibarbet added a commit to dotnet/roslyn that referenced this pull request Nov 19, 2025
Followup to the canonical misc changes.  This PR has two parts

## Move server initiated restore entirely to server
Previously restores initiated by the server had to call out to the
client to setup the correct UI, which then called back to the server to
run the restore, all using custom LSP requests. This wasn't ideal as it
meant extra custom client side code and an extra server -> client ->
server loop.

Instead, we can utilize the standard LSP [server initiated work done
progress](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#serverInitiatedProgress)
API to display progress from the server on the client side. This means
server initiated restores no longer need any custom client code, and the
server can choose when to display a UI without a client code change.

This did require a bit of complex code to handle either the server or
client cancelling the request.

Additionally, we still have custom requests for manually initiated
restores from the client.

## Hide restore progress for canonical files
Utilizing the above change, I modified the server behavior to not show
any progress when restoring the canonical file. This is an internal
server operation and does not need to be displayed client side (based on
feedback it only causes confusion).

CLient side change - dotnet/vscode-csharp#8780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants