still working on it, on attach is not firing :/

This commit is contained in:
Solomon Laing 2026-01-05 08:30:03 +10:30
parent 1cefee76d8
commit 26597230e3
3 changed files with 54 additions and 1 deletions

View File

@ -14,9 +14,29 @@ return {
automatic_enable = true,
ensure_installed = {
"lua_ls",
"gopls"
},
},
config = function(_, opts)
-- get all the servers that are available thourgh mason-lspconfig
local all_mslp_servers = vim.tbl_keys(require("mason-lspconfig").get_mappings().lspconfig_to_package)
local ensure_installed = {} ---@type string[]
for server, server_opts in pairs(require("lazyvim.plugins.lsp.config").opts.servers) do
if server_opts then
server_opts = server_opts == true and {} or server_opts
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
if server_opts.mason == true or vim.tbl_contains(all_mslp_servers, server) then
ensure_installed[#ensure_installed + 1] = server
end
end
end
opts.ensure_installed = vim.tbl_deep_extend("force",
{},
opts.ensure_installed or {},
ensure_installed)
require("mason-lspconfig").setup(opts)
require("lazyvim.plugins.lsp.config").setup()
end,

View File

@ -12,7 +12,7 @@ local function load_file_into_buffer(file)
end
function M.jump_to_angular_component_part(part)
-- todo: implement inline jumping
-- todo: implement inline jumping
end
function M.toggle_between_spec_and_file()

View File

@ -167,4 +167,37 @@ function M.exists(path)
end
end
local format = string.format
local rep = string.rep
local write = io.write
---Recursively print the table, if not table value is just printed.
---@param t any
---@param level? number
function M.print_table(t, level)
level = level or 0
if type(t) == "table" then
-- do not print new line on the level 0
if level ~= 0 then
print("\n")
end
print(rep("\t", level), "{\n")
level = level + 1
for key, value in pairs(t) do
print(rep("\t", level) .. format("[%s] = ", key))
M.print_table(value, level)
end
level = level - 1
print(rep("\t", level), "}")
else
print(tostring(t))
end
-- print new line on the level 0
if level == 0 then
print("\n")
end
end
return M