Language Support (LSP)
Python diagnostics, completion, hover and go-to-definition through the built-in Pyrefly language server, custom language servers, and YANG/XML/JSON formatting.
Overview
NetStacks can connect the workspace editor to a language server (LSP) for richer editing. Language servers provide:
- Diagnostics (errors and warnings underlined in the code)
- Autocomplete
- Hover documentation
- Go to definition
One language server is built in: Pyrefly for Python. You can add any other language server that speaks LSP over standard input/output.
Where It Works
- Standalone desktop app: in the workspace editor and in the Python Engine script editor.
- Enterprise mode and the web terminal: not available. Language servers run in the local agent, which is not part of a Controller deployment. Editors show a banner saying the language server isn't available in Enterprise Mode yet, and basic syntax highlighting still works.
- Remote workspaces: language servers run on your own computer, not the remote server, so they don't work reliably with remote files.
Language servers are not attached to Docs editors or the SFTP file editor.
Python with Pyrefly
Pyrefly (version 1.0.0) handles .py and .pyi files. It is downloaded the first time you need it rather than shipped with the app.
- Open a Python file in a workspace. A banner asks Get rich Pyrefly language features?
- Click Install. NetStacks downloads Pyrefly from PyPI, checks it against a pinned SHA-256 checksum, extracts it and runs a quick test. Progress shows as Downloading, Verifying, Extracting and Verifying binary.
- When it finishes, diagnostics and completion start working in the open file.
Skip hides the banner for now; Don't ask again stops it appearing. You can still install Pyrefly later from Settings → Workspaces → Language Features. If the download fails, use Retry.
Pyrefly is available for macOS (Intel and Apple silicon), Linux (x86_64 and arm64) and Windows (x86_64 and arm64). It is installed in the NetStacks data folder under lsp/pyrefly/.
Settings → Language Features
Open Settings → Workspaces and expand Language Features. Servers are grouped under Built-in and Custom. Each row shows the name, language, file extensions and a status (for example installed, not-installed, installing or disabled).
| Button | What it does |
|---|---|
| Install | Download a built-in server (Pyrefly) |
| Uninstall / Remove | Remove a downloaded server, or delete a custom one |
| Edit | Change a server's settings |
| Disable / Enable | Turn a server off or on without removing it |
Add a Custom Language Server
Install the language server on your computer first (for example gopls for Go). Then:
- In Language Features, click + Add Language Server.
- Fill in the fields (see the table below).
- Click Test connection. The test must pass before you can save.
- Click Save.
| Field | Example | Notes |
|---|---|---|
| Plugin ID | gopls | Short unique ID |
| Display Name | Go (gopls) | Shown in the list |
| Monaco Language ID | go | Must match the language the editor uses for the file (see File Types and Highlighting) |
| File Extensions (comma-separated) | .go | Files this server handles |
| Command | gopls | Run exactly as entered; use a full path if needed |
| Args (space-separated) | serve | Arguments that start the server in stdio mode |
.cfg files are treated as ini.YANG, XML and JSON
These work without a language server, in every Monaco editor in the app (including enterprise mode):
- YANG (
.yang): syntax highlighting and a formatter that re-indents by brace depth while keeping strings and comments as they are. - XML: Monaco's highlighting plus a formatter (2-space indent).
- JSON: Monaco's built-in validation and formatting.
Run Format Document from the editor's right-click menu or the Monaco command palette (F1).
For Cisco and Junos configuration highlighting, see Network CLI Highlighting.
Troubleshooting
- No banner and no Python features: check that Pyrefly is installed and enabled in Language Features, and that you did not choose Don't ask again before installing.
- Install fails: the download needs access to
files.pythonhosted.org. Check your proxy or firewall, then click Retry. - Custom server test fails: run the same command and arguments in a terminal to confirm it starts, and use the full path to the binary if it is not on the app's
PATH.