*nvim-lsp-installer* Semi-opinionated companion plugin for nvim-lspconfig. Minimum version of neovim: 0.5.0 Author: William Boman ============================================================================== INTRODUCTION *nvim-lsp-installer-introduction* Semi-opinionated companion plugin for nvim-lspconfig. It comes with all batteries included, or at least to the extent possible. Requires neovim `>= 0.5.0` and [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig). The full requirements to install all servers are: - For Unix systems: bash(1), git(1), wget(1), unzip(1), tar(1), gzip(1) - For Windows systems: powershell, git, gzip, tar - Node.js (LTS) & npm - Python3 & pip3 - go - javac - Ruby & gem To write a custom server installer, please refer to the docs at https://github.com/williamboman/nvim-lsp-installer/blob/main/CUSTOM_SERVERS.md. ============================================================================== QUICK START *nvim-lsp-installer-quickstart* To view the UI for nvim-lsp-installer, run: > :LspInstallInfo < Install a language server via `:LspInstall`, for example: > :LspInstall tsserver < You may also install multiple languages at a time: > :LspInstall tsserver graphql eslintls < To install a specific version of a language server, you may provide it as part of the server name, like so: > :LspInstall tsserver@0.6.3 graphql@latest eslintls@03bfc83 < Please refer to each server's own release page to find which versions are available. Then, somewhere in your initialization script (see `:h init.lua`): > local lsp_installer = require("nvim-lsp-installer") function common_on_attach(client, bufnr) -- ... set up buffer keymaps, etc. end lsp_installer.on_server_ready(function(server) local opts = { on_attach = common_on_attach, } -- (optional) Customize the options passed to the server -- if server.name == "tsserver" then -- opts.root_dir = function() ... end -- end server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] end) < ============================================================================== COMMANDS *nvim-lsp-installer-commands* *:LspInstallInfo* :LspInstallInfo Opens the UI for nvim-lsp-installer. *:LspInstall* :LspInstall {server_name} ... Installs language servers. *:LspUninstall* :LspUninstall {server_name} ... Uninstalls language servers. *:LspUninstallAll* :LspUninstallAll Uninstalls all installed language servers. *:LspInstallLog* :LspInstallLog Opens the log file in a new tab window. *:LspPrintInstalled* :LspPrintInstalled Prints all installed language servers. ============================================================================== SETTINGS *nvim-lsp-installer-settings* You can configure certain behavior of nvim-lsp-installer by calling the `.settings()` function. Refer to the |nvim-lsp-installer-default-settings| for all available settings. Example: > require("nvim-lsp-installer").settings { ui = { icons = { server_installed = "✓", server_pending = "➜", server_uninstalled = "✗" } } } < *nvim-lsp-installer-default-settings* The following settings are applied by default. > local DEFAULT_SETTINGS = { ui = { icons = { -- The list icon to use for installed servers. server_installed = "◍", -- The list icon to use for servers that are pending installation. server_pending = "◍", -- The list icon to use for servers that are not installed. server_uninstalled = "◍", }, }, -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when -- debugging issues with server installations. log_level = vim.log.levels.INFO, -- Whether to allow LSP servers to share the same installation directory. For some servers, this effectively causes -- more than one server to be installed (and uninstalled) when executing `:LspInstall` and `:LspUninstall`. For -- example, installing `cssls` will also install both `jsonls` and `html` (and the other ways around), as these all -- share the same underlying package. allow_federated_servers = true, } < ============================================================================== Lua module: nvim-lsp-installer *nvim-lsp-installer.install()* install({server_name}) Installs the provided {server_name}. If {server_name} is already installed, it is reinstalled. Note that you may also provide the desired version of the server here, through the @version notation, for example `"rust_analyzer@nightly"`. Parameters: ~ {server_name} (string) The server to install. *nvim-lsp-installer.uninstall()* uninstall({server_name}) Uninstalls the provided {server_name}. Parameters: ~ {server_name} (string) The server to uninstall. *nvim-lsp-installer.on_server_ready()* on_server_ready({cb}) Registers a callback to be executed each time a server is ready to be initiated. When called, all currently installed servers will be considered ready to be initiated and will each individually be invoked on {cb}. Parameters: ~ {cb} (function) Function to be invoked when a server is ready to be initiated. Return: ~ Returns a function which when called will de-register the cb} from any future dispatches. ============================================================================== Lua module: nvim-lsp-installer.servers *nvim-lsp-installer.servers* *nvim-lsp-installer.get_available_servers()* get_available_servers() Return: ~ |lsp_installer.Server|[] A list containing all available language servers. *nvim-lsp-installer.get_installed_servers()* get_installed_servers() Return: ~ |lsp_installer.Server|[] A list of servers that are currently installed. *nvim-lsp-installer.get_uninstalled_servers()* get_uninstalled_servers() Return: ~ |lsp_installer.Server|[] A list of servers that are not installed. *nvim-lsp-installer.register()* register({server}) Registers a {server} instance with nvim-lsp-installer. {server} must be an instance of |lsp_installer.Server|. Parameters: ~ {server} (|lsp_installer.Server|) The server to register. *nvim-lsp-installer.get_server()* get_server({server_name}) Parameters: ~ {server_name} (string) The server instance to retrieve. Return: ~ ok: boolean, server: |lsp_installer.Server| Example: ~ > local lsp_installer = require'nvim-lsp-installer' local ok, rust_server = lsp_installer.get_server("rust_analyzer") if ok then rust_server:install() end < ============================================================================== Lua module: nvim-lsp-installer.server *nvim-lsp-installer.server* *nvim-lsp-installer.Server* class: Server This class enables installing, uninstalling, and setting up language servers. Methods: ~ - setup({opts}) Sets up the language server. This has the same function signature as the setup function in nvim-lspconfig. Refer to nvim-lspconfig for more information on {opts}. - get_default_options() Returns a deep copy of the default options provided to lspconfig in the setup({opts}) method. - is_installed() Returns {true} is server is installed, else returns {false}. - install() Installs this instance of an LSP server. - uninstall() Uninstalls this instance of an LSP server. vim:tw=78:ft=help:norl: