mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 01:38:54 +02:00
feat: added support for the new builtin inlay hints
Enable with: ```lua {"neovim/nvim-lspconfig", opts = {inlay_hints = {enabled = true}}} ```
This commit is contained in:
parent
428bdf768f
commit
01c7eeebd0
2 changed files with 17 additions and 0 deletions
|
@ -112,6 +112,9 @@ map("n", "<leader>ul", function() Util.toggle("relativenumber", true) Util.toggl
|
||||||
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
map("n", "<leader>ud", Util.toggle_diagnostics, { desc = "Toggle Diagnostics" })
|
||||||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||||
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||||
|
if vim.lsp.buf.inlay_hint then
|
||||||
|
map("n", "<leader>uh", function() vim.lsp.buf.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||||
|
end
|
||||||
|
|
||||||
-- lazygit
|
-- lazygit
|
||||||
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
map("n", "<leader>gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" })
|
||||||
|
|
|
@ -31,6 +31,12 @@ return {
|
||||||
},
|
},
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
},
|
},
|
||||||
|
-- Enable this to enable the builtin LSP inlay hints on Neovim >= 0.10.0
|
||||||
|
-- Be aware that you also will need to properly configure your LSP server to
|
||||||
|
-- provide the inlay hints.
|
||||||
|
inlay_hints = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
-- add any global capabilities here
|
-- add any global capabilities here
|
||||||
capabilities = {},
|
capabilities = {},
|
||||||
-- Automatically format on save
|
-- Automatically format on save
|
||||||
|
@ -92,6 +98,14 @@ return {
|
||||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.inlay_hints.enabled and vim.lsp.buf.inlay_hint then
|
||||||
|
Util.on_attach(function(client, buffer)
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.buf.inlay_hint(buffer, true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||||
or function(diagnostic)
|
or function(diagnostic)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue