Getting startedSlide 4 of 86
4lspGetting started
Hive in your editor
hive lsp is a language server: an editor starts it and from then on knows what the compiler knows. A mistake is underlined a moment after it is typed, a name shows what it is and where it was declared, and after a . the editor offers a value's fields, a module's calls or a type's variants. It reads each file as the editor holds it, saved or not, so the only setup is telling the editor the command. It is in the compiler from v0.3.7 on.
- Neovim 0.11 or newer needs the three lines of
init.luabelow 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. 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 also colours Hive files.
- 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 check when nothing happens. The tour needs none of this: every example 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