Skip to content

feat(doctor): surface LSP diagnostics (lint/errors) per file/symbol #253

Description

@Wolfvin

Mengapa

Gap-analysis vs Serena MCP (LSP-backed IDE-for-agents). Serena punya "Contextual Diagnostics" — retrieve errors/warnings (linting) untuk file/symbol spesifik, bantu agent identifikasi & fix bug. CodeLens TIDAK punya ini — verified: scripts/lsp_client.py hanya request textDocument/definition, textDocument/references, textDocument/hover (grep di sesi ini). TIDAK ada textDocument/publishDiagnostics handler. Agent yang mau tahu "file ini ada error lint apa?" harus jalankan linter eksternal manual — persis grep-manual yang goal CodeLens hindari.

Konteks

CodeLens SUDAH punya infra LSP: lsp_client.py (JSON-RPC ke language server), hybrid_engine.py (--deep flag), commands/lsp.py, doctor --check lsp-status (cek server tersedia). LSP diagnostics datang sebagai server-push notification (textDocument/publishDiagnostics) setelah didOpen — infra didOpen sudah ada (lsp_client.py:304). Tinggal capture notification-nya.

Tujuan

Command/sub-check yang mengembalikan diagnostics (error/warning/hint dari language server) untuk file atau symbol tertentu, dalam shape finding standar. Kandidat lokasi: doctor --check diagnostics atau sub-check baru. Degrade gracefully kalau LSP tidak terinstall (return kosong + note, jangan crash — konsisten dgn pola --deep).

Constraint

  • Reuse lsp_client.py/hybrid_engine.py — JANGAN bikin LSP client kedua.
  • LSP OPTIONAL — kalau server tidak ada, return {status:ok, diagnostics:[], lsp_available:false}, bukan error. Sama seperti --deep sekarang.
  • publishDiagnostics adalah async server-push — perlu handle timing (buka file, tunggu diagnostics dengan timeout wajar, tutup). Jangan hang kalau server tidak pernah push.
  • Design doc WAJIB (feature-class kalau tambah engine/command baru).

Definition of Done

  • Bisa dapat diagnostics untuk file yang punya error nyata (test dengan file TS/Python yang sengaja ada type error)
  • LSP tidak terinstall → return kosong + lsp_available:false, tidak crash/hang
  • Timeout guard kalau server tidak push diagnostics dalam N detik
  • Regression test + design doc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions