home: vim: lua: move 'list_clients' to lsp'
This commit is contained in:
parent
7202fa1911
commit
852ded641a
3 changed files with 16 additions and 16 deletions
|
|
@ -85,4 +85,18 @@ M.on_attach = function(client, bufnr)
|
|||
wk.add(keys)
|
||||
end
|
||||
|
||||
--- list all active LSP clients for specific buffer, or all buffers
|
||||
--- @param bufnr int? buffer number
|
||||
--- @return table all active LSP client names
|
||||
M.list_clients = function(bufnr)
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
local names = {}
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(names, client.name)
|
||||
end
|
||||
|
||||
return names
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -34,20 +34,6 @@ M.is_ssh = function()
|
|||
return false
|
||||
end
|
||||
|
||||
--- list all active LSP clients for specific buffer, or all buffers
|
||||
--- @param bufnr int? buffer number
|
||||
--- @return table all active LSP client names
|
||||
M.list_lsp_clients = function(bufnr)
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
local names = {}
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(names, client.name)
|
||||
end
|
||||
|
||||
return names
|
||||
end
|
||||
|
||||
--- partially apply a function with given arguments
|
||||
M.partial = function(f, ...)
|
||||
local a = { ... }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local lualine = require("lualine")
|
||||
local oil = require("oil")
|
||||
local utils = require("ambroisie.utils")
|
||||
local lsp = require("ambroisie.lsp")
|
||||
|
||||
local function list_spell_languages()
|
||||
if not vim.opt.spell:get() then
|
||||
|
|
@ -11,7 +11,7 @@ local function list_spell_languages()
|
|||
end
|
||||
|
||||
local function list_lsp_clients()
|
||||
local client_names = utils.list_lsp_clients(0)
|
||||
local client_names = lsp.list_clients(0)
|
||||
|
||||
if #client_names == 0 then
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue