refactor: *
parent
6efcb93d3d
commit
3b11323f80
|
@ -9,6 +9,7 @@
|
|||
"gruvbox.nvim": { "branch": "main", "commit": "12c2624287dc827edb5d72b2bc4c9619e692a554" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" },
|
||||
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
|
|
|
@ -2,16 +2,6 @@ local M = {
|
|||
constants = {
|
||||
big_file_size_limit = 50 * 1024, -- 50KB
|
||||
},
|
||||
servers = {
|
||||
"lua_ls",
|
||||
"gopls",
|
||||
"clangd",
|
||||
"bashls",
|
||||
"pyright",
|
||||
"yamlls",
|
||||
"ts_ls",
|
||||
"rust_analyzer",
|
||||
},
|
||||
tools = {
|
||||
is_version_gte_0_11 = function()
|
||||
local version = vim.version()
|
||||
|
|
|
@ -2,9 +2,23 @@
|
|||
local function get_all_servers()
|
||||
local servers = {}
|
||||
|
||||
-- Use only servers from commons - single source of truth
|
||||
for _, server in pairs(require("commons").servers) do
|
||||
servers[server] = true
|
||||
-- Auto-detect LSP servers installed by Mason using mason-lspconfig
|
||||
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if ok then
|
||||
local installed_servers = mason_lspconfig.get_installed_servers()
|
||||
for _, server in ipairs(installed_servers) do
|
||||
servers[server] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- If no servers detected, fall back to common servers that might be system-installed
|
||||
if vim.tbl_isempty(servers) then
|
||||
local fallback_servers = {
|
||||
"lua_ls",
|
||||
}
|
||||
for _, server in pairs(fallback_servers) do
|
||||
servers[server] = true
|
||||
end
|
||||
end
|
||||
|
||||
return servers
|
||||
|
|
|
@ -23,6 +23,7 @@ return {
|
|||
rust = { "rustfmt" },
|
||||
javascript = { "prettier", stop_after_first = true },
|
||||
sh = { "shfmt" },
|
||||
xml = { "xmlformat" },
|
||||
},
|
||||
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
|
||||
},
|
||||
|
|
|
@ -3,6 +3,10 @@ return {
|
|||
-- event = "InsertEnter",
|
||||
-- cond = not require("commons").tools.is_version_gte_0_11(),
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { { "saghen/blink.cmp" }, { "williamboman/mason.nvim" } },
|
||||
dependencies = {
|
||||
{ "saghen/blink.cmp" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" }
|
||||
},
|
||||
config = function() require("functions.lsp") end,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = { "williamboman/mason.nvim" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
-- Automatically install LSP servers detected by mason-lspconfig
|
||||
automatic_installation = true,
|
||||
},
|
||||
}
|
|
@ -3,7 +3,16 @@ return {
|
|||
cmd = "Mason",
|
||||
build = ":MasonUpdate",
|
||||
opts_extend = { "ensure_installed" },
|
||||
opts = { ensure_installed = { "stylua", "lua-language-server", "gopls", "pyright" } },
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
-- Formatters and tools
|
||||
"stylua",
|
||||
-- LSP servers (will be auto-detected by mason-lspconfig)
|
||||
"lua-language-server",
|
||||
"gopls",
|
||||
"pyright"
|
||||
}
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
|
|
Loading…
Reference in New Issue