summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/lvim/core/info.lua72
-rw-r--r--lua/lvim/interface/popup.lua4
-rw-r--r--lua/lvim/lsp/config.lua1
-rw-r--r--lua/lvim/lsp/null-ls/services.lua26
-rw-r--r--lua/lvim/lsp/utils.lua8
-rw-r--r--lua/lvim/plugins.lua23
6 files changed, 85 insertions, 49 deletions
diff --git a/lua/lvim/core/info.lua b/lua/lvim/core/info.lua
index 7577f296..da295b95 100644
--- a/lua/lvim/core/info.lua
+++ b/lua/lvim/core/info.lua
@@ -14,7 +14,7 @@ local text = require "lvim.interface.text"
local lsp_utils = require "lvim.lsp.utils"
local function str_list(list)
- return fmt("[ %s ]", table.concat(list, ", "))
+ return #list == 1 and list[1] or fmt("[%s]", table.concat(list, ", "))
end
local function make_formatters_info(ft)
@@ -73,21 +73,23 @@ local function tbl_set_highlight(terms, highlight_group)
end
local function make_client_info(client)
+ if client.name == "null-ls" then
+ return
+ end
local client_enabled_caps = lsp_utils.get_client_capabilities(client.id)
local name = client.name
local id = client.id
local filetypes = lsp_utils.get_supported_filetypes(name)
- local document_formatting = client.resolved_capabilities.document_formatting
- local attached_buffers_list = table.concat(vim.lsp.get_buffers_by_client_id(client.id), ", ")
+ local attached_buffers_list = str_list(vim.lsp.get_buffers_by_client_id(client.id))
local client_info = {
- fmt("* Name: %s", name),
- fmt("* Id: [%s]", tostring(id)),
- fmt("* filetype(s): [%s]", table.concat(filetypes, ", ")),
- fmt("* Attached buffers: [%s]", tostring(attached_buffers_list)),
- fmt("* Supports formatting: %s", tostring(document_formatting)),
+ fmt("* name: %s", name),
+ fmt("* id: %s", tostring(id)),
+ fmt("* supported filetype(s): %s", str_list(filetypes)),
+ fmt("* attached buffers: %s", tostring(attached_buffers_list)),
+ fmt("* root_dir pattern: %s", tostring(attached_buffers_list)),
}
if not vim.tbl_isempty(client_enabled_caps) then
- local caps_text = "* Capabilities list: "
+ local caps_text = "* capabilities: "
local caps_text_len = caps_text:len()
local enabled_caps = text.format_table(client_enabled_caps, 3, " | ")
enabled_caps = text.shift_right(enabled_caps, caps_text_len)
@@ -98,8 +100,27 @@ local function make_client_info(client)
return client_info
end
+local function make_override_info(ft)
+ local available = lsp_utils.get_supported_servers_per_filetype(ft)
+ local overridden = vim.tbl_filter(function(name)
+ return vim.tbl_contains(available, name)
+ end, lvim.lsp.override)
+
+ local info_lines = { "" }
+ if #overridden == 0 then
+ return info_lines
+ end
+
+ info_lines = {
+ fmt("Overridden %s server(s)", ft),
+ fmt("* list: %s", str_list(overridden)),
+ }
+
+ return info_lines
+end
+
function M.toggle_popup(ft)
- local clients = lsp_utils.get_active_clients_by_ft(ft)
+ local clients = vim.lsp.get_active_clients(ft)
local client_names = {}
local bufnr = vim.api.nvim_get_current_buf()
local ts_active_buffers = vim.tbl_keys(vim.treesitter.highlighter.active)
@@ -111,26 +132,26 @@ function M.toggle_popup(ft)
return status
end
local header = {
- fmt("Detected filetype: %s", ft),
- fmt("Current buffer number: [%s]", bufnr),
- }
-
- local ts_info = {
- "Treesitter info",
- fmt("* current buffer: %s", is_treesitter_active()),
- fmt("* list: [%s]", table.concat(ts_active_buffers, ", ")),
+ "Buffer info",
+ fmt("* filetype: %s", ft),
+ fmt("* bufnr: %s", bufnr),
+ fmt("* treesitter status: %s", is_treesitter_active()),
}
local lsp_info = {
- "Language Server Protocol (LSP) info",
- fmt "* Active server(s):",
+ "Active client(s)",
}
for _, client in pairs(clients) do
- vim.list_extend(lsp_info, make_client_info(client))
+ local client_info = make_client_info(client)
+ if client_info then
+ vim.list_extend(lsp_info, client_info)
+ end
table.insert(client_names, client.name)
end
+ local override_info = make_override_info(ft)
+
local formatters_info = make_formatters_info(ft)
local linters_info = make_linters_info(ft)
@@ -146,10 +167,10 @@ function M.toggle_popup(ft)
{ "" },
header,
{ "" },
- ts_info,
- { "" },
lsp_info,
{ "" },
+ override_info,
+ { "" },
formatters_info,
{ "" },
linters_info,
@@ -165,8 +186,9 @@ function M.toggle_popup(ft)
local function set_syntax_hl()
vim.cmd [[highlight LvimInfoIdentifier gui=bold]]
vim.cmd [[highlight link LvimInfoHeader Type]]
- vim.fn.matchadd("LvimInfoHeader", "Treesitter info")
- vim.fn.matchadd("LvimInfoHeader", "Language Server Protocol (LSP) info")
+ vim.fn.matchadd("LvimInfoHeader", "Buffer info")
+ vim.fn.matchadd("LvimInfoHeader", "Active client(s)")
+ vim.fn.matchadd("LvimInfoHeader", fmt("Overridden %s server(s)", ft))
vim.fn.matchadd("LvimInfoHeader", "Formatters info")
vim.fn.matchadd("LvimInfoHeader", "Linters info")
vim.fn.matchadd("LvimInfoHeader", "Code actions info")
diff --git a/lua/lvim/interface/popup.lua b/lua/lvim/interface/popup.lua
index 6587f5d4..b767f609 100644
--- a/lua/lvim/interface/popup.lua
+++ b/lua/lvim/interface/popup.lua
@@ -48,11 +48,11 @@ function Popup:display(content_provider)
)
local lines = content_provider(self.layout)
- vim.api.nvim_buf_set_lines(self.bufnr, 0, -1, false, lines)
+ vim.api.nvim_buf_set_lines(self.bufnr or 0, 0, -1, false, lines)
-- window options
for key, value in pairs(self.win_opts) do
- vim.api.nvim_win_set_option(self.win_id, key, value)
+ vim.api.nvim_win_set_option(self.win_id or 0, key, value)
end
-- buffer options
diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua
index 8c7a0dd9..64cf52f0 100644
--- a/lua/lvim/lsp/config.lua
+++ b/lua/lvim/lsp/config.lua
@@ -79,6 +79,7 @@ return {
"phpactor",
"pylsp",
"quick_lint_js",
+ "remark_ls",
"rome",
"solang",
"solidity_ls",
diff --git a/lua/lvim/lsp/null-ls/services.lua b/lua/lvim/lsp/null-ls/services.lua
index b8a8edc8..7dc0bb62 100644
--- a/lua/lvim/lsp/null-ls/services.lua
+++ b/lua/lvim/lsp/null-ls/services.lua
@@ -72,22 +72,26 @@ function M.register_sources(configs, method)
local name = config.name or cmd:gsub("-", "_")
local type = method == null_ls.methods.CODE_ACTION and "code_actions" or null_ls.methods[method]:lower()
local source = type and null_ls.builtins[type][name]
- Log:debug(string.format("Received request to register [%s] as a %s source", cmd, type))
+ Log:debug(string.format("Received request to register [%s] as a %s source", name, type))
if not source then
Log:error("Not a valid source: " .. name)
- elseif is_registered { command = cmd or name, method = method } then
- Log:trace "Skipping registering the source more than once"
+ elseif is_registered { name = source.name or name, method = method } then
+ Log:trace(string.format("Skipping registering [%s] more than once", name))
else
local command = M.find_command(source._opts.command) or source._opts.command
- local compat_opts = {
- command = command,
- -- treat `args` as `extra_args` for backwards compatibility. Can otherwise use `generator_opts.args`
- extra_args = config.args or config.extra_args,
- }
- local opts = vim.tbl_deep_extend("keep", compat_opts, config)
- Log:debug("Registering source: " .. source.name)
+
+ -- treat `args` as `extra_args` for backwards compatibility. Can otherwise use `generator_opts.args`
+ local compat_opts = vim.deepcopy(config)
+ if config.args then
+ compat_opts.extra_args = config.args or config.extra_args
+ compat_opts.args = nil
+ end
+
+ local opts = vim.tbl_deep_extend("keep", { command = command }, compat_opts)
+ Log:debug("Registering source " .. name)
+ Log:trace(vim.inspect(opts))
table.insert(sources, source.with(opts))
- vim.list_extend(registered_names, { name })
+ vim.list_extend(registered_names, { source.name })
end
end
diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua
index 47b1c8ba..ebc682e5 100644
--- a/lua/lvim/lsp/utils.lua
+++ b/lua/lvim/lsp/utils.lua
@@ -66,6 +66,14 @@ function M.get_supported_filetypes(server_name)
return requested_server:get_supported_filetypes()
end
+---Get supported servers per filetype
+---@param filetype string
+---@return table list of names of supported servers
+function M.get_supported_servers_per_filetype(filetype)
+ local filetype_server_map = require "nvim-lsp-installer._generated.filetype_map"
+ return filetype_server_map[filetype]
+end
+
---Get all supported filetypes by nvim-lsp-installer
---@return table supported filestypes as a list of strings
function M.get_all_supported_filetypes()
diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua
index f0bcf526..52ad1c01 100644
--- a/lua/lvim/plugins.lua
+++ b/lua/lvim/plugins.lua
@@ -6,22 +6,23 @@ local commit = {
cmp_path = "4d58224e315426e5ac4c5b218ca86cab85f80c79",
comment = "90df2f87c0b17193d073d1f72cea2e528e5b162d",
dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425",
+ dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e",
friendly_snippets = "9f04462bcabfd108341a6e47ed742b09a6a5b975",
gitsigns = "c18fc65c77abf95ac2e7783b9e7455a7a2fab26c",
lua_dev = "03a44ec6a54b0a025a633978e8541584a02e46d9",
- lualine = "52725d2ca87c38e3cf479993afcbdd36e5c81a26",
+ lualine = "fd8fa5ddd823e15721ddec560ea61e7372e746a7",
luasnip = "ed0140696fa99ea072bc485c87d22a396c477db3",
- nlsp_settings = "90fbd2c736e5221427aa132fefd4d7f23e9114ee",
- null_ls = "b75effe6cb304e97901289f3f2e8d2ba77c7b752",
- nvim_autopairs = "96858723f1cba6a3eb004373a20c315d90584ea6",
- nvim_cmp = "1b94aacada96d2a33fef2ecf87748b27a2f50630",
- nvim_dap = "a6fa644f9de62c594a8a9cf6f2aaf324b5a6108b",
- nvim_lsp_installer = "3805f06d3e5b25996563fd9740a90014948bc31a",
- nvim_lspconfig = "c0310ab4c7ac864031bbf82b07809b36df54a9d2",
+ nlsp_settings = "97125eeb68a412f11885dffe5fdcc3a26d36c58d",
+ null_ls = "48ac5bcd4d766b371d91024d10c7c83fb909e388",
+ nvim_autopairs = "5348e4a778ebdf42126a54fb5a933a98612df6cb",
+ nvim_cmp = "9f6d2b42253dda8db950ab38795978e5420a93aa",
+ nvim_dap = "3f1514d020f9d73a458ac04f42d27e5b284c0e48",
+ nvim_lsp_installer = "2e81b1d86f90c8a05d7f875599818612bd68e1a7",
+ nvim_lspconfig = "c7081e00fa8100ee099c16e375f3e5e838cbf1db",
nvim_notify = "15f52efacd169ea26b0f4070451d3ea53f98cd5a",
nvim_tree = "0a2f6b0b6ba558a88c77a6b262af647760e6eca8",
- nvim_treesitter = "e81a60b6927521f7dc218ddb00e2c7fb6b1d797d",
+ nvim_treesitter = "a7c0c1764b0b583d0597108dd7d48bc5c0f98c81",
nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
nvim_web_devicons = "ac71ca88b1136e1ecb2aefef4948130f31aa40d1",
packer = "851c62c5ecd3b5adc91665feda8f977e104162a5",
@@ -29,9 +30,9 @@ local commit = {
popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538",
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
- telescope = "a01ebd2793999c11d727fd15b1e5979ba20c7503",
+ telescope = "f06dd06bb1143caa779e492ca37e5f985f0c6157",
telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954",
- toggleterm = "ce92e485a9a731405393af2bd1aff5b49ba9eb73",
+ toggleterm = "463843d1ba0288eedaf834872c3eca114d45bddf",
which_key = "312c386ee0eafc925c27869d2be9c11ebdb807eb",
}