gnn-lsp-server · git:20260921.0332b6b · 2026-09-21 · sha256 081eaef115e43243

gnn-lsp-server git:20260921.0332b6bA

Immutable. This exact content never changes and is served at /api/v1/blob/081eaef115e43243.

---
name: gnn-lsp-server
description: GNN Language Server Protocol integration. Use when starting editor diagnostics, checking hover behavior, or validating LSP support for GNN files.
---

# Core Skill: `lsp_server`

**Function**: Language Server Protocol implementation providing real-time GNN file diagnostics and hover information for LSP-compatible editors.

## Example Flow

```bash
# Start the GNN Language Server via CLI
gnn lsp

# Or directly via Python (equivalent to `gnn lsp`)
python -c "from gnn.lsp import start_server; start_server()"
```

## Programmatic Usage

```python
from gnn.lsp import create_server, start_server

# Create and configure the LSP server
server = create_server()

# Start on stdio (standard usage for editor integration)
start_server()
```

## Features

- **Diagnostic Publishing**: Validates GNN sections, state-space variables, and connections on file open and save
- **Hover Information**: Displays variable name, dimensions, type, and default values at cursor position
- **Error Extraction**: Maps parse errors to line numbers for inline display in editors
- **Graceful Fallback**: Works without `pygls` by providing a clear installation message
- **VS Code Integration**: Compatible with any LSP client via stdio transport


## MCP Tools

This module registers tools with the GNN MCP server (see `mcp.py`):

- None