updated editor and lsp
This commit is contained in:
@@ -9,6 +9,9 @@ return {
|
|||||||
explorer = {
|
explorer = {
|
||||||
replace_netrw = true,
|
replace_netrw = true,
|
||||||
},
|
},
|
||||||
|
lazygit = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
picker = {
|
picker = {
|
||||||
sources = {
|
sources = {
|
||||||
explorer = {
|
explorer = {
|
||||||
@@ -39,6 +42,10 @@ return {
|
|||||||
{ "<C-S-e>", function() Snacks.explorer() end, desc = "Toggle Explorer" },
|
{ "<C-S-e>", function() Snacks.explorer() end, desc = "Toggle Explorer" },
|
||||||
-- Alternative binding if terminal doesn't handle Ctrl+Shift
|
-- Alternative binding if terminal doesn't handle Ctrl+Shift
|
||||||
{ "<leader>fe", function() Snacks.explorer() end, desc = "File Explorer" },
|
{ "<leader>fe", function() Snacks.explorer() end, desc = "File Explorer" },
|
||||||
|
-- Lazygit
|
||||||
|
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
|
||||||
|
{ "<leader>gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log" },
|
||||||
|
{ "<leader>gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit File History" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -49,6 +56,7 @@ return {
|
|||||||
spec = {
|
spec = {
|
||||||
{ "<leader>a", group = "AI" },
|
{ "<leader>a", group = "AI" },
|
||||||
{ "<leader>d", group = "Debug/Database" },
|
{ "<leader>d", group = "Debug/Database" },
|
||||||
|
{ "<leader>g", group = "Git" },
|
||||||
{ "<leader>t", group = "Terminal" },
|
{ "<leader>t", group = "Terminal" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,21 @@
|
|||||||
-- LSP Configuration
|
-- LSP Configuration
|
||||||
-- Extends LazyVim's built-in LSP support
|
-- Extends LazyVim's built-in LSP support
|
||||||
|
|
||||||
|
-- Helper function for monorepo root detection
|
||||||
|
-- Finds nearest project marker, with fallback to git root
|
||||||
|
local function make_root_detector(markers)
|
||||||
|
return function(fname)
|
||||||
|
local util = require("lspconfig.util")
|
||||||
|
-- First try language-specific markers (nearest to file)
|
||||||
|
local root = util.root_pattern(unpack(markers))(fname)
|
||||||
|
if root then
|
||||||
|
return root
|
||||||
|
end
|
||||||
|
-- Fallback to git root
|
||||||
|
return util.root_pattern(".git")(fname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Mason: manage LSP servers, linters, formatters
|
-- Mason: manage LSP servers, linters, formatters
|
||||||
{
|
{
|
||||||
@@ -40,6 +55,8 @@ return {
|
|||||||
servers = {
|
servers = {
|
||||||
-- Go
|
-- Go
|
||||||
gopls = {
|
gopls = {
|
||||||
|
-- Root detection: find go.work first, then go.mod, then git root
|
||||||
|
root_dir = make_root_detector({ "go.work", "go.mod" }),
|
||||||
settings = {
|
settings = {
|
||||||
gopls = {
|
gopls = {
|
||||||
gofumpt = true,
|
gofumpt = true,
|
||||||
@@ -74,12 +91,19 @@ return {
|
|||||||
staticcheck = true,
|
staticcheck = true,
|
||||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||||
semanticTokens = true,
|
semanticTokens = true,
|
||||||
|
-- Monorepo/workspace support
|
||||||
|
expandWorkspaceToModule = true,
|
||||||
|
experimentalPostfixCompletions = true,
|
||||||
|
-- Handle multiple modules
|
||||||
|
["build.standaloneTags"] = { "ignore" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Lua
|
-- Lua
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
|
root_dir = make_root_detector({ ".luarc.json", ".luarc.jsonc", ".luacheckrc", ".stylua.toml", "stylua.toml",
|
||||||
|
"selene.toml", "selene.yml" }),
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = {
|
workspace = {
|
||||||
@@ -97,6 +121,8 @@ return {
|
|||||||
|
|
||||||
-- TypeScript/JavaScript
|
-- TypeScript/JavaScript
|
||||||
ts_ls = {
|
ts_ls = {
|
||||||
|
-- Root detection: find nearest tsconfig/package.json
|
||||||
|
root_dir = make_root_detector({ "tsconfig.json", "jsconfig.json", "package.json" }),
|
||||||
settings = {
|
settings = {
|
||||||
typescript = {
|
typescript = {
|
||||||
inlayHints = {
|
inlayHints = {
|
||||||
@@ -125,17 +151,23 @@ return {
|
|||||||
|
|
||||||
-- HTML
|
-- HTML
|
||||||
html = {
|
html = {
|
||||||
|
root_dir = make_root_detector({ "package.json", ".git" }),
|
||||||
filetypes = { "html", "templ" },
|
filetypes = { "html", "templ" },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- CSS
|
-- CSS
|
||||||
cssls = {},
|
cssls = {
|
||||||
|
root_dir = make_root_detector({ "package.json", ".git" }),
|
||||||
|
},
|
||||||
|
|
||||||
-- JSON
|
-- JSON
|
||||||
jsonls = {},
|
jsonls = {
|
||||||
|
root_dir = make_root_detector({ "package.json", ".git" }),
|
||||||
|
},
|
||||||
|
|
||||||
-- YAML
|
-- YAML
|
||||||
yamlls = {
|
yamlls = {
|
||||||
|
root_dir = make_root_detector({ "package.json", ".git" }),
|
||||||
settings = {
|
settings = {
|
||||||
yaml = {
|
yaml = {
|
||||||
keyOrdering = false,
|
keyOrdering = false,
|
||||||
@@ -148,10 +180,14 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- Markdown
|
-- Markdown
|
||||||
marksman = {},
|
marksman = {
|
||||||
|
root_dir = make_root_detector({ ".marksman.toml", ".git" }),
|
||||||
|
},
|
||||||
|
|
||||||
-- SQL
|
-- SQL
|
||||||
sqlls = {},
|
sqlls = {
|
||||||
|
root_dir = make_root_detector({ ".sqllsrc.json", "sqlls.json", ".git" }),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user