-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Summary
Add support for $/progress notifications 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 .nf files before it can respond to requests like workspace/symbol or textDocument/documentSymbol. During this time, clients have no way to know:
- That indexing is in progress
- How far along the indexing is
- When indexing will complete
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:
- Create a progress token during initialization using
window/workDoneProgress/create - Send
$/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 completes
Details
Example Progress Flow
-> 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" } }
Implementation Notes
In LanguageService.java, the update0() method already knows the set of URIs being processed:
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()
}The ASTNodeCache.update() method could accept a progress callback or the total/current counts could be tracked and reported.
Benefits
- Better user experience in VS Code and other editors
- Enables CLI tools to show accurate progress bars
- Aligns with LSP best practices for long-running operations
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels