feat: use rustaceanvim ratheer than rust-tools
also inlay hint fixes
This commit is contained in:
parent
188bb40227
commit
f5bd91045d
3 changed files with 17 additions and 28 deletions
1
init.lua
1
init.lua
|
@ -161,6 +161,7 @@ require('lazy').setup(PLUGINS)
|
|||
--|| THEME
|
||||
vim.cmd("colorscheme peak") -- TODO can I do it in lua?
|
||||
|
||||
vim.lsp.inlay_hint.enable(true) -- default on
|
||||
|
||||
--|| UTILITY
|
||||
function P(something) print(vim.inspect(something)) end
|
||||
|
|
|
@ -45,7 +45,7 @@ function KEYBINDS:set_global_keys(opts)
|
|||
vim.keymap.set('n', '<C-t>', ':Neotree toggle<CR>', {noremap=true})
|
||||
vim.keymap.set('n', '<C-S-t>', ':Neotree toggle source=symbolmap right<CR>', {noremap=true})
|
||||
vim.keymap.set('n', '<C-PageUp>', ':Neotree toggle source=diagnostics bottom<CR>', opts)
|
||||
vim.keymap.set('n', '<C-h>', vim.cmd.UndotreeToggle, {noremap=true})
|
||||
-- vim.keymap.set('n', '<C-h>', vim.cmd.UndotreeToggle, {noremap=true})
|
||||
-- Esc goes back to normal mode in terminal
|
||||
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>', opts)
|
||||
|
||||
|
@ -80,12 +80,13 @@ function KEYBINDS:set_lsp_keys(opts)
|
|||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', '<leader>d', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', '<leader>y', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<leader>i', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<leader>R', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<leader>f', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<C-Space>', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<C-x>', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', '<leader>H', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end)
|
||||
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<M-r>', vim.lsp.buf.rename, opts)
|
||||
|
@ -93,6 +94,7 @@ function KEYBINDS:set_lsp_keys(opts)
|
|||
vim.keymap.set('n', '<leader><Del>', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '<C-Del>', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '<M-x>', vim.diagnostic.open_float, opts) -- fallback for windows
|
||||
vim.keymap.set('n', '<C-h>', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end)
|
||||
-- It's not really a keybind but whatever
|
||||
vim.api.nvim_create_user_command(
|
||||
'Format',
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
PPPPPPPPPPPPGBPG&&& &&&&&&###BBBGGGGGGGBB##&& - pickers: telescope.nvim
|
||||
&BGPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGBBB##&&& - files: neo-tree.nvim
|
||||
&&##BBBBGGGGGGGPGBBBBBB####&&&& - git: vim-fugitive + gitsigns.nvim
|
||||
&#B#& - extra: hexmode, vim-combo,
|
||||
&& ###& rust-tools, nvim-colorizer,
|
||||
&G# &&#&&& nvim-jdtls, vim-surround,
|
||||
&&& undotree,
|
||||
&#B#& - extra: hexmode, vim-surround,
|
||||
&& ###& undotree, nvim-colorizer,
|
||||
&G# &&#&&& nvim-jdtls, rustaceanvim,
|
||||
&&& vim-combo,
|
||||
]]--
|
||||
|
||||
local function set_lsp_binds(_, bufnr)
|
||||
|
@ -156,32 +156,18 @@ return {
|
|||
},
|
||||
|
||||
{
|
||||
'simrat39/rust-tools.nvim', -- extra LSP defaults for rust
|
||||
dependencies = {
|
||||
'hrsh7th/nvim-cmp', -- referenced here to guarantee load order
|
||||
},
|
||||
config = function ()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local rust_tools = require("rust-tools")
|
||||
rust_tools.setup({
|
||||
tools = {
|
||||
inlay_hints = { auto = true, highlight = "InlayHint" },
|
||||
hover_actions = { border = "none" },
|
||||
},
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
init = function ()
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
capabilites = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
on_attach = set_lsp_binds,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = { command = "clippy" },
|
||||
}
|
||||
}
|
||||
},
|
||||
dap = { adapter = require('dap').adapters.lldb },
|
||||
})
|
||||
rust_tools.inlay_hints.enable()
|
||||
|
||||
end
|
||||
}
|
||||
end,
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue