-> window/workDoneProgress/create { token: "indexing" }
<- $/progress { token: "indexing", value: { kind: "begin", title: "Indexing workspace", percentage: 0 } }
<- $/progress { token: "indexing", value: { kind: "report", percentage: 25, message: "15/60 files" } }
<- $/progress { token: "indexing", value: { kind: "report", percentage: 50, message: "30/60 files" } }
<- $/progress { token: "indexing", value: { kind: "report", percentage: 100, message: "60/60 files" } }
<- $/progress { token: "indexing", value: { kind: "end", message: "Indexed 60 files" } }
private void update0() {
// ...
var uris = fileCache.removeChangedFiles();
if( !scanned ) {
if( uris.isEmpty() ) {
uris = getWorkspaceFiles(); // <-- We know the total count here
// Could send begin progress here
}
}
// ...
var changedUris = astCache.update(uris, fileCache);
// Could send progress updates during astCache.update()
}
Summary
Add support for
$/progressnotifications during workspace indexing to allow LSP clients to display progress information to users.Motivation
When opening a large Nextflow project, the language server takes significant time to index all
.nffiles before it can respond to requests likeworkspace/symbolortextDocument/documentSymbol. During this time, clients have no way to know:This results in a poor user experience where the editor/client appears to be "stuck" or unresponsive.
Proposed Solution
Implement the LSP Progress support for workspace indexing:
window/workDoneProgress/create$/progressnotifications during theupdate()method inLanguageService.javawith:kind: "begin"when starting to indexkind: "report"withpercentage(0-100) and/ormessage(e.g., "Indexing file 15/60") as files are processedkind: "end"when indexing completesDetails
Example Progress Flow
Implementation Notes
In
LanguageService.java, theupdate0()method already knows the set of URIs being processed:The
ASTNodeCache.update()method could accept a progress callback or the total/current counts could be tracked and reported.Benefits
References