neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

lsp-inlayhints.lua (682B)


      1 if not pcall(require, 'lsp-inlayhints') then
      2   return
      3 end
      4 
      5 do
      6   return
      7 end
      8 
      9 local lspih = require('lsp-inlayhints')
     10 lspih.setup({ inlay_hints = { only_current_line = true } })
     11 
     12 local group = vim.api.nvim_create_augroup('user-inlayhints', {})
     13 
     14 vim.api.nvim_create_autocmd('LspAttach', {
     15   group = group,
     16   callback = function(args)
     17     if not (args.data and args.data.client_id) then
     18       return
     19     end
     20 
     21     local buf = args.buf
     22     local client = vim.lsp.get_client_by_id(args.data.client_id)
     23     lspih.on_attach(client, buf)
     24 
     25     vim.keymap.set('n', '<leader>gh', require('lsp-inlayhints').toggle,
     26                    { silent = true, desc = 'LSP Inlay Hints Toggle' })
     27   end,
     28 })