mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-03-30 18:01:52 +00:00
lsp/lspsaga: convert setupOpts format
This commit is contained in:
parent
bc978c4fad
commit
0367f490ba
3 changed files with 24 additions and 12 deletions
|
@ -66,6 +66,9 @@
|
|||
- Add [snacks.nvim] under `vim.utility.snacks-nvim` as a general-purpose utility
|
||||
plugin.
|
||||
|
||||
- Move LSPSaga to `setupOpts` format, allowing freeform configuration in
|
||||
`vim.lsp.lspsaga.setupOpts`.
|
||||
|
||||
[amadaluzia](https://github.com/amadaluzia):
|
||||
|
||||
[haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp;
|
||||
self = import ./lspsaga.nix {inherit lib;};
|
||||
self = import ./lspsaga.nix {inherit config lib;};
|
||||
|
||||
mappingDefinitions = self.options.vim.lsp.lspsaga.mappings;
|
||||
mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions;
|
||||
|
@ -18,6 +18,10 @@ in {
|
|||
vim = {
|
||||
startPlugins = ["lspsaga-nvim"];
|
||||
|
||||
pluginRC.lspsaga = entryAnywhere ''
|
||||
require('lspsaga').init_lsp_saga(${toLuaObject cfg.lspsaga.setupOpts})
|
||||
'';
|
||||
|
||||
maps = {
|
||||
visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action";
|
||||
normal = mkMerge [
|
||||
|
@ -40,14 +44,6 @@ in {
|
|||
(mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help"))
|
||||
];
|
||||
};
|
||||
|
||||
pluginRC.lspsaga = entryAnywhere ''
|
||||
require('lspsaga').init_lsp_saga({
|
||||
${optionalString config.vim.ui.borders.plugins.lspsaga.enable ''
|
||||
border_style = '${config.vim.ui.borders.plugins.lspsaga.style}',
|
||||
''}
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) borderType mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.lsp.lspsaga = {
|
||||
enable = mkEnableOption "LSP Saga";
|
||||
|
||||
setupOpts = mkPluginSetupOption "lspsaga" {
|
||||
border_style = mkOption {
|
||||
type = borderType;
|
||||
default = config.vim.ui.borders.globalStyle;
|
||||
description = "Border type, see {command}`:help nvim_open_win`";
|
||||
};
|
||||
};
|
||||
|
||||
mappings = {
|
||||
lspFinder = mkMappingOption "LSP Finder [LSPSaga]" "<leader>lf";
|
||||
renderHoveredDoc = mkMappingOption "Rendered hovered docs [LSPSaga]" "<leader>lh";
|
||||
|
|
Loading…
Add table
Reference in a new issue