feat: add configuration for inlay hints

This commit is contained in:
Sven Vogel 2024-11-08 18:06:24 +01:00
parent 3159d83be7
commit 9c8afc73b4
2 changed files with 11 additions and 2 deletions

View File

@ -40,4 +40,5 @@ opt.smartindent = true
-- disable netrw -- disable netrw
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.g.inlay_hints_visible = true

View File

@ -11,8 +11,8 @@
-- --
-- ============================================== -- ==============================================
ui = require 'config.ui' local ui = require 'config.ui'
icons = require 'config.icons' local icons = require 'config.icons'
return { return {
{ {
@ -64,6 +64,14 @@ return {
function(server_name) -- default handler (optional) function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({ require("lspconfig")[server_name].setup({
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
-- optionally enable inlay hints
-- Source: https://www.reddit.com/r/neovim/comments/14em0f8/how_to_use_the_new_lsp_inlay_hints/
-- ..............................................
if client.server_capabilities.inlayHintProvider and opts.inlay_hints.enabled then
vim.lsp.inlay_hint.enable(true, { bufnr })
end
end end
}) })
end, end,