mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
feat(neovim): Rust dev with rustaceanvim & LSP servers installation through OS installer and NOT mason
- Use `rustaceanvim` for Rust development - `rustaceanvim` keymaps in NeoVim `after` file - Remove Rust LSP setup through builtin LSP - Remove LSP installations from Mason when equivalent available through OS installers - All LSP plugins in `code-lsp.lua`
This commit is contained in:
23
common/.config/nvim/after/ftplugin/rust.lua
Normal file
23
common/.config/nvim/after/ftplugin/rust.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- TODO: Map all native Nvim 0.11 LSP commands to corresponding rustaceanvim ones
|
||||
-- grn -> Rename
|
||||
-- grr -> References
|
||||
-- gri -> Implementation
|
||||
-- gO -> document_symbol
|
||||
-- gra -> code_action
|
||||
-- Mine
|
||||
-- F2 -> Rename
|
||||
-- gD -> Go to definition
|
||||
-- <leader>cr -> References
|
||||
-- <leader>co -> document_symbol
|
||||
|
||||
if pcall(require, "rustaceanvim") then
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
vim.keymap.set("n", "<C-.>", function()
|
||||
vim.cmd.RustLsp("codeAction")
|
||||
end, { silent = true, buffer = bufnr })
|
||||
|
||||
vim.keymap.set("n", "K", function()
|
||||
vim.cmd.RustLsp({ "hover", "actions" })
|
||||
end, { silent = true, buffer = bufnr })
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
return {}
|
||||
@@ -1,3 +1,7 @@
|
||||
-- TIP:
|
||||
-- Step 1: Install the LSP through either of the following:
|
||||
-- OS Installer > Brew-linux > Mason NeoVim Plugin
|
||||
-- Step 2: Append the LSP server name in the below array
|
||||
vim.lsp.enable({
|
||||
"bashls",
|
||||
"cssls",
|
||||
@@ -6,38 +10,58 @@ vim.lsp.enable({
|
||||
"html",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
"omnisharp",
|
||||
"pylsp",
|
||||
"rust_analyzer",
|
||||
"sqlls",
|
||||
"ts_ls",
|
||||
-- TODO: Enable inlay_hints for all of them
|
||||
})
|
||||
|
||||
-- TIP: On new systems, install these through Mason
|
||||
-- They aren't usually found on either OS installer or brew-linux
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
local to_installed = vim.tbl_keys({
|
||||
"black", -- Python formatter
|
||||
"csharpier", -- C# formatter
|
||||
"djlint", -- Handlebar Formatter
|
||||
"markdown-toc",
|
||||
"markdownlint",
|
||||
"netcoredbg", -- C# Debugger
|
||||
"prettier",
|
||||
"prettierd",
|
||||
"shellharden",
|
||||
"shfmt",
|
||||
"stylua",
|
||||
"trivy", -- Vulnerability Linter
|
||||
"yamlfmt",
|
||||
"codelldb",
|
||||
"css-lsp",
|
||||
"docker-compose-language-service",
|
||||
"html-lsp",
|
||||
"json-lsp",
|
||||
"sqlls",
|
||||
})
|
||||
|
||||
-- Setup native diagnostic
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = "rounded",
|
||||
source = true,
|
||||
},
|
||||
virtual_text = {
|
||||
enabled = true,
|
||||
severity = { min = vim.diagnostic.severity.ERROR },
|
||||
},
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
severity = { min = vim.diagnostic.severity.INFO },
|
||||
},
|
||||
})
|
||||
|
||||
-- Change diagnostic symbols in the sign column (gutter)
|
||||
if vim.g.have_nerd_font then
|
||||
local signs = require("config.util").icons.diagnostics
|
||||
local diagnostic_signs = {}
|
||||
for type, icon in pairs(signs) do
|
||||
diagnostic_signs[vim.diagnostic.severity[type]] = icon
|
||||
end
|
||||
vim.diagnostic.config({ signs = { text = diagnostic_signs } })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
|
||||
-- Setup LSP completion
|
||||
-- Setup native LSP completion
|
||||
-- This is already done by blink, but better prefer the builtin one
|
||||
if client:supports_method("textDocument/completion") then
|
||||
vim.opt.completeopt = { "menu", "menuone", "noinsert", "fuzzy", "popup" }
|
||||
|
||||
@@ -57,4 +57,28 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Rust
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^6",
|
||||
config = function()
|
||||
vim.g.rusteceanvim = {
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = "codelldb",
|
||||
name = "codelldb",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
tag = "stable",
|
||||
config = function()
|
||||
require("crates").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"saecki/crates.nvim",
|
||||
tag = "stable",
|
||||
config = function()
|
||||
require("crates").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
bat
|
||||
bats-core
|
||||
dnscrypt-proxy
|
||||
dockerfile-language-server
|
||||
fd
|
||||
fzf
|
||||
gitleaks
|
||||
@@ -13,20 +14,31 @@ kondo
|
||||
lazydocker
|
||||
lazygit
|
||||
lua
|
||||
luajit
|
||||
lua-language-server
|
||||
luajit
|
||||
markdown-toc
|
||||
markdownlint-cli
|
||||
marksman
|
||||
n
|
||||
neovim
|
||||
prettier
|
||||
prettierd
|
||||
python-lsp-server
|
||||
python@3.12
|
||||
rclone
|
||||
sccache
|
||||
shellcheck
|
||||
shellharden
|
||||
shodan
|
||||
speedtest-cli
|
||||
sqlite
|
||||
stylua
|
||||
taplo
|
||||
tlrc
|
||||
tokei
|
||||
tree-sitter
|
||||
typescript-language-server
|
||||
vue-language-server
|
||||
yamlfmt
|
||||
yt-dlp
|
||||
zoxide
|
||||
|
||||
@@ -10,6 +10,7 @@ libavcodec-extra
|
||||
akmod-nvidia
|
||||
dnf-plugins-core
|
||||
libva-nvidia-driver
|
||||
nodejs-bash-language-server
|
||||
xorg-x11-drv-nvidia-cuda
|
||||
|
||||
# Common
|
||||
@@ -17,7 +18,6 @@ aspnetcore-runtime-8.0
|
||||
bash
|
||||
bat
|
||||
bleachbit
|
||||
brave-browser
|
||||
btop
|
||||
cmake
|
||||
code
|
||||
@@ -29,8 +29,6 @@ docker-ce-cli
|
||||
docker-compose-plugin
|
||||
dolphin
|
||||
dolphin-plugins
|
||||
dotnet-runtime-8.0
|
||||
dotnet-sdk-8.0
|
||||
evolution-ews
|
||||
evolution-mapi
|
||||
fd-find
|
||||
@@ -72,7 +70,7 @@ qbittorrent
|
||||
rclone
|
||||
ripgrep
|
||||
sccache
|
||||
ShellCheck
|
||||
shellcheck
|
||||
simplescreenrecorder
|
||||
smplayer
|
||||
software-properties-common
|
||||
@@ -81,6 +79,7 @@ syncthing
|
||||
tmux
|
||||
tokei
|
||||
tree-sitter-cli
|
||||
trivy
|
||||
ufw
|
||||
ulauncher
|
||||
vim
|
||||
@@ -94,7 +93,6 @@ zsh
|
||||
|
||||
# FreeBSD packages
|
||||
codespell
|
||||
dotnet
|
||||
html
|
||||
fusefs-lkl
|
||||
firefox-esr
|
||||
|
||||
Reference in New Issue
Block a user