diff --git a/modules/plugins/lsp/nvim-docs-view/config.nix b/modules/plugins/lsp/nvim-docs-view/config.nix index d7dc837e..8ddf80f1 100644 --- a/modules/plugins/lsp/nvim-docs-view/config.nix +++ b/modules/plugins/lsp/nvim-docs-view/config.nix @@ -4,7 +4,6 @@ ... }: let inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge; - inherit (builtins) toString; cfg = config.vim.lsp.nvim-docs-view; self = import ./nvim-docs-view.nix {inherit lib;}; @@ -18,12 +17,7 @@ in { startPlugins = ["nvim-docs-view"]; luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere '' - require("docs-view").setup { - position = "${cfg.position}", - width = ${toString cfg.width}, - height = ${toString cfg.height}, - update_mode = "${cfg.updateMode}", - } + require("docs-view").setup ${nvim.lua.expToLua cfg.setupOpts} ''; maps.normal = mkMerge [ diff --git a/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix b/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix index 808613e4..255239c9 100644 --- a/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix +++ b/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix @@ -1,41 +1,55 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption types mkMappingOption; + inherit (lib) mkEnableOption mkOption types mkMappingOption mkRenamedOptionModule; in { options.vim.lsp.nvim-docs-view = { enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel."; - position = mkOption { - type = types.enum ["left" "right" "top" "bottom"]; - default = "right"; - description = '' - Where to open the docs view panel - ''; - }; + imports = let + renamedSetupOption = oldPath: newPath: + mkRenamedOptionModule + (["vim" "lsp" "nvim-docs-view"] ++ oldPath) + (["vim" "lsp" "nvim-docs-view" "setupOpts"] ++ newPath); + in [ + (renamedSetupOption ["position"] ["position"]) + (renamedSetupOption ["width"] ["width"]) + (renamedSetupOption ["height"] ["height"]) + (renamedSetupOption ["updateMode"] ["update_mode"]) + ]; - height = mkOption { - type = types.int; - default = 10; - description = '' - Height of the docs view panel if the position is set to either top or bottom - ''; - }; + setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" { + position = mkOption { + type = types.enum ["left" "right" "top" "bottom"]; + default = "right"; + description = '' + Where to open the docs view panel + ''; + }; - width = mkOption { - type = types.int; - default = 60; - description = '' - Width of the docs view panel if the position is set to either left or right - ''; - }; + height = mkOption { + type = types.int; + default = 10; + description = '' + Height of the docs view panel if the position is set to either top or bottom + ''; + }; - updateMode = mkOption { - type = types.enum ["auto" "manual"]; - default = "auto"; - description = '' - Determines the mechanism used to update the docs view panel content. - - If auto, the content will update upon cursor move. - - If manual, the content will only update once :DocsViewUpdate is called - ''; + width = mkOption { + type = types.int; + default = 60; + description = '' + Width of the docs view panel if the position is set to either left or right + ''; + }; + + update_mode = mkOption { + type = types.enum ["auto" "manual"]; + default = "auto"; + description = '' + Determines the mechanism used to update the docs view panel content. + - If auto, the content will update upon cursor move. + - If manual, the content will only update once :DocsViewUpdate is called + ''; + }; }; mappings = {