mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Make conditional check top-level
Thanks to Echasnovski (a Reddit comment he made) to avoid having the conditional inside the function body and be executed every time the function is called.
This commit is contained in:
parent
6e21ac4962
commit
00883a477b
1 changed files with 4 additions and 2 deletions
|
|
@ -5,10 +5,12 @@ local M = {}
|
|||
---@param method string
|
||||
---@param bufnr? integer
|
||||
local function supports_method(client, method, bufnr)
|
||||
return client:supports_method(method, bufnr)
|
||||
end
|
||||
if vim.fn.has("nvim-0.11") == 0 then
|
||||
function supports_method(client, method, bufnr)
|
||||
return client.supports_method and client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
return client:supports_method(method, bufnr) and client:supports_method(method, bufnr)
|
||||
end
|
||||
|
||||
---@alias lsp.Client.filter {id?: number, bufnr?: number, name?: string, method?: string, filter?:fun(client: lsp.Client):boolean}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue