Compare commits
No commits in common. "e53cf715f5201346a83999f3a3fe9b954cfd742a" and "3b11323f806d2b9f2537f8c0de3f5500f0c9c0c4" have entirely different histories.
e53cf715f5
...
3b11323f80
|
@ -15,24 +15,6 @@ local M = {
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
lsp_servers = {
|
|
||||||
code = {
|
|
||||||
"lua_ls",
|
|
||||||
"gopls",
|
|
||||||
"clangd",
|
|
||||||
"bashls",
|
|
||||||
"yamlls",
|
|
||||||
"ts_ls",
|
|
||||||
"rust_analyzer",
|
|
||||||
"ruff",
|
|
||||||
},
|
|
||||||
format_lint = {
|
|
||||||
"goimports",
|
|
||||||
"gofumpt",
|
|
||||||
},
|
|
||||||
mason_ensure_installed = { "lua_ls", "bashls", "bacon", "rust-analyzer" },
|
|
||||||
treesitter_ensure_installed = { "go", "rust", "python" },
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
-- Get all LSP servers to configure
|
-- Get all LSP servers to configure
|
||||||
local function get_all_servers()
|
local function get_all_servers()
|
||||||
local servers = {}
|
local servers = {}
|
||||||
local commons = require("commons")
|
|
||||||
|
|
||||||
-- Use configured LSP servers from commons
|
|
||||||
for _, server in ipairs(commons.lsp_servers.code) do
|
|
||||||
servers[server] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-detect LSP servers installed by Mason using mason-lspconfig
|
-- Auto-detect LSP servers installed by Mason using mason-lspconfig
|
||||||
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||||
|
@ -17,18 +11,22 @@ local function get_all_servers()
|
||||||
end
|
end
|
||||||
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
|
return servers
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Configure a single LSP server
|
-- Configure a single LSP server
|
||||||
local function configure_server(server, lspconfig, capabilities)
|
local function configure_server(server, lspconfig, capabilities)
|
||||||
-- Only attempt to load .lua files from lsp folder
|
local ok, settings = pcall(require, "lsp." .. server)
|
||||||
local lsp_config_path = "lsp." .. server
|
|
||||||
local lua_file_path = vim.fn.stdpath("config") .. "/lua/lsp/" .. server .. ".lua"
|
|
||||||
|
|
||||||
-- Check if the .lua file exists
|
|
||||||
if vim.fn.filereadable(lua_file_path) == 1 then
|
|
||||||
local ok, settings = pcall(require, lsp_config_path)
|
|
||||||
if ok then
|
if ok then
|
||||||
if lspconfig then
|
if lspconfig then
|
||||||
settings.capabilities = capabilities
|
settings.capabilities = capabilities
|
||||||
|
@ -37,15 +35,6 @@ local function configure_server(server, lspconfig, capabilities)
|
||||||
vim.lsp.config(server, settings)
|
vim.lsp.config(server, settings)
|
||||||
vim.lsp.enable(server)
|
vim.lsp.enable(server)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
-- Fallback to default config if .lua file exists but fails to load
|
|
||||||
if lspconfig then
|
|
||||||
lspconfig[server].setup({ capabilities = capabilities })
|
|
||||||
else
|
|
||||||
vim.lsp.config(server, {})
|
|
||||||
vim.lsp.enable(server)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if lspconfig then
|
if lspconfig then
|
||||||
lspconfig[server].setup({ capabilities = capabilities })
|
lspconfig[server].setup({ capabilities = capabilities })
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
---@type vim.lsp.Config
|
|
||||||
return {
|
|
||||||
keys = {
|
|
||||||
{ "<leader>ch", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
|
|
||||||
},
|
|
||||||
root_dir = function(name)
|
|
||||||
return require("lspconfig.util").root_pattern(
|
|
||||||
"Makefile",
|
|
||||||
"configure.ac",
|
|
||||||
"configure.in",
|
|
||||||
"config.h.in",
|
|
||||||
"meson.build",
|
|
||||||
"meson_options.txt",
|
|
||||||
"build.ninja"
|
|
||||||
)(fname) or require("lspconfig.util").root_pattern("compile_commands.json", "compile_flags.txt")(fname) or require(
|
|
||||||
"lspconfig.util"
|
|
||||||
).find_git_ancestor(name)
|
|
||||||
end,
|
|
||||||
cmd = {
|
|
||||||
"clangd",
|
|
||||||
"--background-index",
|
|
||||||
"--clang-tidy",
|
|
||||||
"--header-insertion=iwyu",
|
|
||||||
"--completion-arg-placeholders",
|
|
||||||
"--function-arg-placeholders",
|
|
||||||
"--fallback-style=llvm",
|
|
||||||
},
|
|
||||||
init_options = {
|
|
||||||
usePlaceholders = true,
|
|
||||||
completeUnimported = true,
|
|
||||||
clangdFileStatus = true,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
---@type vim.lsp.Config
|
---@type vim.lsp.Config
|
||||||
return {
|
return {
|
||||||
|
cmd = { "gopls" },
|
||||||
filetypes = { "go", "gomod", "gosum" },
|
filetypes = { "go", "gomod", "gosum" },
|
||||||
root_markers = {
|
root_markers = {
|
||||||
"go.mod",
|
"go.mod",
|
||||||
|
@ -7,21 +8,8 @@ return {
|
||||||
},
|
},
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
gofumpt = true,
|
|
||||||
codelenses = {
|
|
||||||
gc_details = false,
|
|
||||||
generate = true,
|
|
||||||
regenerate_cgo = true,
|
|
||||||
run_govulncheck = true,
|
|
||||||
test = true,
|
|
||||||
tidy = true,
|
|
||||||
upgrade_dependency = true,
|
|
||||||
vendor = true,
|
|
||||||
},
|
|
||||||
analyses = {
|
analyses = {
|
||||||
nliness = true,
|
|
||||||
unusedparams = true,
|
unusedparams = true,
|
||||||
unusedwrite = true,
|
|
||||||
},
|
},
|
||||||
hints = {
|
hints = {
|
||||||
assignVariableTypes = true,
|
assignVariableTypes = true,
|
||||||
|
@ -32,10 +20,8 @@ return {
|
||||||
parameterNames = true,
|
parameterNames = true,
|
||||||
rangeVariableTypes = true,
|
rangeVariableTypes = true,
|
||||||
},
|
},
|
||||||
usePlaceholders = true,
|
|
||||||
completeUnimported = true,
|
|
||||||
staticcheck = true,
|
staticcheck = true,
|
||||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
gofumpt = true,
|
||||||
semanticTokens = true,
|
semanticTokens = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
return {
|
return {
|
||||||
|
-- Command to start the language server
|
||||||
|
-- This should match the executable name installed by Mason or system package manager
|
||||||
|
cmd = { "pyright" },
|
||||||
|
|
||||||
-- File types that should automatically attach this LSP server
|
-- File types that should automatically attach this LSP server
|
||||||
filetypes = { "python" },
|
filetypes = { "python" },
|
||||||
|
|
||||||
|
@ -18,20 +22,27 @@ return {
|
||||||
-- Server-specific settings (varies by language server)
|
-- Server-specific settings (varies by language server)
|
||||||
-- Check your language server's documentation for available options
|
-- Check your language server's documentation for available options
|
||||||
settings = {
|
settings = {
|
||||||
basedpyright = {
|
python = {
|
||||||
analysis = {
|
analysis = {
|
||||||
autoImportCompletions = true,
|
|
||||||
ignorePatterns = { "*.pyi" },
|
|
||||||
diagnosticSeverityOverrides = {
|
|
||||||
reportAny = false,
|
|
||||||
reportExplicitAny = false,
|
|
||||||
},
|
|
||||||
typeCheckingMode = "standard",
|
|
||||||
autoSearchPaths = true,
|
autoSearchPaths = true,
|
||||||
useLibraryCodeForTypes = true,
|
useLibraryCodeForTypes = true,
|
||||||
diagnosticMode = "workspace",
|
|
||||||
disableOrganizeImports = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Optional: Additional capabilities (usually handled globally)
|
||||||
|
-- capabilities = require("blink.cmp").get_lsp_capabilities(),
|
||||||
|
|
||||||
|
-- Optional: Custom initialization options
|
||||||
|
-- init_options = {
|
||||||
|
-- hostInfo = "neovim",
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- Optional: Custom handlers for LSP methods
|
||||||
|
-- handlers = {
|
||||||
|
-- ["textDocument/hover"] = vim.lsp.with(
|
||||||
|
-- vim.lsp.handlers.hover,
|
||||||
|
-- { border = "rounded" }
|
||||||
|
-- ),
|
||||||
|
-- },
|
||||||
}
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
return {
|
|
||||||
cmd_env = { RUFF_TRACE = "messages" },
|
|
||||||
init_options = {
|
|
||||||
settings = {
|
|
||||||
logLevel = "error",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
keys = { { "<leader>co", function() end, desc = "Organize Imports" } },
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
return {
|
|
||||||
capabilities = {
|
|
||||||
textDocument = {
|
|
||||||
foldingRange = {
|
|
||||||
dynamicRegistration = false,
|
|
||||||
lineFoldingOnly = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
settings = {
|
|
||||||
redhat = { telemetry = { enabled = false } },
|
|
||||||
yaml = {
|
|
||||||
keyOrdering = false,
|
|
||||||
format = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
validate = true,
|
|
||||||
schemaStore = {
|
|
||||||
enable = false,
|
|
||||||
url = "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -19,8 +19,9 @@ return {
|
||||||
},
|
},
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
|
python = { "black" },
|
||||||
rust = { "rustfmt" },
|
rust = { "rustfmt" },
|
||||||
javascript = { "biome" },
|
javascript = { "prettier", stop_after_first = true },
|
||||||
sh = { "shfmt" },
|
sh = { "shfmt" },
|
||||||
xml = { "xmlformat" },
|
xml = { "xmlformat" },
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,14 @@ return {
|
||||||
build = ":MasonUpdate",
|
build = ":MasonUpdate",
|
||||||
opts_extend = { "ensure_installed" },
|
opts_extend = { "ensure_installed" },
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = {},
|
ensure_installed = {
|
||||||
|
-- Formatters and tools
|
||||||
|
"stylua",
|
||||||
|
-- LSP servers (will be auto-detected by mason-lspconfig)
|
||||||
|
"lua-language-server",
|
||||||
|
"gopls",
|
||||||
|
"pyright"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
|
|
|
@ -18,9 +18,6 @@ return {
|
||||||
words = { enabled = false },
|
words = { enabled = false },
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
|
||||||
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
|
||||||
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
|
||||||
{ "<leader>e", function() Snacks.explorer() end, desc = "Snack File Explorer" },
|
{ "<leader>e", function() Snacks.explorer() end, desc = "Snack File Explorer" },
|
||||||
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
|
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
|
||||||
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
|
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
|
||||||
|
|
Loading…
Reference in New Issue