rust linting

This commit is contained in:
2026-09-02 16:29:47 +02:00
parent 694a305855
commit a050d87439
4 changed files with 36 additions and 22 deletions
@@ -52,6 +52,7 @@ return {
"cssls", -- CSS "cssls", -- CSS
"bashls", -- Bash "bashls", -- Bash
"lua_ls", -- Lua "lua_ls", -- Lua
"rust_analyzer", -- Rust
--"stylua", --"stylua",
}, },
}) })
@@ -147,6 +148,15 @@ return {
-- filetypes and tsserver/request forwarding to ts_ls (hybrid mode) -- filetypes and tsserver/request forwarding to ts_ls (hybrid mode)
vim.lsp.config("vue_ls", {}) vim.lsp.config("vue_ls", {})
-- Rust
vim.lsp.config("rust_analyzer", {
setting = {
["rust-analyzer"] = {
checkOnSave = { command = "clippy" },
},
},
})
-- Other languages -- Other languages
vim.lsp.config("jsonls", {}) vim.lsp.config("jsonls", {})
vim.lsp.config("yamlls", {}) vim.lsp.config("yamlls", {})
@@ -164,6 +174,7 @@ return {
vim.lsp.enable("html") vim.lsp.enable("html")
vim.lsp.enable("cssls") vim.lsp.enable("cssls")
vim.lsp.enable("bashls") vim.lsp.enable("bashls")
vim.lsp.enable("rust_analyzer")
end, end,
}, },
} }
@@ -20,6 +20,7 @@ return {
markdown = { "prettier" }, markdown = { "prettier" },
sh = { "shfmt" }, sh = { "shfmt" },
bash = { "shfmt" }, bash = { "shfmt" },
rust = { "rustfmt" },
}, },
}) })
+23 -22
View File
@@ -1,25 +1,26 @@
return { return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
config = function() config = function()
require("lint").linters_by_ft = { require("lint").linters_by_ft = {
javascript = { "eslint_d" }, javascript = { "eslint_d" },
javascriptreact = { "eslint_d" }, javascriptreact = { "eslint_d" },
typescript = { "eslint_d" }, typescript = { "eslint_d" },
typescriptreact = { "eslint_d" }, typescriptreact = { "eslint_d" },
vue = { "eslint_d" }, vue = { "eslint_d" },
python = { "ruff" }, python = { "ruff" },
-- lua = { "selene" }, -- Disabled: lua_ls provides diagnostics -- lua = { "selene" }, -- Disabled: lua_ls provides diagnostics
sh = { "shellcheck" }, sh = { "shellcheck" },
bash = { "shellcheck" }, bash = { "shellcheck" },
json = { "jsonlint" }, json = { "jsonlint" },
yaml = { "yamllint" }, yaml = { "yamllint" },
markdown = { "markdownlint" }, markdown = { "markdownlint" },
} rust = { "clippy" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, { vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function() callback = function()
require("lint").try_lint() require("lint").try_lint()
end, end,
}) })
end, end,
} }
@@ -52,6 +52,7 @@ return {
"bash", "bash",
"markdown", "markdown",
"markdown_inline", "markdown_inline",
"rust",
} }
-- Install parsers -- Install parsers