Added inlay hints for lua and changed mappings
This commit is contained in:
@@ -32,6 +32,12 @@ return {
|
|||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
|
hint = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = { "vim" },
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.keymap.set("n", "<leader>vca", function()
|
vim.keymap.set("n", "<leader>vca", function()
|
||||||
vim.lsp.buf.code_action()
|
vim.lsp.buf.code_action()
|
||||||
end, opts("Get code actions"))
|
end, opts("Get code actions"))
|
||||||
vim.keymap.set("n", "<leader>vrn", function()
|
vim.keymap.set("n", "<leader>vr", function()
|
||||||
vim.lsp.buf.rename()
|
vim.lsp.buf.rename()
|
||||||
end, opts("Rename symbol"))
|
end, opts("Rename symbol"))
|
||||||
vim.keymap.set("n", "<leader>vih", function()
|
vim.keymap.set("n", "<leader>vh", function()
|
||||||
if vim.fn.has("nvim-0.10.0") == 0 then
|
if vim.fn.has("nvim-0.10.0") == 0 then
|
||||||
vim.notify("Inlay hints are only available in Neovim 0.10.0 and above", vim.log.levels.ERROR)
|
vim.notify("Inlay hints are only available in Neovim 0.10.0 and above", vim.log.levels.ERROR)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if client.server_capabilities.inlayHintProvider then
|
if client.server_capabilities.inlayHintProvider then
|
||||||
local current_state = vim.lsp.inlay_hint.is_enabled(bufnr)
|
local current_state = vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr })
|
||||||
vim.lsp.inlay_hint.enable(bufnr, not current_state)
|
vim.lsp.inlay_hint.enable(not current_state, { bufnr = bufnr })
|
||||||
end
|
end
|
||||||
end, opts("Toggle inlay hints"))
|
end, opts("Toggle inlay hints"))
|
||||||
vim.keymap.set("n", "[d", function()
|
vim.keymap.set("n", "[d", function()
|
||||||
|
|||||||
Reference in New Issue
Block a user