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, 160+ 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

Use any generic LSP client extension (e.g., “Language Server Client”) with:

{
  "languageServerExample.serverCommand": "silt",
  "languageServerExample.serverArgs": ["lsp"]
}

A dedicated VS Code extension is planned.

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