diff options
| author | William Boman <william@redwill.se> | 2021-08-18 20:35:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-18 20:35:02 +0200 |
| commit | bb6c9441af692daf9b967a15324f574f601d4b52 (patch) | |
| tree | 853987daa609778bf3a64658f09eb0626d54ae7c /doc | |
| parent | doc: add section for custom servers (diff) | |
| download | mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar.gz mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar.bz2 mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar.lz mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar.xz mason-bb6c9441af692daf9b967a15324f574f601d4b52.tar.zst mason-bb6c9441af692daf9b967a15324f574f601d4b52.zip | |
add new on_server_ready() API (#56)
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/nvim-lsp-installer.txt | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/doc/nvim-lsp-installer.txt b/doc/nvim-lsp-installer.txt index 80a004a3..7f4c68a3 100644 --- a/doc/nvim-lsp-installer.txt +++ b/doc/nvim-lsp-installer.txt @@ -29,14 +29,14 @@ Install a language server via `:LspInstall`, for example: > 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 keymaps, etc. + -- ... set up buffer keymaps, etc. end - local installed_servers = lsp_installer.get_installed_servers() - - for _, server in pairs(installed_servers) do - opts = { + lsp_installer.on_server_ready(function(server) + local opts = { on_attach = common_on_attach, } @@ -46,7 +46,8 @@ Then, somewhere in your initialization script (see `:h init.lua`): > -- end server:setup(opts) - end + vim.cmd [[ do User LspAttachBuffers ]] + end) < ============================================================================== @@ -123,6 +124,30 @@ uninstall({server_name}) Parameters: ~ {server_name} (string) The server to uninstall. +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. + +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.server *lsp_installer.server* |
