Skip to content

Commit

Permalink
docs: add an entry about the setup-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
kylo252 committed Apr 28, 2022
1 parent 86df1c8 commit c8f78e2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/lspconfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,23 @@ 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 then
local custom_server_prefix = "/my/custom/path"
config.cmd_env = custom_server_prefix
end
end)
<
==============================================================================
SERVER CONFIGURATIONS *lspconfig-configurations*

Expand Down

0 comments on commit c8f78e2

Please sign in to comment.