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)
|
wk.add(keys)
|
||||||
end
|
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
|
return M
|
||||||
|
|
|
||||||
|
|
@ -34,20 +34,6 @@ M.is_ssh = function()
|
||||||
return false
|
return false
|
||||||
end
|
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
|
--- partially apply a function with given arguments
|
||||||
M.partial = function(f, ...)
|
M.partial = function(f, ...)
|
||||||
local a = { ... }
|
local a = { ... }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
local lualine = require("lualine")
|
local lualine = require("lualine")
|
||||||
local oil = require("oil")
|
local oil = require("oil")
|
||||||
local utils = require("ambroisie.utils")
|
local lsp = require("ambroisie.lsp")
|
||||||
|
|
||||||
local function list_spell_languages()
|
local function list_spell_languages()
|
||||||
if not vim.opt.spell:get() then
|
if not vim.opt.spell:get() then
|
||||||
|
|
@ -11,7 +11,7 @@ local function list_spell_languages()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function list_lsp_clients()
|
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
|
if #client_names == 0 then
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue