Dino compiler: language, formatter, language server, docs, editor support

Compiler in Rust (lexer, parser, checker, C codegen), maps, chars,
dino fmt, dino lsp (diagnostics, formatting, outline, definition,
hover, completion, signature help), docs, examples, VS Code/Vim files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Your NameandClaude Sonnet 5.5 committed 2026-11-07 23:46:12 +01:00
1 parent 3e2779f447
commit eaf9567a36
117 files changed
+19970

No files matched your search

+111
View File
@@ -0,0 +1,111 @@
# Editor support for Dino
Everything here talks to the compiler itself, so what you see in the editor is exactly what
`dino run` would tell you.
| You get | How |
|---------|-----|
| Syntax colours | a grammar file (VS Code, Neovim, Vim) |
| Errors underlined as you type | the language server, `dino lsp` |
| Format the file (and on save) | the same server, using `dino fmt` |
| Outline, go to definition, hover, completion, parameter hints | the same server (reads the file's names; no type checking) |
First put the `dino` program on your `PATH`:
```text
cargo build --release
cp target/release/dino ~/.local/bin/ # or anywhere on your PATH
```
## VS Code
The extension is in `editors/vscode/`.
```text
cd editors/vscode
npm install # downloads the small language-client library
npx @vscode/vsce package # makes dino-0.1.0.vsix
code --install-extension dino-0.1.0.vsix
```
To try it without installing, open the `editors/vscode` folder in VS Code and press **F5**.
If `dino` is not on your `PATH`, set **Dino: Server Path** in the settings to the full path.
Format-on-save and 4-space indents are switched on for `.dino` files by default.
## Neovim
Put the `vim/` folder on your runtime path to get file detection and colours, for example
(with a plugin manager that takes a local path), or copy the two files:
```text
mkdir -p ~/.config/nvim/syntax ~/.config/nvim/ftdetect
cp vim/syntax/dino.vim ~/.config/nvim/syntax/
cp vim/ftdetect/dino.vim ~/.config/nvim/ftdetect/
```
Then in `init.lua` (Neovim 0.8 or newer):
```lua
vim.api.nvim_create_autocmd("FileType", {
pattern = "dino",
callback = function(args)
vim.lsp.start({
name = "dino",
cmd = { "dino", "lsp" },
root_dir = vim.fs.dirname(args.file),
})
vim.bo.shiftwidth = 4
vim.bo.expandtab = true
end,
})
-- format when saving
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.dino",
callback = function() vim.lsp.buf.format({ async = false }) end,
})
```
Plain Vim gets the colours from the same two files (no language server).
## Helix
Add this to `~/.config/helix/languages.toml`:
```toml
[language-server.dino]
command = "dino"
args = ["lsp"]
[[language]]
name = "dino"
scope = "source.dino"
file-types = ["dino"]
comment-token = "//"
indent = { tab-width = 4, unit = " " }
language-servers = ["dino"]
auto-format = true
```
## Any other editor
Anything that can run a language server works: start `dino lsp` (it speaks the standard
protocol over stdin/stdout) for files ending in `.dino`. It supports diagnostics and
whole-file formatting. The grammar for colours is the TextMate file
`vscode/syntaxes/dino.tmLanguage.json`, which Sublime Text, Zed and many others can read.
## What the server does (and doesn't) do yet
- Checks the file every time you type, including the files it imports (from disk, or from
unsaved changes in other open files). The compiler stops at the first error, so you see
one underline at a time.
- An error inside an imported file is shown at the top of the file that imports it.
- Formats the whole file; a file that doesn't parse is left alone.
- Not yet: hover, go to definition, completion, rename.
## Opcode
Opcode (the C++ editor in `~/Desktop/Porn/Linux/Clean/opcode`) knows Dino out of the box: colours,
`//` comments, snippets, the outline, format with `dino fmt -`, and the language server
(`dino lsp`) for errors, go to definition, hover, completion and parameter hints. It only needs
`dino` on your `PATH` (see the top of this page).