mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	modules/lsp: switch to explicit lib calls
This commit is contained in:
		
					parent
					
						
							
								dfc7c6737f
							
						
					
				
			
			
				commit
				
					
						c488f0490f
					
				
			
		
					 33 changed files with 285 additions and 273 deletions
				
			
		|  | @ -15,99 +15,102 @@ | ||||||
|   mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})"; |   mkBinding = binding: action: "vim.api.nvim_buf_set_keymap(bufnr, 'n', '${binding.value}', '<cmd>lua ${action}<CR>', {noremap=true, silent=true, desc='${binding.description}'})"; | ||||||
| in { | in { | ||||||
|   config = mkIf cfg.enable { |   config = mkIf cfg.enable { | ||||||
|     vim.startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; |     vim = { | ||||||
|  |       startPlugins = optional usingNvimCmp "cmp-nvim-lsp"; | ||||||
| 
 | 
 | ||||||
|     vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";}; |       autocomplete.sources = {"nvim_lsp" = "[LSP]";}; | ||||||
|     vim.luaConfigRC.lsp-setup = '' |  | ||||||
|       vim.g.formatsave = ${boolToString cfg.formatOnSave}; |  | ||||||
| 
 | 
 | ||||||
|       local attach_keymaps = function(client, bufnr) |       luaConfigRC.lsp-setup = '' | ||||||
|         ${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"} |         vim.g.formatsave = ${boolToString cfg.formatOnSave}; | ||||||
|         ${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"} |  | ||||||
|         ${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"} |  | ||||||
|         ${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"} |  | ||||||
|         ${mkBinding mappings.listReferences "vim.lsp.buf.references()"} |  | ||||||
|         ${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"} |  | ||||||
|         ${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"} |  | ||||||
|         ${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"} |  | ||||||
|         ${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"} |  | ||||||
|         ${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"} |  | ||||||
|         ${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"} |  | ||||||
|         ${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"} |  | ||||||
|         ${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"} |  | ||||||
|         ${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"} |  | ||||||
|         ${mkBinding mappings.hover "vim.lsp.buf.hover()"} |  | ||||||
|         ${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"} |  | ||||||
|         ${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"} |  | ||||||
|         ${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"} |  | ||||||
|         ${mkBinding mappings.format "vim.lsp.buf.format()"} |  | ||||||
|         ${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"} |  | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       -- Enable formatting |         local attach_keymaps = function(client, bufnr) | ||||||
|       local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) |           ${mkBinding mappings.goToDeclaration "vim.lsp.buf.declaration()"} | ||||||
|  |           ${mkBinding mappings.goToDefinition "vim.lsp.buf.definition()"} | ||||||
|  |           ${mkBinding mappings.goToType "vim.lsp.buf.type_definition()"} | ||||||
|  |           ${mkBinding mappings.listImplementations "vim.lsp.buf.implementation()"} | ||||||
|  |           ${mkBinding mappings.listReferences "vim.lsp.buf.references()"} | ||||||
|  |           ${mkBinding mappings.nextDiagnostic "vim.diagnostic.goto_next()"} | ||||||
|  |           ${mkBinding mappings.previousDiagnostic "vim.diagnostic.goto_prev()"} | ||||||
|  |           ${mkBinding mappings.openDiagnosticFloat "vim.diagnostic.open_float()"} | ||||||
|  |           ${mkBinding mappings.documentHighlight "vim.lsp.buf.document_highlight()"} | ||||||
|  |           ${mkBinding mappings.listDocumentSymbols "vim.lsp.buf.document_symbol()"} | ||||||
|  |           ${mkBinding mappings.addWorkspaceFolder "vim.lsp.buf.add_workspace_folder()"} | ||||||
|  |           ${mkBinding mappings.removeWorkspaceFolder "vim.lsp.buf.remove_workspace_folder()"} | ||||||
|  |           ${mkBinding mappings.listWorkspaceFolders "print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"} | ||||||
|  |           ${mkBinding mappings.listWorkspaceSymbols "vim.lsp.buf.workspace_symbol()"} | ||||||
|  |           ${mkBinding mappings.hover "vim.lsp.buf.hover()"} | ||||||
|  |           ${mkBinding mappings.signatureHelp "vim.lsp.buf.signature_help()"} | ||||||
|  |           ${mkBinding mappings.renameSymbol "vim.lsp.buf.rename()"} | ||||||
|  |           ${mkBinding mappings.codeAction "vim.lsp.buf.code_action()"} | ||||||
|  |           ${mkBinding mappings.format "vim.lsp.buf.format()"} | ||||||
|  |           ${mkBinding mappings.toggleFormatOnSave "vim.b.disableFormatSave = not vim.b.disableFormatSave"} | ||||||
|  |         end | ||||||
| 
 | 
 | ||||||
|       format_callback = function(client, bufnr) |         -- Enable formatting | ||||||
|         if vim.g.formatsave then |         local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) | ||||||
|           vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) |  | ||||||
|           vim.api.nvim_create_autocmd("BufWritePre", { |  | ||||||
|             group = augroup, |  | ||||||
|             buffer = bufnr, |  | ||||||
|             callback = function() |  | ||||||
|               ${ |  | ||||||
|         if config.vim.lsp.null-ls.enable |  | ||||||
|         then '' |  | ||||||
|           if vim.b.disableFormatSave then |  | ||||||
|             return |  | ||||||
|           end |  | ||||||
| 
 | 
 | ||||||
|           local function is_null_ls_formatting_enabled(bufnr) |         format_callback = function(client, bufnr) | ||||||
|               local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype") |           if vim.g.formatsave then | ||||||
|               local generators = require("null-ls.generators").get_available( |             vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) | ||||||
|                   file_type, |             vim.api.nvim_create_autocmd("BufWritePre", { | ||||||
|                   require("null-ls.methods").internal.FORMATTING |               group = augroup, | ||||||
|               ) |               buffer = bufnr, | ||||||
|               return #generators > 0 |               callback = function() | ||||||
|           end |                 ${ | ||||||
|  |           if config.vim.lsp.null-ls.enable | ||||||
|  |           then '' | ||||||
|  |             if vim.b.disableFormatSave then | ||||||
|  |               return | ||||||
|  |             end | ||||||
| 
 | 
 | ||||||
|           if is_null_ls_formatting_enabled(bufnr) then |             local function is_null_ls_formatting_enabled(bufnr) | ||||||
|              vim.lsp.buf.format({ |                 local file_type = vim.api.nvim_buf_get_option(bufnr, "filetype") | ||||||
|                 bufnr = bufnr, |                 local generators = require("null-ls.generators").get_available( | ||||||
|                 filter = function(client) |                     file_type, | ||||||
|                   return client.name == "null-ls" |                     require("null-ls.methods").internal.FORMATTING | ||||||
|                 end |                 ) | ||||||
|               }) |                 return #generators > 0 | ||||||
|           else |             end | ||||||
|               vim.lsp.buf.format({ | 
 | ||||||
|                 bufnr = bufnr, |             if is_null_ls_formatting_enabled(bufnr) then | ||||||
|               }) |                vim.lsp.buf.format({ | ||||||
|           end |                   bufnr = bufnr, | ||||||
|         '' |                   filter = function(client) | ||||||
|         else " |                     return client.name == "null-ls" | ||||||
|  |                   end | ||||||
|  |                 }) | ||||||
|  |             else | ||||||
|  |                 vim.lsp.buf.format({ | ||||||
|  |                   bufnr = bufnr, | ||||||
|  |                 }) | ||||||
|  |             end | ||||||
|  |           '' | ||||||
|  |           else " | ||||||
|               vim.lsp.buf.format({ |               vim.lsp.buf.format({ | ||||||
|                 bufnr = bufnr, |                 bufnr = bufnr, | ||||||
|               }) |               }) | ||||||
|         " |         " | ||||||
|       } |         } | ||||||
|             end, |               end, | ||||||
|           }) |             }) | ||||||
|  |           end | ||||||
|         end |         end | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       ${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''} |         ${optionalString (config.vim.ui.breadcrumbs.enable) ''local navic = require("nvim-navic")''} | ||||||
|       default_on_attach = function(client, bufnr) |         default_on_attach = function(client, bufnr) | ||||||
|         attach_keymaps(client, bufnr) |           attach_keymaps(client, bufnr) | ||||||
|         format_callback(client, bufnr) |           format_callback(client, bufnr) | ||||||
|         ${optionalString (config.vim.ui.breadcrumbs.enable) '' |           ${optionalString (config.vim.ui.breadcrumbs.enable) '' | ||||||
|         -- let navic attach to buffers |           -- let navic attach to buffers | ||||||
|         if client.server_capabilities.documentSymbolProvider then |           if client.server_capabilities.documentSymbolProvider then | ||||||
|           navic.attach(client, bufnr) |             navic.attach(client, bufnr) | ||||||
|  |           end | ||||||
|  |         ''} | ||||||
|         end |         end | ||||||
|       ''} |  | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       local capabilities = vim.lsp.protocol.make_client_capabilities() |         local capabilities = vim.lsp.protocol.make_client_capabilities() | ||||||
|       ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} |         ${optionalString usingNvimCmp "capabilities = require('cmp_nvim_lsp').default_capabilities()"} | ||||||
|     ''; |       ''; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     # nvim lsp support |     # nvim lsp support | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -3,20 +3,21 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.lightbulb.enable) { |   config = mkIf (cfg.enable && cfg.lightbulb.enable) { | ||||||
|     vim.startPlugins = ["nvim-lightbulb"]; |     vim = { | ||||||
|  |       startPlugins = ["nvim-lightbulb"]; | ||||||
| 
 | 
 | ||||||
|     vim.configRC.lightbulb = nvim.dag.entryAnywhere '' |       luaConfigRC.lightbulb = entryAnywhere '' | ||||||
|       autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb() |         vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()') | ||||||
|     ''; |  | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.lightbulb = nvim.dag.entryAnywhere '' |         -- Enable trouble diagnostics viewer | ||||||
|       -- Enable trouble diagnostics viewer |         require'nvim-lightbulb'.setup() | ||||||
|       require'nvim-lightbulb'.setup() |       ''; | ||||||
|     ''; |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./lightbulb.nix |     ./lightbulb.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,9 +1,5 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   config, |   inherit (lib.options) mkEnableOption; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption; |  | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     lightbulb = { |     lightbulb = { | ||||||
|  |  | ||||||
|  | @ -3,25 +3,29 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim optionalString; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.strings) optionalString; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.lspSignature.enable) { |   config = mkIf (cfg.enable && cfg.lspSignature.enable) { | ||||||
|     vim.startPlugins = [ |     vim = { | ||||||
|       "lsp-signature" |       startPlugins = [ | ||||||
|     ]; |         "lsp-signature" | ||||||
|  |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere '' |       luaConfigRC.lsp-signature = entryAnywhere '' | ||||||
|       -- Enable lsp signature viewer |         -- Enable lsp signature viewer | ||||||
|       require("lsp_signature").setup({ |         require("lsp_signature").setup({ | ||||||
|         ${optionalString (config.vim.ui.borders.plugins.lsp-signature.enable) '' |           ${optionalString config.vim.ui.borders.plugins.lsp-signature.enable '' | ||||||
|         bind = true, -- This is mandatory, otherwise border config won't get registered. |           bind = true, -- This is mandatory, otherwise border config won't get registered. | ||||||
|         handler_opts = { |           handler_opts = { | ||||||
|           border = "${config.vim.ui.borders.plugins.lsp-signature.style}" |             border = "${config.vim.ui.borders.plugins.lsp-signature.style}" | ||||||
|         } |           } | ||||||
|       ''} |         ''} | ||||||
|       }) |         }) | ||||||
|     ''; |       ''; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./lsp-signature.nix |     ./lsp-signature.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,13 +1,9 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   config, |   inherit (lib.options) mkEnableOption; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption; |  | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     lspSignature = { |     lspSignature = { | ||||||
|       enable = mkEnableOption "lsp signature viewer"; |       enable = mkEnableOption "lsp signature viewer [lsp-signature]"; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,32 +1,35 @@ | ||||||
| { | { | ||||||
|   pkgs, |  | ||||||
|   config, |   config, | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf mkMerge nvim optionalString mapAttrs; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.strings) optionalString; | ||||||
|  |   inherit (lib.attrsets) mapAttrs; | ||||||
|  |   inherit (lib.nvim.dag) entryAfter; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| in { | in { | ||||||
|   config = mkIf cfg.lspconfig.enable (mkMerge [ |   config = mkIf cfg.lspconfig.enable (mkMerge [ | ||||||
|     { |     { | ||||||
|       vim.lsp.enable = true; |       vim = { | ||||||
|  |         lsp.enable = true; | ||||||
| 
 | 
 | ||||||
|       vim.startPlugins = ["nvim-lspconfig"]; |         startPlugins = ["nvim-lspconfig"]; | ||||||
| 
 | 
 | ||||||
|       vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' |         luaConfigRC.lspconfig = entryAfter ["lsp-setup"] '' | ||||||
|         local lspconfig = require('lspconfig') |           local lspconfig = require('lspconfig') | ||||||
| 
 | 
 | ||||||
|         ${ |           ${ | ||||||
|           # TODO: make border style configurable |             optionalString config.vim.ui.borders.enable '' | ||||||
|           optionalString (config.vim.ui.borders.enable) '' |               require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' | ||||||
|             require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' |             '' | ||||||
|           '' |           } | ||||||
|         } |         ''; | ||||||
|       ''; |       }; | ||||||
|     } |     } | ||||||
|     { |     { | ||||||
|       vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; |       vim.luaConfigRC = mapAttrs (_: v: (entryAfter ["lspconfig"] v)) cfg.lspconfig.sources; | ||||||
|     } |     } | ||||||
|   ]); |   ]); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./config.nix |     ./config.nix | ||||||
|     ./lspconfig.nix |     ./lspconfig.nix | ||||||
|  |  | ||||||
|  | @ -1,17 +1,13 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   pkgs, |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|   config, |   inherit (lib.types) attrsOf str; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption mkOption types; |  | ||||||
| in { | in { | ||||||
|   options.vim.lsp.lspconfig = { |   options.vim.lsp.lspconfig = { | ||||||
|     enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; |     enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; | ||||||
| 
 | 
 | ||||||
|     sources = mkOption { |     sources = mkOption { | ||||||
|       description = "nvim-lspconfig sources"; |       description = "nvim-lspconfig sources"; | ||||||
|       type = with types; attrsOf str; |       type = attrsOf str; | ||||||
|       default = {}; |       default = {}; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | @ -1,16 +1,16 @@ | ||||||
| { | { | ||||||
|   pkgs, |  | ||||||
|   config, |   config, | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.lspkind.enable) { |   config = mkIf (cfg.enable && cfg.lspkind.enable) { | ||||||
|     vim.startPlugins = ["lspkind"]; |     vim.startPlugins = ["lspkind"]; | ||||||
|     vim.luaConfigRC.lspkind = nvim.dag.entryAnywhere '' |     vim.luaConfigRC.lspkind = entryAnywhere '' | ||||||
|       local lspkind = require'lspkind' |       local lspkind = require'lspkind' | ||||||
|       local lspkind_opts = { |       local lspkind_opts = { | ||||||
|         mode = '${cfg.lspkind.mode}' |         mode = '${cfg.lspkind.mode}' | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./config.nix |     ./config.nix | ||||||
|     ./lspkind.nix |     ./lspkind.nix | ||||||
|  |  | ||||||
|  | @ -1,12 +1,6 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   pkgs, |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|   config, |   inherit (lib.types) enum; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption mkOption types; |  | ||||||
| 
 |  | ||||||
|   cfg = config.vim.lsp; |  | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     lspkind = { |     lspkind = { | ||||||
|  | @ -14,7 +8,7 @@ in { | ||||||
| 
 | 
 | ||||||
|       mode = mkOption { |       mode = mkOption { | ||||||
|         description = "Defines how annotations are shown"; |         description = "Defines how annotations are shown"; | ||||||
|         type = with types; enum ["text" "text_symbol" "symbol_text" "symbol"]; |         type = enum ["text" "text_symbol" "symbol_text" "symbol"]; | ||||||
|         default = "symbol_text"; |         default = "symbol_text"; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -3,13 +3,14 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAfter; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.lsplines.enable) { |   config = mkIf (cfg.enable && cfg.lsplines.enable) { | ||||||
|     vim.startPlugins = ["lsp-lines"]; |     vim.startPlugins = ["lsp-lines"]; | ||||||
|     vim.luaConfigRC.lsplines = nvim.dag.entryAfter ["lspconfig"] '' |     vim.luaConfigRC.lsplines = entryAfter ["lspconfig"] '' | ||||||
|       require("lsp_lines").setup() |       require("lsp_lines").setup() | ||||||
| 
 | 
 | ||||||
|       vim.diagnostic.config({ |       vim.diagnostic.config({ | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./config.nix |     ./config.nix | ||||||
|     ./lsplines.nix |     ./lsplines.nix | ||||||
|  |  | ||||||
|  | @ -1,9 +1,11 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption; |   inherit (lib.options) mkEnableOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     lsplines = { |     lsplines = { | ||||||
|       enable = mkEnableOption "diagnostics using virtual lines on top of the real line of code. [lsp_lines]"; |       enable = mkEnableOption '' | ||||||
|  |         diagnostics using virtual lines on top of the real line of code. [lsp_lines] | ||||||
|  |       ''; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,7 +3,10 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) addDescriptionsToMappings mkIf mkSetLuaBinding mkMerge nvim optionalString; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.strings) optionalString; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
|   self = import ./lspsaga.nix {inherit lib;}; |   self = import ./lspsaga.nix {inherit lib;}; | ||||||
|  | @ -12,38 +15,39 @@ | ||||||
|   mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions; |   mappings = addDescriptionsToMappings cfg.lspsaga.mappings mappingDefinitions; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.lspsaga.enable) { |   config = mkIf (cfg.enable && cfg.lspsaga.enable) { | ||||||
|     vim.startPlugins = ["lspsaga"]; |     vim = { | ||||||
|  |       startPlugins = ["lspsaga"]; | ||||||
| 
 | 
 | ||||||
|     vim.maps.visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action"; |       maps = { | ||||||
|  |         visual = mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').range_code_action"; | ||||||
|  |         normal = mkMerge [ | ||||||
|  |           (mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder") | ||||||
|  |           (mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc") | ||||||
| 
 | 
 | ||||||
|     vim.maps.normal = mkMerge [ |           (mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end") | ||||||
|       (mkSetLuaBinding mappings.lspFinder "require('lspsaga.provider').lsp_finder") |           (mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end") | ||||||
|       (mkSetLuaBinding mappings.renderHoveredDoc "require('lspsaga.hover').render_hover_doc") |  | ||||||
| 
 | 
 | ||||||
|       (mkSetLuaBinding mappings.smartScrollUp "function() require('lspsaga.action').smart_scroll_with_saga(-1) end") |           (mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename") | ||||||
|       (mkSetLuaBinding mappings.smartScrollDown "function() require('lspsaga.action').smart_scroll_with_saga(1) end") |           (mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition") | ||||||
| 
 | 
 | ||||||
|       (mkSetLuaBinding mappings.rename "require('lspsaga.rename').rename") |           (mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics") | ||||||
|       (mkSetLuaBinding mappings.previewDefinition "require('lspsaga.provider').preview_definition") |           (mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics") | ||||||
| 
 | 
 | ||||||
|       (mkSetLuaBinding mappings.showLineDiagnostics "require('lspsaga.diagnostic').show_line_diagnostics") |           (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") | ||||||
|       (mkSetLuaBinding mappings.showCursorDiagnostics "require('lspsaga.diagnostic').show_cursor_diagnostics") |           (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") | ||||||
| 
 | 
 | ||||||
|       (mkSetLuaBinding mappings.nextDiagnostic "require('lspsaga.diagnostic').navigate('next')") |           (mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")) | ||||||
|       (mkSetLuaBinding mappings.previousDiagnostic "require('lspsaga.diagnostic').navigate('prev')") |           (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
| 
 | 
 | ||||||
|       (mkIf (!cfg.nvimCodeActionMenu.enable) (mkSetLuaBinding mappings.codeAction "require('lspsaga.codeaction').code_action")) |       luaConfigRC.lspsaga = entryAnywhere '' | ||||||
|       (mkIf (!cfg.lspSignature.enable) (mkSetLuaBinding mappings.signatureHelp "require('lspsaga.signaturehelp').signature_help")) |         require('lspsaga').init_lsp_saga({ | ||||||
|     ]; |           ${optionalString config.vim.ui.borders.plugins.lspsaga.enable '' | ||||||
| 
 |           border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', | ||||||
|     vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' |         ''} | ||||||
|       -- Enable lspsaga |         }) | ||||||
|       local saga = require 'lspsaga' |       ''; | ||||||
|       saga.init_lsp_saga({ |     }; | ||||||
|         ${optionalString (config.vim.ui.borders.plugins.lspsaga.enable) '' |  | ||||||
|         border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', |  | ||||||
|       ''} |  | ||||||
|       }) |  | ||||||
|     ''; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./lspsaga.nix |     ./lspsaga.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkMappingOption; |   inherit (lib.options) mkEnableOption; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp.lspsaga = { |   options.vim.lsp.lspsaga = { | ||||||
|     enable = mkEnableOption "LSP Saga"; |     enable = mkEnableOption "LSP Saga"; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkMappingOption; |   inherit (lib.options) mkEnableOption; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; |     enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| { | { | ||||||
|   pkgs, |  | ||||||
|   config, |   config, | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
|  | @ -10,25 +9,28 @@ | ||||||
| in { | in { | ||||||
|   config = mkIf cfg.null-ls.enable (mkMerge [ |   config = mkIf cfg.null-ls.enable (mkMerge [ | ||||||
|     { |     { | ||||||
|       vim.lsp.enable = true; |       vim = { | ||||||
|       vim.startPlugins = ["none-ls"]; |         lsp.enable = true; | ||||||
|  |         startPlugins = ["none-ls"]; | ||||||
| 
 | 
 | ||||||
|       vim.luaConfigRC.null_ls-setup = nvim.dag.entryAnywhere '' |         luaConfigRC.null_ls-setup = nvim.dag.entryAnywhere '' | ||||||
|         local null_ls = require("null-ls") |           local null_ls = require("null-ls") | ||||||
|         local null_helpers = require("null-ls.helpers") |           local null_helpers = require("null-ls.helpers") | ||||||
|         local null_methods = require("null-ls.methods") |           local null_methods = require("null-ls.methods") | ||||||
|         local ls_sources = {} |           local ls_sources = {} | ||||||
|       ''; |         ''; | ||||||
|       vim.luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] '' | 
 | ||||||
|         require('null-ls').setup({ |         luaConfigRC.null_ls = nvim.dag.entryAfter ["null_ls-setup" "lsp-setup"] '' | ||||||
|           debug = false, |           require('null-ls').setup({ | ||||||
|           diagnostics_format = "[#{m}] #{s} (#{c})", |             debug = false, | ||||||
|           debounce = 250, |             diagnostics_format = "[#{m}] #{s} (#{c})", | ||||||
|           default_timeout = 5000, |             debounce = 250, | ||||||
|           sources = ls_sources, |             default_timeout = 5000, | ||||||
|           on_attach=default_on_attach |             sources = ls_sources, | ||||||
|         }) |             on_attach = default_on_attach | ||||||
|       ''; |           }) | ||||||
|  |         ''; | ||||||
|  |       }; | ||||||
|     } |     } | ||||||
|     { |     { | ||||||
|       vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources; |       vim.luaConfigRC = mapAttrs (_: v: (nvim.dag.entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources; | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./config.nix |     ./config.nix | ||||||
|     ./null-ls.nix |     ./null-ls.nix | ||||||
|  |  | ||||||
|  | @ -1,19 +1,13 @@ | ||||||
| { | {lib, ...}: let | ||||||
|   pkgs, |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|   config, |   inherit (lib.types) attrsOf str; | ||||||
|   lib, |  | ||||||
|   ... |  | ||||||
| }: let |  | ||||||
|   inherit (lib) mkEnableOption mkOption types; |  | ||||||
| 
 |  | ||||||
|   cfg = config.vim.lsp; |  | ||||||
| in { | in { | ||||||
|   options.vim.lsp.null-ls = { |   options.vim.lsp.null-ls = { | ||||||
|     enable = mkEnableOption "null-ls, also enabled automatically"; |     enable = mkEnableOption "null-ls, also enabled automatically"; | ||||||
| 
 | 
 | ||||||
|     sources = mkOption { |     sources = mkOption { | ||||||
|       description = "null-ls sources"; |       description = "null-ls sources"; | ||||||
|       type = with types; attrsOf str; |       type = attrsOf str; | ||||||
|       default = {}; |       default = {}; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | @ -3,32 +3,35 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim pushDownDefault; |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| 
 | 
 | ||||||
|   self = import ./nvim-code-action-menu.nix {inherit lib;}; |   self = import ./nvim-code-action-menu.nix {inherit lib;}; | ||||||
| 
 |  | ||||||
|   mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings; |   mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings; | ||||||
|   mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions; |   mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { |   config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { | ||||||
|     vim.startPlugins = ["nvim-code-action-menu"]; |     vim = { | ||||||
|  |       startPlugins = ["nvim-code-action-menu"]; | ||||||
| 
 | 
 | ||||||
|     vim.maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>"; |       maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>"; | ||||||
| 
 | 
 | ||||||
|     vim.binds.whichKey.register = pushDownDefault { |       binds.whichKey.register = pushDownDefault { | ||||||
|       "<leader>c" = "+CodeAction"; |         "<leader>c" = "+CodeAction"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       luaConfigRC.code-action-menu = entryAnywhere '' | ||||||
|  |         -- border configuration | ||||||
|  |         vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}' | ||||||
|  | 
 | ||||||
|  |         -- show individual sections of the code action menu | ||||||
|  |         ${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"} | ||||||
|  |         ${lib.optionalString cfg.nvimCodeActionMenu.show.diff "vim.g.code_action_menu_show_diff = true"} | ||||||
|  |         ${lib.optionalString cfg.nvimCodeActionMenu.show.actionKind "vim.g.code_action_menu_show_action_kind = true"} | ||||||
|  |       ''; | ||||||
|     }; |     }; | ||||||
| 
 |  | ||||||
|     vim.luaConfigRC.code-action-menu = nvim.dag.entryAnywhere '' |  | ||||||
|       -- border configuration |  | ||||||
|       vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}' |  | ||||||
| 
 |  | ||||||
|       -- show individual sections of the code action menu |  | ||||||
|       ${lib.optionalString (cfg.nvimCodeActionMenu.show.details) "vim.g.code_action_menu_show_details = true"} |  | ||||||
|       ${lib.optionalString (cfg.nvimCodeActionMenu.show.diff) "vim.g.code_action_menu_show_diff = true"} |  | ||||||
|       ${lib.optionalString (cfg.nvimCodeActionMenu.show.actionKind) "vim.g.code_action_menu_show_action_kind = true"} |  | ||||||
|     ''; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./nvim-code-action-menu.nix |     ./nvim-code-action-menu.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkMappingOption; |   inherit (lib.options) mkEnableOption; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     nvimCodeActionMenu = { |     nvimCodeActionMenu = { | ||||||
|  |  | ||||||
|  | @ -3,8 +3,10 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge; |  | ||||||
|   inherit (builtins) toString; |   inherit (builtins) toString; | ||||||
|  |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp.nvim-docs-view; |   cfg = config.vim.lsp.nvim-docs-view; | ||||||
|   self = import ./nvim-docs-view.nix {inherit lib;}; |   self = import ./nvim-docs-view.nix {inherit lib;}; | ||||||
|  | @ -17,7 +19,7 @@ in { | ||||||
|       lsp.enable = true; |       lsp.enable = true; | ||||||
|       startPlugins = ["nvim-docs-view"]; |       startPlugins = ["nvim-docs-view"]; | ||||||
| 
 | 
 | ||||||
|       luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere '' |       luaConfigRC.nvim-docs-view = entryAnywhere '' | ||||||
|         require("docs-view").setup { |         require("docs-view").setup { | ||||||
|           position = "${cfg.position}", |           position = "${cfg.position}", | ||||||
|           width = ${toString cfg.width}, |           width = ${toString cfg.width}, | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./config.nix |     ./config.nix | ||||||
|     ./nvim-docs-view.nix |     ./nvim-docs-view.nix | ||||||
|  |  | ||||||
|  | @ -1,11 +1,13 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkOption types mkMappingOption; |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|  |   inherit (lib.types) enum int; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp.nvim-docs-view = { |   options.vim.lsp.nvim-docs-view = { | ||||||
|     enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel."; |     enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel."; | ||||||
| 
 | 
 | ||||||
|     position = mkOption { |     position = mkOption { | ||||||
|       type = types.enum ["left" "right" "top" "bottom"]; |       type = enum ["left" "right" "top" "bottom"]; | ||||||
|       default = "right"; |       default = "right"; | ||||||
|       description = '' |       description = '' | ||||||
|         Where to open the docs view panel |         Where to open the docs view panel | ||||||
|  | @ -13,7 +15,7 @@ in { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     height = mkOption { |     height = mkOption { | ||||||
|       type = types.int; |       type = int; | ||||||
|       default = 10; |       default = 10; | ||||||
|       description = '' |       description = '' | ||||||
|         Height of the docs view panel if the position is set to either top or bottom |         Height of the docs view panel if the position is set to either top or bottom | ||||||
|  | @ -21,7 +23,7 @@ in { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     width = mkOption { |     width = mkOption { | ||||||
|       type = types.int; |       type = int; | ||||||
|       default = 60; |       default = 60; | ||||||
|       description = '' |       description = '' | ||||||
|         Width of the docs view panel if the position is set to either left or right |         Width of the docs view panel if the position is set to either left or right | ||||||
|  | @ -29,12 +31,14 @@ in { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     updateMode = mkOption { |     updateMode = mkOption { | ||||||
|       type = types.enum ["auto" "manual"]; |       type = enum ["auto" "manual"]; | ||||||
|       default = "auto"; |       default = "auto"; | ||||||
|       description = '' |       description = '' | ||||||
|         Determines the mechanism used to update the docs view panel content. |         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 |         Possible values: | ||||||
|  |         - auto: the content will update upon cursor move. | ||||||
|  |         - manual: the content will only update once :DocsViewUpdate is called | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,36 +3,39 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|   inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim pushDownDefault; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding pushDownDefault; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.lsp; |   cfg = config.vim.lsp; | ||||||
| 
 | 
 | ||||||
|   self = import ./trouble.nix {inherit lib;}; |   self = import ./trouble.nix {inherit lib;}; | ||||||
| 
 |  | ||||||
|   mappingDefinitions = self.options.vim.lsp.trouble.mappings; |   mappingDefinitions = self.options.vim.lsp.trouble.mappings; | ||||||
|   mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions; |   mappings = addDescriptionsToMappings cfg.trouble.mappings mappingDefinitions; | ||||||
| in { | in { | ||||||
|   config = mkIf (cfg.enable && cfg.trouble.enable) { |   config = mkIf (cfg.enable && cfg.trouble.enable) { | ||||||
|     vim.startPlugins = ["trouble"]; |     vim = { | ||||||
|  |       startPlugins = ["trouble"]; | ||||||
| 
 | 
 | ||||||
|     vim.maps.normal = mkMerge [ |       maps.normal = mkMerge [ | ||||||
|       (mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>") |         (mkSetBinding mappings.toggle "<cmd>TroubleToggle<CR>") | ||||||
|       (mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>") |         (mkSetBinding mappings.workspaceDiagnostics "<cmd>TroubleToggle workspace_diagnostics<CR>") | ||||||
|       (mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>") |         (mkSetBinding mappings.documentDiagnostics "<cmd>TroubleToggle document_diagnostics<CR>") | ||||||
|       (mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>") |         (mkSetBinding mappings.lspReferences "<cmd>TroubleToggle lsp_references<CR>") | ||||||
|       (mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>") |         (mkSetBinding mappings.quickfix "<cmd>TroubleToggle quickfix<CR>") | ||||||
|       (mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>") |         (mkSetBinding mappings.locList "<cmd>TroubleToggle loclist<CR>") | ||||||
|     ]; |       ]; | ||||||
| 
 | 
 | ||||||
|     vim.binds.whichKey.register = pushDownDefault { |       binds.whichKey.register = pushDownDefault { | ||||||
|       "<leader>l" = "Trouble"; |         "<leader>l" = "Trouble"; | ||||||
|       "<leader>x" = "+Trouble"; |         "<leader>x" = "+Trouble"; | ||||||
|       "<leader>lw" = "Workspace"; |         "<leader>lw" = "Workspace"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       luaConfigRC.trouble = entryAnywhere '' | ||||||
|  |         -- Enable trouble diagnostics viewer | ||||||
|  |         require("trouble").setup {} | ||||||
|  |       ''; | ||||||
|     }; |     }; | ||||||
| 
 |  | ||||||
|     vim.luaConfigRC.trouble = nvim.dag.entryAnywhere '' |  | ||||||
|       -- Enable trouble diagnostics viewer |  | ||||||
|       require("trouble").setup {} |  | ||||||
|     ''; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| _: { | { | ||||||
|   imports = [ |   imports = [ | ||||||
|     ./trouble.nix |     ./trouble.nix | ||||||
|     ./config.nix |     ./config.nix | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| {lib, ...}: let | {lib, ...}: let | ||||||
|   inherit (lib) mkEnableOption mkMappingOption; |   inherit (lib.options) mkEnableOption; | ||||||
|  |   inherit (lib.nvim.binds) mkMappingOption; | ||||||
| in { | in { | ||||||
|   options.vim.lsp = { |   options.vim.lsp = { | ||||||
|     trouble = { |     trouble = { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue