Editor Clients

Wire pyne-lsp into Neovim, Zed, Emacs, Helix, Sublime, and generic LSP hosts.

This page

Editor Clients

Abstract

Any editor that speaks LSP over STDIO can host PYNE intelligence. First-class snippets live in clients/ (Neovim Lua, Zed JSON, Emacs Lisp) plus documented Helix/Sublime fragments. The VS Code path is a dedicated extension (vscode-extension); this page covers the rest.

Prerequisite: pyne-lsp (or pynescript-lsp) on PATH (Python 3.10+):

pip install "hoox-pyne[lsp]"
# development
pip install -e ".[lsp]"

Conceptual model

Diagram

Rendering…

Interface surface — repo files

FileEditor
clients/neovim.luaNeovim (nvim-lspconfig or manual)
clients/zed.jsonZed settings.json fragment
clients/emacs.elEmacs lsp-mode + pinescript-mode
clients/README.mdHuman-oriented install notes
vscode-extension/VS Code / Cursor-compatible

Neovim

Return table from clients/neovim.lua:

return {
  cmd = { 'pyne-lsp' },
  filetypes = { 'pinescript' },
  root_dir = function(fname)
    return vim.fs.root(fname, { '.git', '*.pine', '*.pinev5', '*.pinev6', 'pyproject.toml' })
      or vim.fn.getcwd()
  end,
  settings = {
    pinescript = {
      formatting = { enabled = true },
      diagnostics = { enabled = true },
      completion = { snippets = true },
    },
  },
}

Suggested maps when attaching: gd definition, gr references, K hover, format via vim.lsp.buf.format.

Register filetype if needed:

au BufRead,BufNewFile *.pyne,*.pine,*.pinev5,*.pinev6,*.pinescript setfiletype pinescript

Zed

Merge clients/zed.json into ~/.config/zed/settings.json:

{
  "languages": {
    "Pine Script": {
      "language_servers": ["pynescript"]
    }
  },
  "language_servers": {
    "pynescript": {
      "command": "pyne-lsp",
      "arguments": ["--stdio"],
      "languages": ["Pine Script"]
    }
  }
}

Zed does not ship a first-party Pine grammar in this repo. Map *.pyne / *.pine to the "Pine Script" language name (or whatever your grammar extension registers) so the language_servers key attaches.

Emacs

clients/emacs.el registers an lsp-mode client:

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection '("pyne-lsp" "--stdio"))
  :major-modes '(pinescript-mode)
  :server-id 'pynescript))

Defines a minimal pinescript-mode with font-lock keywords and auto-mode-alist for \\.pine\\' / \\.pinev[0-9]+\\' (add \\.pyne\\' locally if you use the product suffix). Optional keys: C-c C-c format, M-. definition, M-? references.

Helix

~/.config/helix/languages.toml:

[[language]]
name = "pinescript"
scope = "source.pinescript"
file-types = ["pyne", "pine", "pinev5", "pinev6"]
roots = ["pyproject.toml"]
command = "pyne-lsp"
args = ["--stdio"]

Sublime Text

With Package Control LSP:

{
  "clients": {
    "pynescript": {
      "command": ["pyne-lsp", "--stdio"],
      "selector": "source.pinescript",
      "initializationOptions": {}
    }
  }
}

Generic / Cursor

pyne-lsp
# aliases:
pynescript-lsp --stdio
# container (stdio):
docker run --rm -i -v "$PWD:/work" -w /work ghcr.io/hoox-sh/pyne/lsp:0.6.4

Point the host’s “external language server” command at that binary. Cursor users can also load the VS Code extension (hoox-sh.pyne) in compatible mode when packaged as VSIX.

Internals

Server entry always uses STDIO (start_io in __main__.py). Capability negotiation is identical across hosts — differences are client UI only (how inlay hints render, whether pull diagnostics are used, etc.).

Tests: tests/test_lsp_features.py (handlers with fake params), tests/test_langserver.py (e2e with pytest-asyncio) — not editor-specific.

Invariants and edge cases

  1. Language id should be pinescript for VS Code parity; some editors invent their own names — map filetypes carefully.
  2. Root directory heuristics vary; wrong root rarely breaks single-file Pine editing (workspace is URI-keyed open buffers).
  3. Settings keys under pinescript in Neovim are conventional; the Python server does not currently enforce a rich workspace/configuration schema for all of them.
  4. Nuitka onefile can replace the module entry for air-gapped machines — same command name if installed on PATH.

Failure modes

SymptomCause
Server exits immediatelyMissing pygls / incomplete install .[lsp]
Filetype never attachesExtension not mapped to pinescript
Features missing in HelixOlder Helix without inlay / semantic support — grammar still useful

See also