feat: rust lsp

This commit is contained in:
isabel 2024-02-07 17:27:43 +00:00
parent 309ee1fa07
commit 68784cab02
No known key found for this signature in database
GPG key ID: 08A97B9A107A1798
7 changed files with 99 additions and 11 deletions

View file

@ -581,7 +581,7 @@
},
"nvim-lspconfig": {
"cargoLocks": null,
"date": "2024-02-06",
"date": "2024-02-07",
"extract": null,
"name": "nvim-lspconfig",
"passthru": null,
@ -593,11 +593,11 @@
"name": null,
"owner": "neovim",
"repo": "nvim-lspconfig",
"rev": "0a1a2aa549da0d2294e072e2d725f02cca32f64e",
"sha256": "sha256-Xbc3/LJV7iLaVJpwwBIgYMnPnPSKwMBGnjgHFUoyAQA=",
"rev": "1bc83418927003552505ec66fa5d6cffae953f6a",
"sha256": "sha256-gA/UvFYpC31nmt792ylapqA8TZ7mA+JozXEcBNqlrwo=",
"type": "github"
},
"version": "0a1a2aa549da0d2294e072e2d725f02cca32f64e"
"version": "1bc83418927003552505ec66fa5d6cffae953f6a"
},
"nvim-navic": {
"cargoLocks": null,
@ -799,6 +799,26 @@
},
"version": "ca8d5ee2b4ee1eec491040a7601d366ddc8a2e02"
},
"rustaceanvim": {
"cargoLocks": null,
"date": "2024-02-06",
"extract": null,
"name": "rustaceanvim",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "mrcjkb",
"repo": "rustaceanvim",
"rev": "8940ef5c7e3ffd37712ac0556832b5b10a136874",
"sha256": "sha256-wKBcbzFbUamvCGj2kiL2YwIRWmXw66ErVYH3rkaoTG0=",
"type": "github"
},
"version": "8940ef5c7e3ffd37712ac0556832b5b10a136874"
},
"schemastore": {
"cargoLocks": null,
"date": "2024-02-05",

20
_sources/generated.nix generated
View file

@ -351,15 +351,15 @@
};
nvim-lspconfig = {
pname = "nvim-lspconfig";
version = "0a1a2aa549da0d2294e072e2d725f02cca32f64e";
version = "1bc83418927003552505ec66fa5d6cffae953f6a";
src = fetchFromGitHub {
owner = "neovim";
repo = "nvim-lspconfig";
rev = "0a1a2aa549da0d2294e072e2d725f02cca32f64e";
rev = "1bc83418927003552505ec66fa5d6cffae953f6a";
fetchSubmodules = false;
sha256 = "sha256-Xbc3/LJV7iLaVJpwwBIgYMnPnPSKwMBGnjgHFUoyAQA=";
sha256 = "sha256-gA/UvFYpC31nmt792ylapqA8TZ7mA+JozXEcBNqlrwo=";
};
date = "2024-02-06";
date = "2024-02-07";
};
nvim-navic = {
pname = "nvim-navic";
@ -481,6 +481,18 @@
};
date = "2024-01-31";
};
rustaceanvim = {
pname = "rustaceanvim";
version = "8940ef5c7e3ffd37712ac0556832b5b10a136874";
src = fetchFromGitHub {
owner = "mrcjkb";
repo = "rustaceanvim";
rev = "8940ef5c7e3ffd37712ac0556832b5b10a136874";
fetchSubmodules = false;
sha256 = "sha256-wKBcbzFbUamvCGj2kiL2YwIRWmXw66ErVYH3rkaoTG0=";
};
date = "2024-02-06";
};
schemastore = {
pname = "schemastore";
version = "898a19cb54f310dda7cdeedf3d75aeeffcf19136";

View file

@ -12,6 +12,7 @@
ripgrep
wakatime
lazygit
direnv
# python
ruff

View file

@ -160,6 +160,10 @@ src.git = "https://github.com/hallerpatrick/py_lsp.nvim"
fetch.github = "hiphish/rainbow-delimiters.nvim"
src.git = "https://github.com/hiphish/rainbow-delimiters.nvim"
[rustaceanvim]
fetch.github = "mrcjkb/rustaceanvim"
src.git = "https://github.com/mrcjkb/rustaceanvim"
[schemastore]
fetch.github = "b0o/schemastore.nvim"
src.git = "https://github.com/b0o/schemastore.nvim"

View file

@ -140,7 +140,6 @@ require("isabel.lsp.webdev").setup(common)
pcall(require("py_lsp").setup, common)
local servers = {
"astro",
"bashls",
"dockerls",
"jqls",
@ -149,8 +148,6 @@ local servers = {
"sourcekit",
"taplo",
"teal_ls",
"marksman",
"rust_analyzer",
}
for _, server in ipairs(servers) do

View file

@ -206,6 +206,16 @@ in rec {
};
};
# rust lsp
rustaceanvim = {
src = srcs.rustaceanvim;
config = ./rust.lua;
ft = "rust";
dependencies = {
inherit which-key;
};
};
nvim-lspconfig = {
src = srcs.nvim-lspconfig;
config = ./lsp.lua;

44
plugins/rust.lua Normal file
View file

@ -0,0 +1,44 @@
vim.g.rustaceanvim = {
on_attach = function(client, bufnr)
-- register which-key mappings
local wk = require("which-key")
wk.register({
["<leader>cR"] = {
function()
vim.cmd.RustLsp("codeAction")
end,
"Code Action",
},
["<leader>dr"] = {
function()
vim.cmd.RustLsp("debuggables")
end,
"Rust debuggables",
},
}, { mode = "n", buffer = bufnr })
end,
settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = {
allFeatures = true,
command = "clippy",
extraArgs = { "--no-deps" },
},
procMacro = {
enable = true,
ignored = {
["async-trait"] = { "async_trait" },
["napi-derive"] = { "napi" },
["async-recursion"] = { "async_recursion" },
},
},
},
},
}