Editor Setup

Silt ships with an LSP server and Vim/Neovim syntax highlighting.

LSP Server

Start the language server with:

silt lsp

The server communicates over stdin/stdout using the standard LSP protocol.

Supported Features

FeatureDescription
DiagnosticsLex, parse, and type errors on every edit
HoverShow inferred type for any expression (K in nvim)
Go to definitionJump to function, type, trait, let-binding definitions (gd)
CompletionKeywords, builtins, stdlib functions, user definitions
Signature helpParameter names and types while typing a call
Document symbolsOutline of all declarations in the file
FormattingFormat via the existing silt fmt formatter

Neovim

Minimal setup (built-in LSP)

Add to your init.lua:

-- Register .silt filetype
vim.filetype.add({ extension = { silt = 'silt' } })

-- Load syntax highlighting from silt's editors directory
vim.opt.runtimepath:append('/path/to/silt/editors/vim')

-- Start LSP on silt files
vim.api.nvim_create_autocmd('FileType', {
  pattern = 'silt',
  callback = function()
    vim.lsp.start({
      name = 'silt',
      cmd = { 'silt', 'lsp' },
      root_dir = vim.fs.dirname(vim.fs.find({ '.git' }, { upward = true })[1]),
    })
  end,
})
vim.api.nvim_create_autocmd('LspAttach', {
  callback = function(ev)
    local opts = { buffer = ev.buf }
    vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
    vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
    vim.keymap.set('n', '<leader>fm', vim.lsp.buf.format, opts)
    vim.keymap.set('n', '<leader>fs', '<cmd>Telescope lsp_document_symbols<cr>', opts)
    vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
    vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
    vim.keymap.set('i', '<C-s>', vim.lsp.buf.signature_help, opts)
  end,
})

Format on save

vim.api.nvim_create_autocmd('BufWritePre', {
  pattern = '*.silt',
  callback = function()
    vim.lsp.buf.format({ async = false })
  end,
})

Completion (nvim-cmp)

Install nvim-cmp with the cmp-nvim-lsp source for automatic completion from the LSP.

VS Code

A dedicated VS Code extension lives in editors/vscode/. It bundles a TextMate grammar for syntax highlighting and bootstraps silt lsp as a language server for diagnostics, hover, go-to-definition, completion, signature help, document symbols, and formatting.

Build and install it locally:

cd editors/vscode
npm install
npm run compile

Then either package it as a VSIX:

npx vsce package
code --install-extension silt-vscode-0.1.0.vsix

…or symlink it into your extensions directory:

ln -s "$(pwd)" ~/.vscode/extensions/silt-lang.silt-vscode-0.1.0

Reload VS Code and open any .silt file — the extension activates on onLanguage:silt and spawns the language server over stdio.

Settings:

If you’d rather use a generic LSP client extension without the bundled grammar, configure it to run silt lsp for the silt language id.

Syntax Highlighting

Vim/Neovim syntax files are shipped in editors/vim/:

Add to your runtimepath:

vim.opt.runtimepath:append('/path/to/silt/editors/vim')

What’s highlighted