Improve LSP project load progress messages - #84744
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
dibarbet
approved these changes
Aug 3, 2026
jasonmalinowski
approved these changes
Aug 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Language Server Protocol (LSP) work-done progress strings for solution/project loading to avoid duplicated title/message text by introducing a new Loading_projects resource and by shifting more detail into progress report messages (including an initial 0% report with the project count).
Changes:
- Add new localized resource key
Loading_projects(“Loading projects...”) acrossLanguageServerResources.resxand allxlflocales. - Update project/solution open progress titles to use shorter strings (including switching solution progress to use the file name).
- Update project loader to emit an initial
WorkDoneProgressReportwithMessage = Loading {N} project(s)...andPercentage = 0, and adjust tests/utilities to assert this behavior.
Show a summary per file
| File | Description |
|---|---|
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.zh-Hant.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.zh-Hans.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.tr.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.ru.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.pt-BR.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.pl.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.ko.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.ja.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.it.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.fr.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.es.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.de.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/xlf/LanguageServerResources.cs.xlf | Add Loading_projects localization entry (new/untranslated). |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/LanguageServerResources.resx | Add Loading_projects resource string. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/OpenSolutionHandler.cs | Use solution file name (not path) in loading/loaded progress strings. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/OpenProjectsHandler.cs | Use Loading_projects for progress title when opening projects. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectLoader.cs | Emit initial 0% progress report with project-count message. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/AutoLoadProjectsInitializer.cs | Adjust progress title vs. start/end messages for auto-load flows. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Workspaces/AutoLoadProjectsTests.cs | Update assertions to new progress titles and validate initial 0% report. |
| src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Utilities/AbstractLanguageServerClientTests.cs | Add helper to await the first WorkDoneProgressReport in tests. |
Copilot's findings
Suppressed comments (2)
src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/OpenProjectsHandler.cs:51
CreateWorkDoneProgressAsyncstill setsTitleand beginMessageto the same string (Loading projects...), so clients that display both will continue to show duplicated text. SinceWorkDoneProgressTrackernow emits a 0% progress report with the detailed count message, consider leaving the beginMessageempty to avoid duplication.
await using var progressReporter = await _workDoneProgressManager.CreateWorkDoneProgressAsync(
reportProgressToClient: true,
title: loadingMessage,
startMessage: loadingMessage,
endMessage: string.Format(LanguageServerResources.Loaded_0_projects, projectsLength),
src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/AutoLoadProjectsInitializer.cs:98
- Same as the VS Code default-solution path case: this solution auto-load path uses an empty
startMessage, which can lead to a blank begin message in clients if no progress reports are emitted. Consider using a non-empty, non-duplicative start message likeLanguageServerResources.Loading_projects.
await StartAndReportProgressAsync(
(reporter) => projectSystem.OpenSolutionAsync(solutionFiles[0], reporter),
title: string.Format(LanguageServerResources.Loading_0, solutionFileName),
startMessage: string.Empty,
endMessage: string.Format(LanguageServerResources.Loaded_0, solutionFileName));
- Files reviewed: 20/20 changed files
- Comments generated: 2
Comment on lines
48
to
+52
| await using var progressReporter = await _workDoneProgressManager.CreateWorkDoneProgressAsync( | ||
| reportProgressToClient: true, | ||
| title: loadingMessage, | ||
| startMessage: loadingMessage, | ||
| endMessage: string.Format(LanguageServerResources.Loaded_0, solutionPath), | ||
| endMessage: string.Format(LanguageServerResources.Loaded_0, solutionFileName), |
Comment on lines
72
to
+76
| await StartAndReportProgressAsync( | ||
| (reporter) => projectSystem.OpenSolutionAsync(solutionPath, reporter), | ||
| startMessage: string.Format(LanguageServerResources.Loading_0, solutionPath), | ||
| endMessage: string.Format(LanguageServerResources.Loaded_0, solutionPath)); | ||
| title: string.Format(LanguageServerResources.Loading_0, solutionFileName), | ||
| startMessage: string.Empty, | ||
| endMessage: string.Format(LanguageServerResources.Loaded_0, solutionFileName)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current progress event title and message are duplicated. This updates them to be unique. Providing more detail in the message while keeping the title short and relevant.
Current:
Title: Loading C:\Users\JoeRob\Source\roslyn\main\roslyn.slnx
Message: Loading C:\Users\JoeRob\Source\roslyn\main\roslyn.slnx
After:
Title: Loading roslyn.slnx
Message Loading xxx projects