Editors#

Your editor, fluent in .vis.

Vision ships a language server, vision lsp (the Language Server Protocol, the one behind Python and Rust support in every modern editor), and a syntax grammar. Together they give, in any editor that speaks LSP:

  • the errors of the compiler as you type, underlined where they are, with their code (E0423): the same errors as vision check, never different ones;

  • warnings of common modelling mistakes (a random draw repeated every step, a channel read but never written);

  • hover: the signature, meaning, precision and examples of every function; the meaning of every keyword; a param’s value, a canvas’s channels, a kernel shown as formulas;

  • completion that fits the place: after edge the edges, after on the canvases, after plate. the channels of plate, elsewhere the keywords, functions and declared names;

  • go to definition and the outline of a program.

The server only needs Vision installed. If vision is not on the PATH, use the full path of the one in your environment (for example /path/to/project/.venv/bin/vision).

VS Code#

Build the extension once and install it:

cd editors/vscode && npm install && npx @vscode/vsce package --allow-missing-repository
code --install-extension vision-vis-0.1.0.vsix

Set vision.command if vision is not on the PATH. The extension adds the commands Vision: Run this file, Explain this program, Explain an error code and Restart the language server. Tested: the grammar with VS Code’s own tokenizer.

Neovim (0.11 or newer)#

vim.filetype.add({ extension = { vis = "vis" } })
vim.lsp.config("vision", { cmd = { "vision", "lsp" }, filetypes = { "vis" }, root_markers = { ".git" } })
vim.lsp.enable("vision")

Tested: diagnostics, hover and the outline, with Neovim 0.11.4.

JetBrains IDEs (PyCharm, IntelliJ, CLion…)#

Install the LSP4IJ plugin. Then go to Settings → Languages & Frameworks → Language Servers → +, use the command vision lsp and the file name pattern *.vis. For colouring, import editors/vscode/syntaxes/vis.tmLanguage.json under Settings → Editor → TextMate Bundles.

Helix#

In languages.toml:

[language-server.vision]
command = "vision"
args = ["lsp"]

[[language]]
name = "vis"
scope = "source.vis"
file-types = ["vis"]
comment-token = "//"
language-servers = ["vision"]

Sublime Text#

With the LSP package, in LSP Settings:

{ "clients": { "vision": { "enabled": true, "command": ["vision", "lsp"], "selector": "source.vis" } } }

Copy vis.tmLanguage.json into your Packages/User folder for colouring.

Emacs#

With eglot (built into Emacs 29):

(define-derived-mode vis-mode prog-mode "Vision" (setq-local comment-start "// "))
(add-to-list 'auto-mode-alist '("\\.vis\\'" . vis-mode))
(with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(vis-mode . ("vision" "lsp"))))

JetBrains, Helix, Sublime Text and Emacs use the same server through their standard LSP support; they have not been tested yet.

In the terminal of any editor#

vision check file.vis prints errors as file.vis:2:21: error[E0423]: …, a format every editor turns into a link to the line, and vision explain-error E0423 explains any code.