Skip to content

feat(language-service): Pull-Based Diagnostics (LSP 3.17) #66699

@kbrilla

Description

@kbrilla

Feature Request: Pull-Based Diagnostics (LSP 3.17)

Description

The Angular Language Service should implement Pull-Based Diagnostics (LSP 3.17) to allow VS Code to request diagnostics on-demand rather than having the server push them on every change.

Current Behavior

Currently, the Angular Language Service uses push-based diagnostics via textDocument/publishDiagnostics. The server pushes diagnostics to the client on every file change, which can cause:

  1. Redundant computations: Diagnostics are recomputed even for unchanged files
  2. Server-driven timing: No control over when diagnostics are computed
  3. Unnecessary updates: Switching between tabs triggers diagnostic recomputation

Expected Behavior

Pull-Based Diagnostics (LSP 3.17) should:

  1. Cache results: Return Unchanged report in ~0.2ms when file hasn't changed
  2. Client-controlled timing: Let VS Code decide when to request diagnostics
  3. Workspace batching: Support workspace/diagnostic for all open files
  4. Refresh signal: Support workspace/diagnostic/refresh for server-initiated refresh

Protocol Flow

Client                          Server
  |                                |
  |-- textDocument/diagnostic ---->|
  |      (with previousResultId)   |
  |                                |
  |<-- Unchanged (resultId match)--|  <- Cache hit: ~0.2ms
  |         OR                     |
  |<-- Full (new diagnostics) ----|  <- Cache miss: compute

Motivation

This feature works together with #66668 (Client-Side File Watching) to provide comprehensive performance improvements:

Phase Optimization Benefit
Project Open #66668 File Watching Fast initialization
File Editing Pull Diagnostics Cached results, reduced CPU
Tab Switching Pull Diagnostics Instant cached responses

Implementation Notes

  • Requires LSP 3.17 support (vscode-languageserver v9.0.1+)
  • Should fall back to push-based diagnostics for older clients
  • Cache should be keyed by resultId and document version

Labels

  • area: language-service
  • feature
  • vscode-extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: vscode-extensionIssues related to the Angular Language Service VsCode extension

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions