Getting startedSlide 4 of 85
4lspGetting started
Hive in your editor
hive lsp is a language server: an editor starts it, and from then on the editor knows what the compiler knows. A mistake is underlined a moment after it is typed, a name says what it is and where it was declared, and after a . come a value's fields, a module's calls or a type's variants. It reads a file as the editor holds it, saved or not, so there is nothing to configure beyond telling the editor the command. It is in the compiler from v0.3.7 on.
- Neovim 0.11 or newer needs three lines in
init.lua, below, and no plugin.Kthen says what the name under the cursor is,CTRL-]goes to where it was declared,gOlists what the file declares, andCTRL-X CTRL-Ooffers what could come next. - VS Code starts a language server only through an extension, and Hive's is on the Marketplace as Hive Language: search for it in the Extensions view, or install it as the second example does. It colours a Hive file too.
- Any other editor that speaks the Language Server Protocol runs the same command,
hive lsp, for files ending in.hive.
LSP.md, in the compiler's repository, has every step, and what to look at when nothing happens. The tour needs none of it: every example still runs with hive run.
Neovim: init.lua
vim.filetype.add({ extension = { hive = "hive" } })
vim.lsp.config("hive", { cmd = { "hive", "lsp" }, filetypes = { "hive" } })
vim.lsp.enable("hive")VS Code: install the extension
$ code --install-extension R0DR160HM.hive-lang