feat(lsp): 添加golang和rust支持

This commit is contained in:
2025-12-15 15:56:26 +08:00
parent 8ffc9a68c6
commit 2e5863d7d4
6 changed files with 176 additions and 34 deletions

View File

@@ -34,7 +34,8 @@ return {
scss = { "prettierd", "prettier" },
less = { "prettierd", "prettier" },
sh = { "shfmt" },
["*"] = { "lsp" }, -- 任何文件类型的后备
go = { "gofumpt", "golines" },
rust = { "rustfmt" },
},
-- 精确配置每个格式化工具
@@ -80,6 +81,22 @@ return {
args = { "-i", "2", "-ci", "-bn" }, -- 2空格缩进case缩进二元运算符换行
stdin = true,
},
gofumpt = {
command = "gofumpt",
stdin = true,
},
golines = {
command = "golines",
args = { "--max-len=120", "-w" },
stdin = false,
},
rustfmt = {
command = "rustfmt",
args = { "--emit=stdout" },
stdin = true,
},
},
-- 保存时自动格式化
@@ -110,6 +127,10 @@ return {
"black",
"isort",
"shfmt",
"gofumpt",
"golines",
"rustfmt",
}
local status = {}