diff options
| author | kylo252 <59826753+kylo252@users.noreply.github.com> | 2022-08-23 10:18:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-23 16:18:16 +0800 |
| commit | 4a09c346e40ff9da8def04c591d9c87d5b328beb (patch) | |
| tree | 896c3fd865e96e9564c6285594cda699ce2e8972 /doc | |
| parent | feat(pasls): add lpi and lpk to root dir detection (#1692) (diff) | |
| download | nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar.gz nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar.bz2 nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar.lz nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar.xz nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.tar.zst nvim-lspconfig-4a09c346e40ff9da8def04c591d9c87d5b328beb.zip | |
docs: add an entry about the setup-hook (#1873)
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lspconfig.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/lspconfig.txt b/doc/lspconfig.txt index 3a79db0a..70339a8b 100644 --- a/doc/lspconfig.txt +++ b/doc/lspconfig.txt @@ -228,6 +228,28 @@ The global defaults for all servers can be overridden by extending the `setup {}` can additionally override these defaults in subsequent calls. ============================================================================== +SETUP HOOK *lspconfig-setup-hook* + +`lspconfig` will execute the `on_setup` hook for each setup call to a server after +validating its configuration, and before attempting to launch the server +itself. One typical usage is to allow ad-hoc substitution for any +configuration entry, such as `cmd`. + +> + local lspconfig = require 'lspconfig' + lspconfig.util.on_setup = util.add_hook_before(lspconfig.util.on_setup, function(config) + if some_condition and config.name == "clangd" then + local custom_server_prefix = "/my/custom/server/prefix" + config.cmd = { custom_server_prefix .. "/bin/clangd" } + end + end) + + +Note: This is primarily targeted at plugins developers, so make sure to use +`util.add_hook_before()` as a wrapper instead of overriding the original function +completely, to void breaking external integrations with lspconfig. + +============================================================================== SERVER CONFIGURATIONS *lspconfig-configurations* See |lspconfig-all| for the complete list of language server configurations. |
