From 379231b43d4a4f6b39b897adb8e9ab85d7ca52f8 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sat, 17 Feb 2024 15:41:09 +0100 Subject: [PATCH] feat(lsp-signature): custom setup --- modules/lsp/lsp-signature/config.nix | 16 +++++++--------- modules/lsp/lsp-signature/lsp-signature.nix | 3 ++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/lsp/lsp-signature/config.nix b/modules/lsp/lsp-signature/config.nix index 5b231bd..c194912 100644 --- a/modules/lsp/lsp-signature/config.nix +++ b/modules/lsp/lsp-signature/config.nix @@ -5,7 +5,7 @@ }: let inherit (lib.modules) mkIf; inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.strings) optionalString; + inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.lsp; in { @@ -15,16 +15,14 @@ in { "lsp-signature" ]; + lsp.lspSignature.setupOpts = { + bind = config.vim.ui.borders.plugins.lsp-signature.enable; + handler_opts.border = config.vim.ui.borders.plugins.lsp-signature.style; + }; + luaConfigRC.lsp-signature = entryAnywhere '' -- Enable lsp signature viewer - require("lsp_signature").setup({ - ${optionalString config.vim.ui.borders.plugins.lsp-signature.enable '' - bind = true, -- This is mandatory, otherwise border config won't get registered. - handler_opts = { - border = "${config.vim.ui.borders.plugins.lsp-signature.style}" - } - ''} - }) + require("lsp_signature").setup(${toLuaObject cfg.lspSignature.setupOpts}) ''; }; }; diff --git a/modules/lsp/lsp-signature/lsp-signature.nix b/modules/lsp/lsp-signature/lsp-signature.nix index 981526b..be7b6cd 100644 --- a/modules/lsp/lsp-signature/lsp-signature.nix +++ b/modules/lsp/lsp-signature/lsp-signature.nix @@ -3,7 +3,8 @@ in { options.vim.lsp = { lspSignature = { - enable = mkEnableOption "lsp signature viewer [lsp-signature]"; + enable = mkEnableOption "lsp signature viewer"; + setupOpts = lib.nvim.types.mkPluginSetupOption "lsp-signature" {}; }; }; }