summaryrefslogtreecommitdiff
path: root/lua/core
diff options
context:
space:
mode:
Diffstat (limited to 'lua/core')
-rw-r--r--lua/core/builtins/init.lua1
-rw-r--r--lua/core/cmp.lua30
-rw-r--r--lua/core/info.lua87
-rw-r--r--lua/core/log.lua1
-rw-r--r--lua/core/lspinstall.lua19
-rw-r--r--lua/core/lualine/components.lua3
-rw-r--r--lua/core/which-key.lua2
7 files changed, 68 insertions, 75 deletions
diff --git a/lua/core/builtins/init.lua b/lua/core/builtins/init.lua
index dc9b5ff5..c3b3618f 100644
--- a/lua/core/builtins/init.lua
+++ b/lua/core/builtins/init.lua
@@ -15,7 +15,6 @@ local builtins = {
"core.bufferline",
"core.autopairs",
"core.comment",
- "core.lspinstall",
"core.lualine",
}
diff --git a/lua/core/cmp.lua b/lua/core/cmp.lua
index 2bc724fb..965285c7 100644
--- a/lua/core/cmp.lua
+++ b/lua/core/cmp.lua
@@ -35,9 +35,35 @@ M.config = function()
select = true,
},
formatting = {
+ kind_icons = {
+ Class = "ī – ",
+ Color = "îˆĢ ",
+ Constant = " ",
+ Constructor = "īĨ ",
+ Enum = "īŠ—",
+ EnumMember = "ī… ",
+ Event = " ",
+ Field = " ",
+ File = "",
+ Folder = "īŠ ",
+ Function = "īž” ",
+ Interface = "ī°Ž ",
+ Keyword = " ",
+ Method = " ",
+ Module = " ",
+ Operator = "īš”",
+ Property = " ",
+ Reference = " ",
+ Snippet = "īƒ„ ",
+ Struct = " ",
+ Text = "īž ",
+ TypeParameter = "īžƒ ",
+ Unit = "īĨŦ",
+ Value = "īĸŸ ",
+ Variable = "īšĻ ",
+ },
format = function(entry, vim_item)
- local icons = require("lsp.kind").icons
- vim_item.kind = icons[vim_item.kind]
+ vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind]
vim_item.menu = ({
nvim_lsp = "(LSP)",
emoji = "(Emoji)",
diff --git a/lua/core/info.lua b/lua/core/info.lua
index b8d51a8c..ff024fa5 100644
--- a/lua/core/info.lua
+++ b/lua/core/info.lua
@@ -10,6 +10,7 @@ local M = {
}
local fmt = string.format
+local text = require "interface.text"
local function str_list(list)
return fmt("[ %s ]", table.concat(list, ", "))
@@ -65,44 +66,55 @@ local function tbl_set_highlight(terms, highlight_group)
end
end
+local function make_client_info(client)
+ local client_enabled_caps = require("lsp.utils").get_ls_capabilities(client.id)
+ local name = client.name
+ local id = client.id
+ local document_formatting = client.resolved_capabilities.document_formatting
+ local client_info = {
+ fmt("* Name: %s", name),
+ fmt("* Id: %s", tostring(id)),
+ fmt("* Supports formatting: %s", tostring(document_formatting)),
+ }
+ if not vim.tbl_isempty(client_enabled_caps) then
+ local caps_text = "* Capabilities list: "
+ 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)
+ enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1))
+ vim.list_extend(client_info, enabled_caps)
+ end
+
+ return client_info
+end
+
function M.toggle_popup(ft)
local lsp_utils = require "lsp.utils"
- local client = lsp_utils.get_active_client_by_ft(ft)
- local is_client_active = false
- local client_enabled_caps = {}
- local client_name = ""
- local client_id = 0
- local document_formatting = false
- if client ~= nil then
- is_client_active = not client.is_stopped()
- client_enabled_caps = require("lsp").get_ls_capabilities(client.id)
- client_name = client.name
- client_id = client.id
- document_formatting = client.resolved_capabilities.document_formatting
- end
+ local clients = lsp_utils.get_active_client_by_ft(ft)
+ local client_names = {}
local header = {
fmt("Detected filetype: %s", ft),
fmt("Treesitter active: %s", tostring(next(vim.treesitter.highlighter.active) ~= nil)),
}
- local text = require "interface.text"
local lsp_info = {
"Language Server Protocol (LSP) info",
- fmt("* Associated server: %s", client_name),
- fmt("* Active: %s (id: %d)", tostring(is_client_active), client_id),
- fmt("* Supports formatting: %s", tostring(document_formatting)),
+ fmt "* Associated server(s):",
}
- if not vim.tbl_isempty(client_enabled_caps) then
- local caps_text = "* Capabilities list: "
- 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)
- enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1))
- vim.list_extend(lsp_info, enabled_caps)
+
+ for _, client in pairs(clients) do
+ vim.list_extend(lsp_info, make_client_info(client))
+ table.insert(client_names, client.name)
end
- local null_ls = require "lsp.null-ls"
- local registered_providers = null_ls.list_supported_provider_names(ft)
+
+ local null_formatters = require "lsp.null-ls.formatters"
+ local null_linters = require "lsp.null-ls.linters"
+ local registered_formatters = null_formatters.list_supported_names(ft)
+ local registered_linters = null_linters.list_supported_names(ft)
+ local registered_providers = {}
+ vim.list_extend(registered_providers, registered_formatters)
+ vim.list_extend(registered_providers, registered_linters)
local registered_count = vim.tbl_count(registered_providers)
local null_ls_info = {
"Formatters and linters",
@@ -113,24 +125,6 @@ function M.toggle_popup(ft)
),
}
- local null_formatters = require "lsp.null-ls.formatters"
- local missing_formatters = null_formatters.list_unsupported_names(ft)
- local missing_formatters_status = {}
- if not vim.tbl_isempty(missing_formatters) then
- missing_formatters_status = {
- fmt("* Missing formatters: %s", table.concat(missing_formatters, " ī™— , ") .. " ī™— "),
- }
- end
-
- local null_linters = require "lsp.null-ls.linters"
- local missing_linters = null_linters.list_unsupported_names(ft)
- local missing_linters_status = {}
- if not vim.tbl_isempty(missing_linters) then
- missing_linters_status = {
- fmt("* Missing linters: %s", table.concat(missing_linters, " ī™— , ") .. " ī™— "),
- }
- end
-
local content_provider = function(popup)
local content = {}
@@ -143,8 +137,6 @@ function M.toggle_popup(ft)
lsp_info,
{ "" },
null_ls_info,
- missing_formatters_status,
- missing_linters_status,
{ "" },
{ "" },
get_formatter_suggestion_msg(ft),
@@ -167,11 +159,8 @@ function M.toggle_popup(ft)
vim.cmd 'let m=matchadd("string", "true")'
vim.cmd 'let m=matchadd("error", "false")'
tbl_set_highlight(registered_providers, "LvimInfoIdentifier")
- tbl_set_highlight(missing_formatters, "LvimInfoIdentifier")
- tbl_set_highlight(missing_linters, "LvimInfoIdentifier")
-- tbl_set_highlight(require("lsp.null-ls.formatters").list_available(ft), "LvimInfoIdentifier")
-- tbl_set_highlight(require("lsp.null-ls.linters").list_available(ft), "LvimInfoIdentifier")
- vim.cmd('let m=matchadd("LvimInfoIdentifier", "' .. client_name .. '")')
end
local Popup = require("interface.popup"):new {
diff --git a/lua/core/log.lua b/lua/core/log.lua
index 1eb786ba..fca1fcb4 100644
--- a/lua/core/log.lua
+++ b/lua/core/log.lua
@@ -8,6 +8,7 @@ function Log:add_entry(msg, level)
if self.__handle then
-- plenary uses lower-case log levels
self.__handle[level:lower()](msg)
+ return
end
local status_ok, plenary = pcall(require, "plenary")
if status_ok then
diff --git a/lua/core/lspinstall.lua b/lua/core/lspinstall.lua
deleted file mode 100644
index 0bb59e0e..00000000
--- a/lua/core/lspinstall.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local M = {}
-
-M.config = function()
- lvim.builtin.lspinstall = {
- active = true,
- on_config_done = nil,
- }
-end
-
-M.setup = function()
- local lspinstall = require "lspinstall"
- lspinstall.setup()
-
- if lvim.builtin.lspinstall.on_config_done then
- lvim.builtin.lspinstall.on_config_done(lspinstall)
- end
-end
-
-return M
diff --git a/lua/core/lualine/components.lua b/lua/core/lualine/components.lua
index 21e25585..3ee2fdf8 100644
--- a/lua/core/lualine/components.lua
+++ b/lua/core/lualine/components.lua
@@ -96,14 +96,11 @@ return {
local buf_client_names = {}
-- add client
- local utils = require "lsp.utils"
- local active_client = utils.get_active_client_by_ft(buf_ft)
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" then
table.insert(buf_client_names, client.name)
end
end
- vim.list_extend(buf_client_names, active_client or {})
-- add formatter
local formatters = require "lsp.null-ls.formatters"
diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua
index 27cec37c..a115bcc5 100644
--- a/lua/core/which-key.lua
+++ b/lua/core/which-key.lua
@@ -148,9 +148,9 @@ M.config = function()
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
"Workspace Diagnostics",
},
- -- f = { "<cmd>silent FormatWrite<cr>", "Format" },
f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" },
+ I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
j = {
"<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = lvim.lsp.popup_border}})<cr>",
"Next Diagnostic",