mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +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;
|
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 {
|
onAttach = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
description = "A lua function to be run when a new LSP buffer is attached. The argument `client` and `bufnr` is provided.";
|
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)
|
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||||
++ cfg.keymaps.extra;
|
++ 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
|
# Enable all LSP servers
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
-- LSP {{{
|
-- LSP {{{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
example = {
|
example = {
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
inlayHints = true;
|
||||||
|
|
||||||
keymaps = {
|
keymaps = {
|
||||||
silent = true;
|
silent = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue