Repository navigation
Backlog
Labels
$/progresshttps://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progressenhancementNew feature or request
Milestone
Description
What
- Client-initiated work done progress (3.15): the client puts a
workDoneTokenin a request. The server reportsbegin,reportandendon that token with$/progress, and the client shows it as the progress of that request. Servers say which requests support it withworkDoneProgress: truein their options, e.g.referencesProvider: { workDoneProgress: true }. - Partial results (3.15): the client puts a
partialResultTokenin a request. The server then streams the result in chunks with$/progressand answers with an empty result. The requests that allow it include references, implementation, definition, document and workspace symbols, call and type hierarchy, semantic tokens, and both diagnostics pulls.
Why
Server support:
- typescript-language-server: uses the client's work done token for
workspace/executeCommand, e.g. "Go to source definition" (createProgressReporter(token, workDoneProgress),src/lsp-server.ts,src/lsp-client.ts). Without one, it creates its own withwindow/workDoneProgress/create, which LSP4IJ already shows. - basedpyright: announces
workDoneProgress: truefor definition, declaration and type definition (languageServerBase.ts).
VS Code doesn't use either one for requests either. vscode-languageclient sends a workDoneToken only in initialize, and a partialResultToken only in workspace/diagnostic (client.ts, diagnostic.ts). LSP4IJ does about the same:
- it sends a
partialResultTokeninworkspace/diagnostic(WorkspaceDiagnosticManager.java#L213); - adopters can set a
workDoneTokenininitializethrough theLSPClientFeatures.initializeParamshook (Support workProgressParams on initialize request #750), but LSP4IJ doesn't set one itself.
Since VS Code doesn't send these tokens, servers rarely depend on them. The exception is initialize. VS Code sends a token there, and clojure-lsp reports its whole startup on it (#750). A user-defined clojure-lsp in LSP4IJ, without an adopter's hook, shows no startup progress.
Apart from initialize, this is the least urgent item of the list.
What users could gain:
- a progress bar with the server's messages during a long Find Usages, rename or
executeCommand; - Find Usages and Search Everywhere results that appear as they are found, on very large workspaces.
Today
- No request but
workspace/diagnosticcarries apartialResultToken.LSPProgressManagerignores partial results: "TODO: Partial Result Progress" (#L167-L171).WorkspaceDiagnosticManagerhandles its own. - No request carries a
workDoneTokenthat LSP4IJ created.LSPInlineCompletionSupportonly copies one from its params (#L101). - Server-initiated progress (
window/workDoneProgress/create,$/progress, andwindow/workDoneProgress/cancelwhen the user cancels) is supported inLSPProgressManager.
How it could be done
First step, small:
- Send a
workDoneTokenininitializeby default, as VS Code does. LSPProgressManager.notifyProgressalready shows abeginon a token that it doesn't know (LSPProgressManager.java#L186-L193). So the token alone may be enough. Check that cancelling it then sendswindow/workDoneProgress/cancel, which the spec allows for client-initiated tokens too.- An adopter's
initializeParamshook can still replace or remove it.
Work done for other requests:
- For a request whose server options say
workDoneProgress: true, LSP4IJ creates a token and sends it with the request.LSPProgressManagerhandles it as if the server had created it. - Candidates:
references,implementation,rename,executeCommand,workspace/symbol. - The progress then shows as a background task. When the request already runs under a modal or background
ProgressIndicator, as Find Usages does, it could drive that indicator's text instead.
Partial results:
- Only where IntelliJ consumes results incrementally:
- Find Usages through a
ProcessorinLSPWorkspaceImplementationsSearchand the references search; - Search Everywhere through
ChooseByNameContributorEx.processNames/processElementsWithName.
- Find Usages through a
- Register a progress handler for the token that feeds each chunk to the processor, and treat the final (empty) answer as the end.
- Every consumer must also handle a server that ignores the token and answers in full.
Metadata
Metadata
Assignees
Labels
$/progresshttps://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#progressenhancementNew feature or request
Activity
docs: semantic tokens are no longer experimental, with what is suppor…
docs: semantic tokens are no longer experimental, with what is suppor…