clippy by default

This commit is contained in:
Christoph J. Scherr 2024-02-16 15:53:23 +01:00
parent e7f7ad4ca8
commit 10a01d0503
Signed by: cscherrNT
GPG Key ID: 8E2B45BC51A27EA7
3 changed files with 761 additions and 729 deletions

View File

@ -5,8 +5,8 @@ local M = {}
local highlights = require "custom.highlights" local highlights = require "custom.highlights"
M.ui = { M.ui = {
theme = "github_light", theme = "oceanic-next",
theme_toggle = { "kanagawa", "github_light" }, theme_toggle = { "oceanic-next", "oceanic-light" },
hl_override = highlights.override, hl_override = highlights.override,
hl_add = highlights.add, hl_add = highlights.add,

View File

@ -10,7 +10,7 @@ local servers = {
"tsserver", "tsserver",
"clangd", "clangd",
"pyright", "pyright",
"rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration! -- "rust_analyzer", -- rustaceanvim wants to do that, but the builtin thing has better integration!
"bashls", "bashls",
"cmake", "cmake",
} }
@ -21,3 +21,28 @@ for _, lsp in ipairs(servers) do
capabilities = capabilities, capabilities = capabilities,
} }
end end
lspconfig.rust_analyzer.setup {
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
check = {
command = "clippy",
},
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
}

View File

@ -102,7 +102,12 @@ local plugins = {
["<leader>f"] = { name = "+formatting" }, ["<leader>f"] = { name = "+formatting" },
}, },
}, },
{ "echasnovski/mini.trailspace", lazy = false, event = { "BufReadPost", "BufNewFile" }, opts = {} }, {
"echasnovski/mini.trailspace",
lazy = false,
event = { "BufReadPost", "BufNewFile" },
opts = {},
},
{ {
"itchyny/vim-cursorword", "itchyny/vim-cursorword",
event = "FileType", event = "FileType",
@ -650,8 +655,7 @@ local plugins = {
local label = {} local label = {}
for severity, icon in pairs(icons) do for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf, local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] })
{ severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity }) table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end end
@ -765,7 +769,7 @@ local plugins = {
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end, end,
args = function() args = function()
return require('custom.utils').tokenize_args(vim.fn.input("args: ")) return require("custom.utils").tokenize_args(vim.fn.input "args: ")
end, end,
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
-- FIXME: perhaps we can put the stdio somewhere more practical -- FIXME: perhaps we can put the stdio somewhere more practical
@ -808,8 +812,11 @@ local plugins = {
config = function() config = function()
local dap = require "dap" local dap = require "dap"
vim.g.rustaceanvim = { vim.g.rustaceanvim = {
enable_clippy = true,
-- Plugin configuration -- Plugin configuration
tools = {}, tools = {
enable_clippy = true,
},
-- LSP configuration -- LSP configuration
server = { server = {
auto_attach = false, auto_attach = false,