diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index 87ae466..53d9579 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -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, diff --git a/.config/nvim/lua/lazyvim/utils/angular.lua b/.config/nvim/lua/lazyvim/utils/angular.lua index 1232a85..4c52334 100644 --- a/.config/nvim/lua/lazyvim/utils/angular.lua +++ b/.config/nvim/lua/lazyvim/utils/angular.lua @@ -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() diff --git a/.config/nvim/lua/lazyvim/utils/init.lua b/.config/nvim/lua/lazyvim/utils/init.lua index afe95b9..a2173ab 100644 --- a/.config/nvim/lua/lazyvim/utils/init.lua +++ b/.config/nvim/lua/lazyvim/utils/init.lua @@ -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