new: Temporarily add plugin for inlay hints until nvim 0.10

This commit is contained in:
Sayantan Santra 2024-04-18 18:15:51 -05:00
parent 3c24bf7ba2
commit dedbea9eb3
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
3 changed files with 18 additions and 0 deletions

View file

@ -56,6 +56,7 @@ require("lazy").setup(
"mrcjkb/rustaceanvim",
version = "^4",
ft = { "rust" },
dependencies = { "lvimuser/lsp-inlayhints.nvim" },
},
-- Automatically add bracket pairs
"windwp/nvim-autopairs",

View file

@ -24,5 +24,19 @@ vim.api.nvim_create_autocmd("LspAttach", {
callback = function()
map('n', '<localleader>k', vim.lsp.buf.hover, { remap = false })
map('n', '<localleader>a', vim.lsp.buf.code_action, { remap = false })
map('n', '<localleader>d', vim.diagnostic.open_float, { remap = false })
end,
})
-- Enable inlay hints (needs rework after nvim>=0.10)
vim.api.nvim_create_autocmd("LspAttach", {
pattern = "*.rs",
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, bufnr)
end,
})

View file

@ -11,3 +11,6 @@ require("log-highlight").setup()
-- Load UltiSnips snippets from custom-snippets directory
vim.g.UltiSnipsSnippetDirectories = { "my-snippets", "UltiSnips" }
-- Load default settings for inlay hints plugin (won't need it for nvim>=0.10)
require("lsp-inlayhints").setup()