Compare commits
2 commits
45e9b409d3
...
86cc51458a
Author | SHA1 | Date | |
---|---|---|---|
86cc51458a | |||
64c6e1e1e8 |
2 changed files with 1 additions and 28 deletions
|
@ -1,27 +0,0 @@
|
||||||
-- https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/util/lsp.lua
|
|
||||||
|
|
||||||
---@class lib.lazyvim.lsp
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
---@alias lsp.Client.filter {id?:number, bufnr?:number, name?:string, method?:string, filter?:fun(client:lsp.Client):boolean}
|
|
||||||
|
|
||||||
---@param opts? lsp.Client.filter
|
|
||||||
function M.get_clients(opts)
|
|
||||||
local ret = {} ---@type vim.lsp.Client[]
|
|
||||||
|
|
||||||
if vim.lsp.get_clients then
|
|
||||||
ret = vim.lsp.get_clients(opts)
|
|
||||||
else
|
|
||||||
---@diagnostic disable-next-line: deprecated
|
|
||||||
ret = vim.lsp.get_active_clients(opts)
|
|
||||||
|
|
||||||
if opts and opts.method then
|
|
||||||
---@param client vim.lsp.Client
|
|
||||||
ret = vim.tbl_filter(function(client)
|
|
||||||
return client.supports_method(opts.method, { bufnr = opts.bufnr })
|
|
||||||
end, ret)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret
|
|
||||||
end
|
|
|
@ -25,7 +25,7 @@ end
|
||||||
---@return {fg?:string}?
|
---@return {fg?:string}?
|
||||||
function M.fg(name)
|
function M.fg(name)
|
||||||
local hl = vim.api.nvim_get_hl(0, { name = name, link = false })
|
local hl = vim.api.nvim_get_hl(0, { name = name, link = false })
|
||||||
local fg = hl and hl.fg or hl.foreground
|
local fg = hl and hl.fg or nil
|
||||||
return fg and { fg = string.format('#%06x', fg) } or nil
|
return fg and { fg = string.format('#%06x', fg) } or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue