Skip to content

feat: lsp-progress #2649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Anakael
Copy link
Contributor

@Anakael Anakael commented Jan 20, 2025

Resolves #2507

Example:
image

string projectPath = (string)args;
IWorkDoneObserver projectObserver = _server.WorkDoneManager
.Create(new WorkDoneProgressBegin { Title = $"Loading {projectPath}" })
.GetAwaiter()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we change signature to async here?

Copy link
Member

Choose a reason for hiding this comment

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

Sure!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. But diff got big.

@JoeRobich JoeRobich self-requested a review January 24, 2025 00:27
@@ -68,7 +74,8 @@ public static void ProjectInformation(this IEventEmitter emitter,
References = references.Select(hashed => hashed.Value),
FileExtensions = fileExtensions.Select(hashed => hashed.Value),
FileCounts = fileCounts,
SdkStyleProject = sdkStyleProject
SdkStyleProject = sdkStyleProject,
ProjectFilePath = projectFilePath
Copy link
Member

@JoeRobich JoeRobich Mar 19, 2025

Choose a reason for hiding this comment

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

The ProjectConfigurationMessage is used for some rudimentary telemetry. Passing ProjectFilePath may include some PII. Instead of using this message you would likely want to add a new Message type for ProjectLoadFinished.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines +142 to +153
await Task.WhenAll(
_compositionHost
.GetExports<IProjectSystem>()
.Select(ps => ps.WaitForIdleAsync())
.ToArray());

_workDoneObserver?.OnNext(new WorkDoneProgressReport
{
Message = "Language Server ready",
Percentage = 100,
});
_workDoneObserver?.OnCompleted();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want to wait for project loading to complete here. You could extract it to a method and just fire and forget.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, why not move this back to the Initialized method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because in order to send lsp-progress messages to client server must be initialized.
Otherwise there are warnings that server it not initialized and messages about initialization are got all at once after server is initilized.

@@ -2,6 +2,8 @@ namespace OmniSharp.Models.Events
{
public static class EventTypes
{
public const string ProjectLoadingStarted = nameof(ProjectLoadingStarted);
Copy link
Member

Choose a reason for hiding this comment

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

Does this event mean that we have started loading all projects or that we have started loading a single project? If it means a single project then I would recommend ProjectLoadStarted. Same with the Finished event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Single one.
Done.

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.

[LSP] Feature request: Progress support
2 participants