diff --git a/plugins/lsp/default.nix b/plugins/lsp/default.nix index 406f288c..25616c76 100644 --- a/plugins/lsp/default.nix +++ b/plugins/lsp/default.nix @@ -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 {{{ diff --git a/tests/test-sources/plugins/lsp/_lsp.nix b/tests/test-sources/plugins/lsp/_lsp.nix index 06ede9d0..2ed31d50 100644 --- a/tests/test-sources/plugins/lsp/_lsp.nix +++ b/tests/test-sources/plugins/lsp/_lsp.nix @@ -7,6 +7,7 @@ example = { plugins.lsp = { enable = true; + inlayHints = true; keymaps = { silent = true;