feat(dev): standarize language server toolchains across Neovim and Zed
- NixOS: Add required LSP and formatter binaries (`prettier`, etc.) to
`modules/user/graphical.nix`
- Zed: Register language server binaries (`lua-lsp`, `taplo`,
`marksman`) in `settings.json` to ensure path lookup.
- Neovim:
- Add native LSP configuration for Rust, Nix, TypeScript, Lua, TOML,
and Markdown
- Implement native LSP-based auto-completion (utilizing
`vim.lsp.completion` for Neovim 0.11+).
This commit is contained in:
1 parent
16ef9f87cf
commit
d1b28cea02
4 files changed
+51
-1
No files matched your search
@@ -6,3 +6,4 @@ vim.opt.expandtab = true -- Convert tabs to spaces
|
||||
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
||||
vim.opt.wrap = false -- Disable automatic line wrapping
|
||||
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" } -- Smooth auto-completion behavior
|
||||
@@ -11,11 +11,36 @@ vim.lsp.config('ruff', {
|
||||
})
|
||||
vim.lsp.enable('ruff')
|
||||
|
||||
-- Configure LSP Keybindings on attach
|
||||
-- Rust LSP: Rust Analyzer
|
||||
vim.lsp.config('rust_analyzer', {})
|
||||
vim.lsp.enable('rust_analyzer')
|
||||
|
||||
-- Nix LSP: nixd (Nix Language Server)
|
||||
vim.lsp.config('nixd', {})
|
||||
vim.lsp.enable('nixd')
|
||||
|
||||
-- TypeScript LSP: ts_ls
|
||||
vim.lsp.config('ts_ls', {})
|
||||
vim.lsp.enable('ts_ls')
|
||||
|
||||
-- Lua LSP: lua_ls
|
||||
vim.lsp.config('lua_ls', {})
|
||||
vim.lsp.enable('lua_ls')
|
||||
|
||||
-- TOML LSP: taplo
|
||||
vim.lsp.config('taplo', {})
|
||||
vim.lsp.enable('taplo')
|
||||
|
||||
-- Markdown LSP: marksman
|
||||
vim.lsp.config('marksman', {})
|
||||
vim.lsp.enable('marksman')
|
||||
|
||||
-- Configure LSP Keybindings and features on attach
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
local opts = { buffer = ev.buf }
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
|
||||
-- Standard navigation & actions
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
@@ -24,6 +49,11 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
|
||||
-- Enable built-in LSP completion (Neovim 0.11+)
|
||||
if client and client:supports_method('textDocument/completion') then
|
||||
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||
end
|
||||
|
||||
-- Auto-format on save using Ruff / LSP
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
buffer = ev.buf,
|
||||
|
||||
@@ -87,6 +87,21 @@
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
},
|
||||
"lua-language-server": {
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
},
|
||||
"taplo": {
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
},
|
||||
"marksman": {
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
nixd
|
||||
jdt-language-server
|
||||
typescript-language-server
|
||||
lua-language-server
|
||||
taplo
|
||||
marksman
|
||||
prettier
|
||||
];
|
||||
|
||||
# Firefox configuration
|
||||
|
||||
Reference in new issue
Block a user