VS Code Extension
PYNE VS Code extension: LanguageClient host for pyne-lsp, TextMate grammar, snippets, settings, and VSIX 0.5.5.
This page
Abstract
PYNE (hoox-sh.pyne 0.5.5) is a LanguageClient host plus a rich TextMate grammar, branded as part of the HOOX open trading stack. It does not reimplement language intelligence in TypeScript — vscode-languageclient speaks STDIO to pyne-lsp (then alias pynescript-lsp, then python -m pynescript.langserver) and forwards whatever that process advertises in initialize. The VSIX stays 0.5.5; the hosted Python server is hoox-pyne 0.6.31 (src/pynescript/__about__.py). The extension maps .pyne (first-class) plus *.pine / *.pinev5 / *.pinev6 / *.pinescript to language id pinescript, ships snippets, and exposes a broad pynescript.* settings surface with per-feature toggles.
Conceptual model
Rendering…
Interface surface
Package identity
From the extension's package.json (hoox-sh/pyne-lsp-vsce):
| Field | Value |
|---|---|
| name | pyne |
| displayName | PYNE Language Support |
| version | 0.5.5 |
| 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 ^11 |
| 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, bitwise operators (&,|,^,~,<<,>>), annotations, hex colors,#line comments that do not steal#hexliterals, UDT/enum, multiline strings, plot/strategy builtins - snippets:
snippets/pine.code-snippets—indicator,strategy,library,type,enum,input.*(incl. color/timeframe/session),plot,plotshape,ta.*(incl. macd/bb),strategy.entry/exit/close,if/for/for in/switch,request.security,label.new,array.new<>, multiline string
Hosted pyne-lsp methods (not reimplemented in TypeScript)
The LanguageClient negotiates capabilities from src/pynescript/langserver/config.py (get_server_capabilities). The hosted server now advertises the following; the 0.5.5 extension is still only a host, but adds client-side feature gates so each capability can be toggled without restarting the server.
| LSP method | What the editor gets | Feature page |
|---|---|---|
textDocument/semanticTokens/full + /range | Same legend, range clipped to the viewport | Semantic tokens |
textDocument/onTypeFormatting | Format the just-completed line; trigger "\n" | Formatting |
textDocument/linkedEditingRange | Same-document live ranges for a user ident (keywords / builtin namespaces refused) | Linked editing |
textDocument/inlayHint | Display-only parameter-name hints on builtin calls (ta.sma(close, 14) → source: / length:). Hints never insert text | Inlay hints |
textDocument/documentLink + documentLink/resolve | http:// / https:// URLs in comments (//, /* */, hash # …) and string literals. Resolve fills tooltip with the URL when tooltip is unset | Document links |
textDocument/documentColor + colorPresentation | #hex (and named color.* / literal color.rgb / color.new / color() / color.from_gradient) swatches; presentation rewrites as #rrggbb / #rrggbbaa | Document color |
Also advertised (unchanged host path): diagnostics, completion + resolve, hover, signature help, definition / references, highlight + rename, document / workspace symbols, full + range formatting, folding, selection range, Convert-to-v6 / W001 / W002 / C002 code actions. Capability table: Architecture.
[pinescript] configuration defaults already set editor.semanticHighlighting.enabled to true and editor.defaultFormatter to hoox-sh.pyne. Format-on-type and linked-editing UX are standard VS Code editor settings (editor.formatOnType, editor.linkedEditing) — they are not pynescript.* keys. Enable them if you want Enter to hit onTypeFormatting or rename-as-you-type to hit linkedEditingRange.
Activation
onLanguage:pinescript
onCommand:pynescript.restartServer
onCommand:pynescript.formatDocument
onCommand:pynescript.showLspOutput
onCommand:pynescript.showLspCommand
onCommand:pynescript.convertToV6
onCommand:pynescript.diagnosticsToggle
onCommand:pynescript.completionToggle
onCommand:pynescript.inlayHintsToggle
onCommand:pynescript.foldingToggle
onCommand:pynescript.colorPreviewToggle
onCommand:pynescript.toggleHover
onCommand:pynescript.toggleSignatureHelp
onCommand:pynescript.toggleSemanticTokens
onCommand:pynescript.toggleDocumentHighlight
onCommand:pynescript.toggleLinkedEditing
onCommand:pynescript.toggleSelectionRange
onCommand:pynescript.toggleDocumentLink
onCommand:pynescript.toggleCodeAction
onCommand:pynescript.toggleFormatOnSave
onCommand:pynescript.openDocumentLink
onCommand:pynescript.runOnPro
onCommand:pynescript.installLanguageServer
onCommand:pynescript.installBackend
onCommand:pynescript.startBackend
onCommand:pynescript.testBackend
onCommand:pynescript.selectSyntax
workspaceContains:**/*.pyne
workspaceContains:**/*.pine
workspaceContains:**/*.pinev5
workspaceContains:**/*.pinev6
Settings (pynescript.*)
Appearance
| Key | Default | Meaning |
|---|---|---|
pynescript.syntaxHighlighting | void | Pine token palette (TextMate + semantic tokens), independent of the workbench theme. none inherits the active theme. |
Language server
| Key | Default | Meaning |
|---|---|---|
pynescript.lsp.enabled | true | Start the language client |
pynescript.lsp.command | auto | auto (PATH → module), an absolute binary path, or docker |
pynescript.lsp.python | python3 | Interpreter for -m pynescript.langserver |
pynescript.lsp.args | [] | Extra server arguments (docker run arguments when command is docker) |
Editor features
| Key | Default | Meaning |
|---|---|---|
pynescript.formatting.enabled | true | Formatting — full document, selection, on-type |
pynescript.formatOnSave.enabled | false | Format on save (requires formatting.enabled) |
pynescript.diagnostics.enabled | true | Errors, warnings, and hints |
pynescript.diagnostics.severity | {} | Remap severity by lint-code prefix, e.g. {"W": "Hint"} |
pynescript.diagnostics.style | false | Show C001/C002/C004 style findings |
pynescript.diagnostics.semantic | false | Opt-in UDT/enum member and user-function arity checks |
pynescript.completion.snippets | true | Snippets for builtins and declarations |
pynescript.hover.enabled | true | Hover cards (signature, docs, types) |
pynescript.inlayHints.parameters | true | Parameter-name hints in calls |
pynescript.signatureHelp.enabled | true | Parameter hints while typing a call |
pynescript.semanticTokens.enabled | true | Semantic token colorization |
pynescript.documentHighlight.enabled | true | Highlight other occurrences of an identifier |
pynescript.linkedEditing.enabled | true | Rename-as-you-type (needs editor.linkedEditing) |
pynescript.selectionRange.enabled | true | Smart expand/shrink selection |
pynescript.documentLink.enabled | true | Clickable http(s) URLs in comments and strings |
pynescript.codeAction.enabled | true | Code actions (Convert to v6, W001 quick fix) |
Feature settings are sent to the server through workspace/didChangeConfiguration and take effect without restarting the client. Only pynescript.lsp.* changes restart the language server.
Installation
| Key | Default | Meaning |
|---|---|---|
pynescript.install.autoInstall | false | Install the server with pip when missing, without prompting |
pynescript.install.autoPrompt | true | Ask once before installing a missing server |
pynescript.install.package | hoox-pyne[lsp] | pip requirement installed by PYNE: Install Language Server |
pynescript.install.python | "" | Python for pip (empty = lsp.python → python3 → python → py) |
pynescript.install.args | [] | Extra pip arguments (e.g. ["--no-cache-dir"]) |
pynescript.install.createVenv | true | Isolated venv when the system Python is PEP 668 managed |
pynescript.install.venv | "" | Explicit venv directory (empty = extension storage) |
Pro & backend
| Key | Default | Meaning |
|---|---|---|
pynescript.pro.enabled | false | Enable PYNE Pro (Run on Pro) |
pynescript.pro.apiKey | "" | Pro API key, minted with POST /auth/create_key; stored in settings in plain text |
pynescript.backend.url | http://127.0.0.1:5002 | Self-hosted backend base URL (no /run) |
pynescript.backend.useHosted | false | Use pynescript.online instead of backend.url |
pynescript.backend.hostedUrl | https://pynescript.online | Hosted backend base URL |
pynescript.backend.package | hoox-pyne[pro,lsp] | pip requirement installed by PYNE: Install Backend (Pro API) |
pynescript.backend.path | "" | PYNE checkout for PYNE: Start Backend (empty = first workspace folder) |
Themes (AXIS Void / Hoox Signal / PYNE Volt)
The extension contributes three color themes. Pick one from the normal VS Code
Preferences: Color Theme picker — the extension never changes
workbench.colorTheme automatically, not on activation and not on install.
| Theme | Accent | Surfaces |
|---|---|---|
| AXIS Void | periwinkle #939FFF | Near-black with a whisper of indigo; dark-grey panels |
| Hoox Signal | signal orange #FE6A00 | Near-black, neutral surfaces |
| PYNE Volt | lime #B7EF09 | Near-black with a whisper of lime |
Hover, suggest, peek, inlay, and the other floating widgets share AXIS popover chrome (1px hairline, elevated plate, accent selection). Hover and completion Markdown use the same kind-kicker card.
Comments are always neutral gray in every theme. Keywords and functions take the accent, strings a light accent tint, numbers the foreground, and punctuation / series builtins gray — so a file stays calm even with a vivid accent.
Pine syntax highlighting is independent of the workbench theme:
| Option | Setting | Values | none means |
|---|---|---|---|
| Syntax highlighting | pynescript.syntaxHighlighting | none · void · signal · volt | Use the active theme's Pine colors |
It writes language-scoped [pinescript] token colors, so it composes with any workbench theme — including your own. Switch it with PYNE: Select Syntax Highlighting or set the key directly. Default: void.
Invariants and edge cases
lsp.enabled === falseskips starting the client — output channel, status bar, and palette commands still register so the palette never shows “command not found”; restart then no-ops until the setting is true.- 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). - VSIX 0.5.5 does not pin server methods. Range tokens, on-type format, linked editing, inlay parameter names, document links + resolve tooltip, and document color appear only when the spawned
pyne-lspis new enough to advertise them (this tree: 0.6.31). Feature gates are client-side and read live settings.
Worked example — extension development
pip install -e ".[lsp]"
git clone https://github.com/hoox-sh/pyne-lsp-vsce.git
cd pyne-lsp-vsce && npm ci && npm run compile
# Launch Extension Development Host pointing at the pyne-lsp-vsce checkout
Open a fixture .pine file; confirm Problems panel shows parse/lint diagnostics from the Python server. With a current pyne-lsp, also expect #hex color swatches, clickable https:// links in comments, source: / length: inlay labels on ta.sma(close, 14), and range semantic tokens while scrolling.
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) |
| No inlay param names / color swatches / document links | Spawned pyne-lsp is older than this tree (need 0.6.31) |
| Enter does not reformat the previous line | editor.formatOnType is off (not a pynescript.* key) |
| Identifiers do not multi-cursor as you type | editor.linkedEditing is off (not a pynescript.* key) |
| A feature does nothing after toggling | Its pynescript.<feature>.enabled key is false |
| Run on Pro says “disabled” | Set pynescript.pro.enabled (and pro.apiKey for hosted) |
| Run on Pro request fails | Check pynescript.backend.url / backend.useHosted (base URL, no /run) and that the backend is reachable |
See also
- Architecture — declared
ServerCapabilities - Semantic tokens — full and range
- Formatting — full, range, and on-type (
\n) - Linked editing
- Inlay hints — parameter names only (display-only; inferred types removed)
- Document links —
http(s)URLs; resolve fills tooltip - Document color
- Clients — non-VS Code hosts
- Nuitka build
- Editors guide