Skip to content

LSP: improve internal architecture and abstraction #20

@jscaltreto

Description

@jscaltreto

Summary

The LSP module's internal structure could be improved with better abstraction boundaries.

Findings

Critical

  • C6: Compute functions not abstracted (internal/lsp/*.go)
    Handler directly calls compute functions with no abstraction layer. No separation of request handling from computation logic.
    Fix: Create LSPAnalyzer interface encapsulating compute functions.

High

  • H16: Monolithic handler dispatch (internal/lsp/handler.go:26-61)
    Large switch statement mixing request marshaling, error handling, and computation.
    Fix: Map-based dispatch or handler registry pattern.

Medium

  • M11: Document manager exposes raw state (internal/lsp/document.go:30-60)
    Raw documentState struct fields accessed directly by handlers with no abstraction.
    Fix: Create Document interface with AST(), Errors(), Content() methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions