VS Code Extension
PYNE VS Code extension: HOOX branding, TextMate grammar, LanguageClient wiring, settings, and VSIX build.
This page
VS Code Extension
Abstract
PYNE (hoox-sh.pyne 0.4.4) is a LanguageClient host plus a rich TextMate grammar, branded as part of the HOOX open trading stack. It does not reimplement diagnostics or completion in TypeScript; it resolves pyne-lsp (then alias pynescript-lsp, then python -m pynescript.langserver) or a configured command over STDIO via vscode-languageclient, maps .pyne (first-class) plus *.pine / *.pinev5 / *.pinev6 / *.pinescript to language id pinescript, and exposes a small settings surface for enablement and feature toggles.
Conceptual model
Rendering…
Interface surface
Package identity
From vscode-extension/package.json:
| Field | Value |
|---|---|
| name | pyne |
| displayName | PYNE Language Support |
| version | 0.4.4 |
| publisher | hoox-sh |
| extension id | hoox-sh.pyne |
| icon | media/icon.png (HOOX mark) |
| engines.vscode | ^1.91.0 |
| main | ./out/extension.js (esbuild bundle) |
| dependency | vscode-languageclient ^10 |
| galleryBanner | #050505 dark |
Language contribution
- id:
pinescript - aliases:
PYNE,pyne,pinescript,Pine - extensions:
.pyne(first),.pine,.pinev5,.pinev6,.pinescript - configuration:
language-configuration.json - grammar:
syntaxes/pinescript.tmLanguage.json(scopeName: source.pinescript) — namespaces, annotations, hex colors, UDT/enum, multiline strings, plot/strategy builtins
Activation
onLanguage:pinescript
workspaceContains:**/*.pyne
workspaceContains:**/*.pine
workspaceContains:**/*.pinev5
workspaceContains:**/*.pinev6
Settings (pynescript.*)
| Key | Default | Meaning |
|---|---|---|
lsp.enabled | true | Skip activation when false |
lsp.command | auto | auto = PATH pyne-lsp → pynescript-lsp → python -m pynescript.langserver. Or an absolute path. "docker" plus lsp.args can launch ghcr.io/hoox-sh/pyne/lsp (${workspaceFolder} is expanded). |
lsp.python | python3 | Interpreter for module launch when neither binary is on PATH (pip install "hoox-pyne[lsp]") |
lsp.args | [] | Extra server args |
formatting.enabled | true | Passed as init option |
diagnostics.enabled | true | Passed as init option |
completion.snippets | true | Passed as init option |
Initialization options object:
{
"formattingEnabled": true,
"snippetsEnabled": true,
"diagnosticsEnabled": true
}
The Python server does not read these flags today. They are client-side documentation for hosts; capability advertisement is unconditional in config.py.
Commands
| Command palette | ID | Action |
|---|---|---|
| PYNE: Restart Language Server | pynescript.restartServer | Stop then start the language client |
| PYNE: Format Document | pynescript.formatDocument | editor.action.formatDocument (.pyne / .pine) |
| PYNE: Convert to Pine v6 | pynescript.convertToV6 | Rewrite v1-v5 source toward v6 (LSP command or local Python) |
| PYNE: Show Language Server Output | pynescript.showLspOutput | Open Output channel / status-bar target |
| PYNE: Show Resolved LSP Launch Command | pynescript.showLspCommand | Show and copy resolved pyne-lsp launch |
Client options
- Document selector:
pinescriptforfileanduntitledschemes - File watcher:
**/*.{pyne,pine,pinev5,pinev6,pinescript} - Diagnostic collection name:
pynescript - Default formatter id:
hoox-sh.pyne
Internals
| Path | Role |
|---|---|
vscode-extension/src/extension.ts | Activate / deactivate / client |
vscode-extension/package.json | Contributes + scripts |
vscode-extension/syntaxes/pinescript.tmLanguage.json | Grammar |
vscode-extension/language-configuration.json | Brackets / comments |
out/extension.js | Compiled JS |
Server launch (resolveLspLaunch in extension.ts):
- If
pynescript.lsp.commandis notauto, spawn that command withlsp.args. - Else try
pyne-lsp, thenpynescript-lsp, onPATH. - Else try
pynescript.lsp.python(thenpython3/python) with-m pynescript.langserver. - Else status-bar error: install
hoox-pyne[lsp].
No --parent-dir / PYTHONPATH rewrite. Transport is STDIO. Release packaging expects pyne-lsp on PATH (pip, Nuitka onefile, or docker run -i ghcr.io/hoox-sh/pyne/lsp:0.4.4).
Build
cd vscode-extension
npm ci
npm run compile # esbuild.mjs → out/extension.js
npm run package # pyne-vscode-0.4.4.vsix
# or monorepo:
make build-vscode
Requires Node 22. compile:tsc is typecheck-only (tsc --noEmit).
Site download: https://hoox.sh/pyne-vscode.vsix (unversioned alias). Versioned pyne-vscode-0.4.4.vsix is built in-tree (vscode-extension/) and on GitHub Releases.
Invariants and edge cases
lsp.enabled === falseshort-circuits activate — no client, no restart command registration beyond early return (commands not registered).- Binary vs module: production users should install
hoox-pyne[lsp]or the Nuitka onefile (pynescript-lsp-*on GitHub Releases) and setpynescript.lsp.commandif not on PATH. - Grammar works without LSP — open a
.pyneor.pinefile offline and still get TextMate highlighting. .pyneis first-class inpackage.jsonextensions + activation; legacy.pine*/.pinescriptremain fully supported.- File watcher covers every associated suffix (
pyne,pine,pinev5,pinev6,pinescript).
Worked example — extension development
pip install -e ".[lsp]"
cd vscode-extension && npm ci && npm run compile
# Launch Extension Development Host pointing at vscode-extension
Open a fixture .pine file; confirm Problems panel shows parse/lint diagnostics from the Python server.
Failure modes
| Symptom | Cause |
|---|---|
| “Language client failed to start” | pyne-lsp missing / wrong command |
| No squiggles, highlighting OK | LSP disabled or server crash; check Output → PYNE Language Server |
| Restart does nothing | Client never started (lsp.enabled false) |
See also
- Clients — non-VS Code hosts
- Architecture
- Nuitka build
- Editors guide