Skip to content

Conversation

@ewels
Copy link
Member

@ewels ewels commented Jan 22, 2026

Summary

Implements LSP $/progress notifications during workspace file indexing to provide visual feedback in editors/clients (fixes #148).

Written by Claude 🤖

Changes

  • Add BiConsumer<Integer, Integer> progress callback parameter to ASTNodeCache.update()
  • Report per-file progress using AtomicInteger for thread-safe counting in parallel stream
  • Create ProgressNotification in LanguageService.update0() when indexing > 1 file
  • Works for both initial workspace scan and batch file updates
  • Uses workspace-specific token (indexing-{rootUri.hashCode()}) to support multiple workspaces
Details

Progress Flow Example

For a workspace with 60 files:

→ window/workDoneProgress/create { token: "indexing-12345678" }
← $/progress { token: "...", value: { kind: "begin", message: "Indexing 60 files...", percentage: 0 } }
← $/progress { token: "...", value: { kind: "report", message: "Indexing: 1 / 60 files", percentage: 1 } }
← $/progress { token: "...", value: { kind: "report", message: "Indexing: 2 / 60 files", percentage: 3 } }
...
← $/progress { token: "...", value: { kind: "report", message: "Indexing: 60 / 60 files", percentage: 100 } }
← $/progress { token: "...", value: { kind: "end" } }

Testing

  • Progress notifications only appear when indexing more than 1 file
  • Progress is reported per-file for accurate progress bars in clients
  • finally block ensures progress.end() is always called even if exceptions occur

ewels added 2 commits January 22, 2026 17:51
Implement LSP $/progress notifications during workspace file indexing
to provide visual feedback in editors/clients.

- Add progress callback parameter to ASTNodeCache.update()
- Report per-file progress using AtomicInteger for thread-safe counting
- Create ProgressNotification in LanguageService.update0() for multi-file updates
- Show progress when indexing > 1 file (initial scan or batch updates)
- Use workspace-specific token to support multiple workspaces

Closes #148
The new progress notification feature requires the LanguageClient to
support createProgress() and notifyProgress() methods. Added no-op
implementations to TestLanguageClient to prevent UnsupportedOperationException
during tests.
@ewels
Copy link
Member Author

ewels commented Jan 23, 2026

This PR allows me to build a progress bar whilst indexing a project, like this one:

CleanShot 2026-01-23 at 14 37 00

Bigger pipelines have 60+ symbols and take quite a while, so it's nice to know that something is happening.

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.

Feature Request: Workspace Indexing Progress Notifications

2 participants