aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-11-21 20:12:17 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2023-11-21 20:19:38 +0100
commitd230c502db193ee81da116386d1cdff5c5ac3e37 (patch)
tree5a19cbd881b299cad51dea313dea74c32decc6db
parentaf541188335dda55594d0c7de92b823e181049de (diff)
downloadvis-lspc-multiple_ls_per_file.tar.gz
vis-lspc-multiple_ls_per_file.zip
call the new hooksmultiple_ls_per_file
The two new hooks allow to execute user code after certain events. They are called with the language server table as first argument. * initialized_hook is called after the initialized notification was sent. * file_open_hook is called after sending a textDocument/didOpen notification. successfully initialized and when a new file is opened by the editor.
-rw-r--r--init.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 90e7ddc..befc0dc 100644
--- a/init.lua
+++ b/init.lua
@@ -889,6 +889,11 @@ local function lspc_handle_initialize_response(ls, result)
setmetatable(params, {__jsontype = 'object'})
ls_send_notification(ls, 'initialized', params)
+ if ls.initialized_hook then
+ lspc.log('executing initialize hook of ' .. ls.name)
+ ls:initialized_hook()
+ end
+
-- According to nvim-lspconfig sendig the lsp server settings shortly after
-- initialization is a undocumented convention.
-- See https://github.com/neovim/nvim-lspconfig/blob/ed88435764d8b00442e66d39ec3d9c360e560783/CONTRIBUTING.md
@@ -1175,6 +1180,10 @@ local function lspc_open(ls, win, file)
end)
end
+ if ls.file_open_hook then
+ lspc.log('Executing file_open_hook of' .. ls.name .. ' and ' .. file.path)
+ ls:file_open_hook(file)
+ end
end
-- Initiate the shutdown of a language server