plugins/lsp: use new lsp module to implement plugins.lsp.inlayHints (two-way alias)
Some checks are pending
Publish every Git push to main to FlakeHub / flakehub-publish (push) Waiting to run
Publish every git push to Flakestry / publish-flake (push) Waiting to run
Documentation / Version info (push) Waiting to run
Documentation / Build (push) Blocked by required conditions
Documentation / Combine builds (push) Blocked by required conditions
Documentation / Deploy (push) Blocked by required conditions

This commit is contained in:
Gaetan Lepage 2025-07-25 18:51:01 +02:00 committed by Gaétan Lepage
parent dff79d34f8
commit 3d09c8eace

View file

@ -108,6 +108,9 @@ lib.nixvim.plugins.mkNeovimPlugin {
See [`:h lsp-inlay_hint`](https://neovim.io/doc/user/lsp.html#lsp-inlay_hint).
'';
# When `plugins.lsp` is enabled, definitions are aliased to `lsp.inlayHints.enable`; so read that final value here.
# The other half of this two-way alias is below in `extraConfig`.
apply = value: if config.plugins.lsp.enable then config.lsp.inlayHints.enable else value;
};
onAttach = mkOption {
@ -177,7 +180,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
++ mkMaps "vim.lsp.buf." "Lsp buf" cfg.keymaps.lspBuf
++ cfg.keymaps.extra;
# Alias onAttach definitions to the new impl in the top-level lsp module.
# Alias onAttach and inlayHints definitions to the new impl in the top-level lsp module.
#
# NOTE: While `mkDerivedConfig` creates an alias based on the final `value` and `highestPrio`,
# `mkAliasAndWrapDefinitions` and `mkAliasAndWrapDefsWithPriority` propagates the un-merged
@ -190,7 +193,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
# This is equivalent to `mkAliasOptionModule`, except predicated on `plugins.lsp.enable`.
#
# The other half of this two-way alias is above in the option's `apply` function.
lsp.onAttach = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.onAttach;
lsp = {
onAttach = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.onAttach;
inlayHints.enable = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opts.inlayHints;
};
plugins.lsp.luaConfig.content =
let
@ -203,9 +209,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
do
${cfg.preConfig}
-- inlay hint
${lib.optionalString cfg.inlayHints "vim.lsp.inlay_hint.enable(true)"}
local __lspServers = ${lib.nixvim.toLuaObject cfg.enabledServers}
local __lspCapabilities = function()