feat(neovim): started rust configuration and tweaked some lsp stuff
This commit is contained in:
@@ -1,29 +1,28 @@
|
||||
-- NOTE: A list of language servers (and potentially their config)
|
||||
-- Accepts either true to enable, false to disable or a table with settings
|
||||
return {
|
||||
-- lua_ls = {
|
||||
-- settings = {
|
||||
-- diagnostics = {
|
||||
-- globals = { 'vim' },
|
||||
-- },
|
||||
-- workspace = {
|
||||
-- library = {
|
||||
-- [vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
-- [vim.fn.stdpath('config') .. '/lua'] = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }, -- lua
|
||||
lua_ls = true, -- lua
|
||||
clangd = true, -- C/C++
|
||||
gradle_ls = true, -- java package manager
|
||||
jdtls = true, -- java eclipse lsp
|
||||
lua_ls = {
|
||||
settings = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.stdpath('config') .. '/lua'] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}, -- lua
|
||||
clangd = true, -- C/C++
|
||||
gradle_ls = true, -- java package manager
|
||||
jdtls = true, -- java eclipse lsp
|
||||
kotlin_language_server = true, -- kotlin
|
||||
pyright = true, -- python
|
||||
rust_analyzer = true, -- rust
|
||||
bashls = true, -- bash
|
||||
taplo = true, -- toml
|
||||
lemminx = true, -- xml
|
||||
yamlls = true, -- yaml
|
||||
jsonls = true, -- json
|
||||
pyright = true, -- python
|
||||
rust_analyzer = false, -- NOTE: using rustaceanvim
|
||||
bashls = true, -- bash
|
||||
taplo = true, -- toml
|
||||
lemminx = true, -- xml
|
||||
yamlls = true, -- yaml
|
||||
jsonls = true, -- json
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local servers = require('custom.config.language-servers')
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local servers = require('custom.config.language-servers')
|
||||
for name, config in pairs(servers) do
|
||||
if config == false then
|
||||
goto continue
|
||||
end
|
||||
if config == true then
|
||||
---@diagnostic disable-next-line: cast-local-type
|
||||
config = {}
|
||||
@@ -13,6 +16,7 @@ for name, config in pairs(servers) do
|
||||
}, config)
|
||||
|
||||
lspconfig[name].setup(config)
|
||||
::continue::
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
|
||||
@@ -44,3 +44,6 @@ vim.g.loaded_node_provider = 0
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.loaded_python3_provider = 0
|
||||
|
||||
-- LSP
|
||||
vim.lsp.inlay_hint.enable()
|
||||
|
||||
32
.config/nvim/lua/custom/config/rustaceanvim.lua
Normal file
32
.config/nvim/lua/custom/config/rustaceanvim.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
---@type RustaceanOpts
|
||||
vim.g.rustaceanvim = {
|
||||
---@type RustaceanToolsOpts
|
||||
tools = {
|
||||
float_win_config = {
|
||||
border = 'rounded',
|
||||
},
|
||||
},
|
||||
---@type RustaceanLspClientOpts
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
local keymaps = {
|
||||
{ { 'n', 'i' }, '<M-Enter>', '<cmd>RustLsp codeAction<cr>', { desc = 'Code Action' } },
|
||||
}
|
||||
|
||||
for _, keymap in ipairs(keymaps) do
|
||||
local modes = keymap[1]
|
||||
local lhs = keymap[2]
|
||||
local rhs = keymap[3]
|
||||
local opts = keymap[4]
|
||||
opts.buffer = bufnr
|
||||
|
||||
vim.keymap.set(modes, lhs, rhs, opts)
|
||||
end
|
||||
end,
|
||||
default_settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
},
|
||||
---@type RustaceanDapOpts
|
||||
dap = {},
|
||||
}
|
||||
8
.config/nvim/lua/custom/plugins/rustaceanvim.lua
Normal file
8
.config/nvim/lua/custom/plugins/rustaceanvim.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = '^4',
|
||||
lazy = false, -- already lazy
|
||||
init = function ()
|
||||
require("custom.config.rustaceanvim")
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user