fix(lsp): sometimes lsp client is not fully initialized and doesnt yet have client.supports_method on 0.9.5. Fixes #3263

This commit is contained in:
Folke Lemaitre 2024-05-21 18:23:04 +02:00
parent d19a004136
commit 8c94842b4a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -61,7 +61,7 @@ function M._check_methods(client, buffer)
for method, clients in pairs(M._supports_method) do for method, clients in pairs(M._supports_method) do
clients[client] = clients[client] or {} clients[client] = clients[client] or {}
if not clients[client][buffer] then if not clients[client][buffer] then
if client.supports_method(method, { bufnr = buffer }) then if client.supports_method and client.supports_method(method, { bufnr = buffer }) then
clients[client][buffer] = true clients[client][buffer] = true
vim.api.nvim_exec_autocmds("User", { vim.api.nvim_exec_autocmds("User", {
pattern = "LspSupportsMethod", pattern = "LspSupportsMethod",