mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
plugins/lsp: add inlay-hint option
`onAttach` code is based on [this comment](https://github.com/lvimuser/lsp-inlayhints.nvim/issues/46#issuecomment-1949916683). Documented upstream at [`:h lsp-inlay_hint`](https://neovim.io/doc/user/lsp.html#lsp-inlay_hint)
This commit is contained in:
parent
70088f6f89
commit
4a22c35e6d
2 changed files with 16 additions and 0 deletions
|
@ -112,6 +112,12 @@ in
|
|||
visible = false;
|
||||
};
|
||||
|
||||
inlayHints = mkEnableOption ''
|
||||
LSP inlay-hints. Only affects language servers with inlay-hints support.
|
||||
|
||||
See [`:h lsp-inlay_hint`](https://neovim.io/doc/user/lsp.html#lsp-inlay_hint).
|
||||
'';
|
||||
|
||||
onAttach = mkOption {
|
||||
type = types.lines;
|
||||
description = "A lua function to be run when a new LSP buffer is attached. The argument `client` and `bufnr` is provided.";
|
||||
|
@ -196,6 +202,15 @@ in
|
|||
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||
++ cfg.keymaps.extra;
|
||||
|
||||
# Enable inlay-hints
|
||||
plugins.lsp.onAttach = mkIf cfg.inlayHints ''
|
||||
-- LSP Inlay Hints {{{
|
||||
if client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
end
|
||||
-- }}}
|
||||
'';
|
||||
|
||||
# Enable all LSP servers
|
||||
extraConfigLua = ''
|
||||
-- LSP {{{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
example = {
|
||||
plugins.lsp = {
|
||||
enable = true;
|
||||
inlayHints = true;
|
||||
|
||||
keymaps = {
|
||||
silent = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue