Skip to content

proposal: Re-architect RPC client generator around neutral model and emitter abstraction + Roslyn #31

Description

@alsi-lawr

Replace the current hand-rolled C#-specific generator model with a neutral API model and open-ended emitter abstraction.

Motivation

The generator should model Neovim RPC/API semantics, not C# method declarations. This enables cleaner C# emission, future F# emission, better type mapping, and better generated documentation.

Scope

  • Introduce a neutral generator model:
    • API functions
    • API parameters
    • API types
    • API events
    • documentation
    • version/deprecation metadata
    • request/response specs
    • encoder/decoder specs
  • Introduce emitter abstraction:
    • IApiEmitter
    • GeneratedFile
    • GeneratedFileSet
  • Move C#-specific concerns into a C# emitter that uses Roslyn to build the AST.
  • Avoid Roslyn leaking into the neutral model.
  • Preserve current generated output shape as much as practical for the first pass.
  • Move the generator to a separate library from the CLI tool. The internals stand on their own and shouldn't be tightly-coupled to it exposing a cli tool.

Out of scope

  • F# emitter.
  • Major client API redesign.
  • Plugin SDK redesign.
  • Namespace/package renames unless required internally.

Acceptance criteria

  • Generator core no longer depends on C#-specific declaration models as the shared abstraction.
  • Emitter abstraction exists.
  • Existing C# generation is implemented through the emitter abstraction.
  • Golden tests cover generated output.
  • Neutral model has unit coverage.
  • CSharpier formats generated C# output.

Blocked by

Architecture

flowchart TB
    subgraph Core["Nvim.Client.Generator"]
        direction TB

        Ingest["Neovim API ingestion"]
        Model["Neutral API model"]
        Emit["Emitter abstraction"]
        CSharp["C# emitter using Roslyn"]
        Future["Future emitters"]

        Ingest --> Model
        Model --> Emit
        Emit --> CSharp
        Emit -.-> Future
    end

    subgraph CLI["Nvim.Client.Generator.Cli"]
        direction TB

        Args["Parse command/options"]
        Wire["Wire inputs to generator core"]
        Write["Write generated files"]
        Diagnostics["Return diagnostics/exit code"]

        Args --> Wire
        Wire --> Core
        Core --> Write
        Write --> Diagnostics
    end
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions