[Language Server]

PYNE Language Server Protocol surface — diagnostics, completion, hover, navigation, formatting, and editor clients.

Language Server

The PYNE Language Server is the editor-facing half of the evaluation stack: a pygls process that speaks LSP over STDIO (or TCP in tooling), parses Pine with the same ANTLR4 → ASDL pipeline as the runtime, and never requires a proprietary chart host.

Abstract

Editors want static intelligence at typing cadence. Evaluation over OHLCV is dynamic and bar-loop expensive. PYNE therefore splits the stack:

ProcessCadenceShared substrate
LSP (pynescript-lsp)keystroke / open / saveparse, lint, unparse, builtin metadata
Pro API (backend.app)request / batchparse, evaluate, plots / events
CLI / librarybatch / embedsame AST + evaluator

The LSP publishes diagnostics from the linter and parse errors, completes and hovers from Fernet-ready builtin metadata, navigates user symbols via AST visitors, and formats by round-tripping through the unparser. Feature modules live under src/pynescript/langserver/features/; the VS Code extension and clients/ configs are thin protocol hosts.

Conceptual model

Invariant: open/change/close always re-parse and re-lint the in-memory buffer. Features that need an AST re-parse on demand if the workspace cache is missing source.

Interface surface

CapabilityLSP method(s)Module
Sync`textDocument/didOpendidChange
Diagnostics (push + pull)publishDiagnostics, textDocument/diagnosticworkspace.py, features/diagnostics.py
Completion (+ resolve)textDocument/completion, completionItem/resolvefeatures/completion.py
HovertextDocument/hoverfeatures/hover.py
Definition / referencestextDocument/definition, textDocument/referencesdefinitions.py, references.py
SymbolstextDocument/documentSymbol, workspace/symbolsymbols.py, server.py
FormattingtextDocument/formatting, rangeFormattingfeatures/formatting.py
Inlay hintstextDocument/inlayHintfeatures/inlay_hints.py
Semantic tokenstextDocument/semanticTokens/fullfeatures/semantic_tokens.py (stub data)

Declared capabilities: src/pynescript/langserver/config.py (get_server_capabilities).

Internals

PathRole
src/pynescript/langserver/server.pyPynescriptLanguageServer, method registration
src/pynescript/langserver/workspace.pyDocument map, incremental edits, parse+lint
src/pynescript/langserver/config.pyServerCapabilities
src/pynescript/langserver/features/*Per-method handlers
src/pynescript/langserver/providers/*Metadata + completion builders
src/pynescript/langserver/__main__.pySTDIO entry (pynescript-lsp)
vscode-extension/Language client + TextMate grammar
clients/Neovim, Zed, Emacs, Helix snippets

Console scripts are separate: pynescript (Click CLI) vs pynescript-lsp (pygls). Do not conflate them — see architecture.

Tracks in this tab

  1. Architecture — server lifecycle, workspace, capabilities
  2. Diagnostics through Inlay hints — feature manuals
  3. Builtin metadata — generation + Fernet .enc / CRYPTO_KEY
  4. VS Code extension — client packaging
  5. Clients — Neovim, Zed, Emacs, Helix, Sublime

See also