From 6915c3f7644da6cd233df90700f6e49620eb910a Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 20 Sep 2024 14:29:07 +0200 Subject: [PATCH 01/18] r: implementing lsp --- configuration.nix | 1 + modules/plugins/languages/default.nix | 1 + modules/plugins/languages/r.nix | 82 +++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 modules/plugins/languages/r.nix diff --git a/configuration.nix b/configuration.nix index b0c613b..954e811 100644 --- a/configuration.nix +++ b/configuration.nix @@ -60,6 +60,7 @@ isMaximal: { python.enable = isMaximal; dart.enable = isMaximal; bash.enable = isMaximal; + r.enable = isMaximal; tailwind.enable = isMaximal; typst.enable = isMaximal; clang = { diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index e86a521..28c1fd8 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -17,6 +17,7 @@ in { ./ocaml.nix ./php.nix ./python.nix + ./r.nix ./rust.nix ./sql.nix ./svelte.nix diff --git a/modules/plugins/languages/r.nix b/modules/plugins/languages/r.nix new file mode 100644 index 0000000..6b9be04 --- /dev/null +++ b/modules/plugins/languages/r.nix @@ -0,0 +1,82 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (builtins) attrNames; + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.meta) getExe; + inherit (lib.modules) mkIf mkMerge; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str bool; + inherit (lib.nvim.lua) expToLua; + + cfg = config.vim.languages.r; + + r-with-languageserver = pkgs.rWrapper.override { + packages = with pkgs.rPackages; [languageserver]; + }; + + defaultServer = "r_language_server"; + servers = { + r_language_server = { + package = pkgs.writeShellScriptBin "r_lsp" '' + ${r-with-languageserver}/bin/R --slave -e "languageserver::run()" + ''; + lspConfig = '' + lspconfig.r_language_server.setup{ + capabilities = capabilities; + on_attach = default_on_attach; + cmd = ${ + if isList cfg.lsp.package + then expToLua cfg.lsp.package + else ''{"${lib.getExe cfg.lsp.package}"}'' + } + } + ''; + }; + }; +in { + options.vim.languages.r = { + enable = mkEnableOption "R language support"; + + treesitter = { + enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;}; + package = mkOption { + description = "R treesitter grammar to use"; + type = package; + default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.r; + }; + }; + + lsp = { + enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;}; + + server = mkOption { + description = "R LSP server to use"; + type = enum (attrNames servers); + default = defaultServer; + }; + + package = mkOption { + description = "R LSP server package, or the command to run as a list of strings"; + example = literalExpression "[ (lib.getExe pkgs.jdt-language-server) \"-data\" \"~/.cache/jdtls/workspace\" ]"; + type = either package (listOf str); + default = servers.${cfg.lsp.server}.package; + }; + }; + }; + + config = mkIf cfg.enable (mkMerge [ + (mkIf cfg.treesitter.enable { + vim.treesitter.enable = true; + vim.treesitter.grammars = [cfg.treesitter.package]; + }) + + (mkIf cfg.lsp.enable { + vim.lsp.lspconfig.enable = true; + vim.lsp.lspconfig.sources.r-lsp = servers.${cfg.lsp.server}.lspConfig; + }) + ]); +} From ae90ed1706c4999c28544516af950bb145124084 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Tue, 24 Sep 2024 12:21:30 +0200 Subject: [PATCH 02/18] r: version bump to context fixes treesitter bug --- flake.lock | 6 +++--- modules/plugins/languages/r.nix | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 377c084..9e11e8c 100644 --- a/flake.lock +++ b/flake.lock @@ -1280,11 +1280,11 @@ "plugin-nvim-treesitter-context": { "flake": false, "locked": { - "lastModified": 1716388265, - "narHash": "sha256-EY5Si6t7LXcxOP3ubGAAMd3lgbeaCOCIybSKi1Ucx98=", + "lastModified": 1726947805, + "narHash": "sha256-5oN/vyhSqDqjLEzECj01A7A+Yq7U1H1HXLbzkC1Ljqw=", "owner": "nvim-treesitter", "repo": "nvim-treesitter-context", - "rev": "f62bfe19e0fbc13ae95649dfb3cf22f4ff85b683", + "rev": "3d5390c49e3f8fe457b376df2a49aa39d75b7911", "type": "github" }, "original": { diff --git a/modules/plugins/languages/r.nix b/modules/plugins/languages/r.nix index 6b9be04..7ad1680 100644 --- a/modules/plugins/languages/r.nix +++ b/modules/plugins/languages/r.nix @@ -6,10 +6,9 @@ }: let inherit (builtins) attrNames; inherit (lib.options) mkEnableOption mkOption literalExpression; - inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; inherit (lib.lists) isList; - inherit (lib.types) enum either listOf package str bool; + inherit (lib.types) enum either listOf package str; inherit (lib.nvim.lua) expToLua; cfg = config.vim.languages.r; From 42d7294a5e8e78453bed89d4658df44e80292bab Mon Sep 17 00:00:00 2001 From: Soliprem Date: Tue, 24 Sep 2024 12:34:56 +0200 Subject: [PATCH 03/18] r: changing treesitter package definition to mkGrammarOption --- modules/plugins/languages/r.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/plugins/languages/r.nix b/modules/plugins/languages/r.nix index 7ad1680..27d7c99 100644 --- a/modules/plugins/languages/r.nix +++ b/modules/plugins/languages/r.nix @@ -10,6 +10,7 @@ inherit (lib.lists) isList; inherit (lib.types) enum either listOf package str; inherit (lib.nvim.lua) expToLua; + inherit (lib.nvim.types) mkGrammarOption; cfg = config.vim.languages.r; @@ -42,11 +43,7 @@ in { treesitter = { enable = mkEnableOption "R treesitter" // {default = config.vim.languages.enableTreesitter;}; - package = mkOption { - description = "R treesitter grammar to use"; - type = package; - default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.r; - }; + package = mkGrammarOption pkgs "r"; }; lsp = { From 27c045bc9debc899b66723643682981b086aad88 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Tue, 24 Sep 2024 12:59:42 +0200 Subject: [PATCH 04/18] added changelog entry --- docs/release-notes/rl-0.7.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index cf250e0..efb2da9 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -108,6 +108,7 @@ everyone. plugin's options can now be found under `indentBlankline.setupOpts`, the previous iteration of the module also included out of place/broken options, which have been removed for the time being. These are: + - `listChar` - this was already unused - `fillChar` - this had nothing to do with the plugin, please configure it yourself by adding `vim.opt.listchars:append({ space = '' })` to your @@ -191,3 +192,9 @@ everyone. - Telescope: - Fixed `project-nvim` command and keybinding - Added default ikeybind/command for `Telescope resume` (`fr`) + +[Soliprem](https://github.com/Soliprem) + +- R: + - Added LSP + - Added Treesitter From 3275ab221a65558dda947d6bbe579d50693113e2 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 09:27:58 +0200 Subject: [PATCH 05/18] created otter file --- modules/plugins/lsp/otter/config.nix | 21 +++++++++++++++++++++ modules/plugins/lsp/otter/default.nix | 9 +++++++++ 2 files changed, 30 insertions(+) create mode 100644 modules/plugins/lsp/otter/config.nix create mode 100644 modules/plugins/lsp/otter/default.nix diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix new file mode 100644 index 0000000..8857d32 --- /dev/null +++ b/modules/plugins/lsp/otter/config.nix @@ -0,0 +1,21 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + + cfg = config.vim.lsp; +in { + config = mkIf (cfg.enable && cfg.otter.enable) { + vim = { + startPlugins = ["otter"]; + + pluginRC.trouble = entryAnywhere '' + -- Enable Otter + require("otter").setup {} + ''; + }; + }; +} diff --git a/modules/plugins/lsp/otter/default.nix b/modules/plugins/lsp/otter/default.nix new file mode 100644 index 0000000..1432d8c --- /dev/null +++ b/modules/plugins/lsp/otter/default.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; +in { + options.vim.lsp = { + otter = { + enable = mkEnableOption "trouble lsp for markup languages"; + }; + }; +} From d61aba1e122a2e2540c286b94701340ff459384d Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 09:46:30 +0200 Subject: [PATCH 06/18] created otter file --- modules/plugins/lsp/otter/config.nix | 15 ++++++++++++--- modules/plugins/lsp/otter/default.nix | 13 +++++-------- modules/plugins/lsp/otter/otter.nix | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 modules/plugins/lsp/otter/otter.nix diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index 8857d32..3025d45 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -3,17 +3,26 @@ lib, ... }: let - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; cfg = config.vim.lsp; + + self = import ./otter.nix {inherit lib;}; + mappingDefinitions = self.options.vim.lsp.otter.mappings; + mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.otter.enable) { vim = { startPlugins = ["otter"]; - pluginRC.trouble = entryAnywhere '' - -- Enable Otter + maps.normal = mkMerge [ + (mkSetBinding mappings.toggle "lua require'otter'.activate()") + ]; + + pluginRC.otter = entryAnywhere '' + -- Enable otter diagnostics viewer require("otter").setup {} ''; }; diff --git a/modules/plugins/lsp/otter/default.nix b/modules/plugins/lsp/otter/default.nix index 1432d8c..935f144 100644 --- a/modules/plugins/lsp/otter/default.nix +++ b/modules/plugins/lsp/otter/default.nix @@ -1,9 +1,6 @@ -{lib, ...}: let - inherit (lib.options) mkEnableOption; -in { - options.vim.lsp = { - otter = { - enable = mkEnableOption "trouble lsp for markup languages"; - }; - }; +{ + imports = [ + ./otter.nix + ./config.nix + ]; } diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix new file mode 100644 index 0000000..a352da7 --- /dev/null +++ b/modules/plugins/lsp/otter/otter.nix @@ -0,0 +1,14 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; +in { + options.vim.lsp = { + trouble = { + enable = mkEnableOption "Otter LSP Injector"; + + mappings = { + toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "oa"; + }; + }; + }; +} From 06a296a32b98286113d673716793fe86cceb65d6 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 09:55:03 +0200 Subject: [PATCH 07/18] update --- configuration.nix | 1 + modules/plugins/lsp/default.nix | 1 + modules/plugins/lsp/otter/otter.nix | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configuration.nix b/configuration.nix index 08b0f9b..26fbd7e 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,6 +19,7 @@ isMaximal: { lspsaga.enable = false; trouble.enable = true; lspSignature.enable = true; + otter.enable = isMaximal; lsplines.enable = isMaximal; nvim-docs-view.enable = isMaximal; }; diff --git a/modules/plugins/lsp/default.nix b/modules/plugins/lsp/default.nix index a5d5163..421f5fd 100644 --- a/modules/plugins/lsp/default.nix +++ b/modules/plugins/lsp/default.nix @@ -13,6 +13,7 @@ ./trouble ./lsp-signature ./lightbulb + ./otter ./lspkind ./lsplines ./nvim-docs-view diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix index a352da7..e8222e6 100644 --- a/modules/plugins/lsp/otter/otter.nix +++ b/modules/plugins/lsp/otter/otter.nix @@ -3,7 +3,7 @@ inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp = { - trouble = { + otter = { enable = mkEnableOption "Otter LSP Injector"; mappings = { From 4f151d63bee77ce07b5d522b0b4b961d119aafd8 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 10:09:43 +0200 Subject: [PATCH 08/18] update --- flake.lock | 13 +++++++++++++ flake.nix | 5 +++++ modules/plugins/lsp/otter/config.nix | 2 +- modules/plugins/lsp/otter/otter.nix | 1 - 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index 9e11e8c..6042a26 100644 --- a/flake.lock +++ b/flake.lock @@ -1373,6 +1373,18 @@ "type": "github" } }, + "plugin-otter": { + "flake": false, + "locked": { + "narHash": "sha256-BvEhaaP13ZVfzdMcmEii8QbVBZnUMZNrBcyCF0vyiW4=", + "type": "file", + "url": "https://github.com/jmbuhr/otter.nvim" + }, + "original": { + "type": "file", + "url": "https://github.com/jmbuhr/otter.nvim" + } + }, "plugin-oxocarbon": { "flake": false, "locked": { @@ -1861,6 +1873,7 @@ "plugin-obsidian-nvim": "plugin-obsidian-nvim", "plugin-onedark": "plugin-onedark", "plugin-orgmode-nvim": "plugin-orgmode-nvim", + "plugin-otter": "plugin-otter", "plugin-oxocarbon": "plugin-oxocarbon", "plugin-plenary-nvim": "plugin-plenary-nvim", "plugin-project-nvim": "plugin-project-nvim", diff --git a/flake.nix b/flake.nix index c4996fc..c819a94 100644 --- a/flake.nix +++ b/flake.nix @@ -156,6 +156,11 @@ flake = false; }; + plugin-otter = { + url = "https://github.com/jmbuhr/otter.nvim"; + flake = false; + }; + # Language support plugin-sqls-nvim = { url = "github:nanotee/sqls.nvim"; diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index 3025d45..4c1a569 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -23,7 +23,7 @@ in { pluginRC.otter = entryAnywhere '' -- Enable otter diagnostics viewer - require("otter").setup {} + require("otter-nvim").setup() ''; }; }; diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix index e8222e6..2fd6a0e 100644 --- a/modules/plugins/lsp/otter/otter.nix +++ b/modules/plugins/lsp/otter/otter.nix @@ -5,7 +5,6 @@ in { options.vim.lsp = { otter = { enable = mkEnableOption "Otter LSP Injector"; - mappings = { toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "oa"; }; From 66c173748e14b1a9599a4296dd71e18812ac6638 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 10:32:07 +0200 Subject: [PATCH 09/18] otter: fixing fixing input --- flake.lock | 18 +++++++++++------- flake.nix | 4 ++-- modules/plugins/lsp/otter/config.nix | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 6042a26..310562a 100644 --- a/flake.lock +++ b/flake.lock @@ -1373,16 +1373,20 @@ "type": "github" } }, - "plugin-otter": { + "plugin-otter-nvim": { "flake": false, "locked": { - "narHash": "sha256-BvEhaaP13ZVfzdMcmEii8QbVBZnUMZNrBcyCF0vyiW4=", - "type": "file", - "url": "https://github.com/jmbuhr/otter.nvim" + "lastModified": 1724585935, + "narHash": "sha256-euHwoK2WHLF/hrjLY2P4yGrIbYyBN38FL3q4CKNZmLY=", + "owner": "jmbuhr", + "repo": "otter.nvim", + "rev": "ca9ce67d0399380b659923381b58d174344c9ee7", + "type": "github" }, "original": { - "type": "file", - "url": "https://github.com/jmbuhr/otter.nvim" + "owner": "jmbuhr", + "repo": "otter.nvim", + "type": "github" } }, "plugin-oxocarbon": { @@ -1873,7 +1877,7 @@ "plugin-obsidian-nvim": "plugin-obsidian-nvim", "plugin-onedark": "plugin-onedark", "plugin-orgmode-nvim": "plugin-orgmode-nvim", - "plugin-otter": "plugin-otter", + "plugin-otter-nvim": "plugin-otter-nvim", "plugin-oxocarbon": "plugin-oxocarbon", "plugin-plenary-nvim": "plugin-plenary-nvim", "plugin-project-nvim": "plugin-project-nvim", diff --git a/flake.nix b/flake.nix index c819a94..4813481 100644 --- a/flake.nix +++ b/flake.nix @@ -156,8 +156,8 @@ flake = false; }; - plugin-otter = { - url = "https://github.com/jmbuhr/otter.nvim"; + plugin-otter-nvim = { + url = "github:jmbuhr/otter.nvim"; flake = false; }; diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index 4c1a569..fa1f740 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -15,7 +15,7 @@ in { config = mkIf (cfg.enable && cfg.otter.enable) { vim = { - startPlugins = ["otter"]; + startPlugins = ["otter-nvim"]; maps.normal = mkMerge [ (mkSetBinding mappings.toggle "lua require'otter'.activate()") @@ -23,7 +23,7 @@ in { pluginRC.otter = entryAnywhere '' -- Enable otter diagnostics viewer - require("otter-nvim").setup() + require("otter").setup() ''; }; }; From 19ae4946a2f36a18d6f2964b609bd121fcbab60f Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 11:35:39 +0200 Subject: [PATCH 10/18] committing flake.lock --- modules/plugins/lsp/otter/otter.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix index 2fd6a0e..109e64c 100644 --- a/modules/plugins/lsp/otter/otter.nix +++ b/modules/plugins/lsp/otter/otter.nix @@ -6,7 +6,7 @@ in { otter = { enable = mkEnableOption "Otter LSP Injector"; mappings = { - toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "oa"; + toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "lo"; }; }; }; From e12c9adec946f7de74394bf74cc39c180238accc Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 14:16:43 +0200 Subject: [PATCH 11/18] fixed typo --- modules/plugins/languages/ts.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index e6e718e..5ceccec 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -226,7 +226,7 @@ in { { assertion = cfg.lsp.enable -> cfg.lsp.server != "tsserver"; message = '' - As of a recent lspconfig update, he `tsserver` configuration has been renamed + As of a recent lspconfig update, the `tsserver` configuration has been renamed to `ts_ls` to match upstream behaviour of `lspconfig`, and the name `tsserver` is no longer considered valid by nvf. Please set `vim.languages.ts.lsp.server` to `"ts_ls"` instead of to `${cfg.lsp.server}` From 51710d33c6fadf1d18290ec595f4f09d7275eff1 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 16:20:04 +0200 Subject: [PATCH 12/18] configuration: disabling ccc and enabling otter --- configuration.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration.nix b/configuration.nix index 26fbd7e..79df786 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,7 +19,7 @@ isMaximal: { lspsaga.enable = false; trouble.enable = true; lspSignature.enable = true; - otter.enable = isMaximal; + otter.enable = true; lsplines.enable = isMaximal; nvim-docs-view.enable = isMaximal; }; @@ -156,7 +156,7 @@ isMaximal: { }; utility = { - ccc.enable = isMaximal; + ccc.enable = false; vim-wakatime.enable = false; icon-picker.enable = isMaximal; surround.enable = isMaximal; From d8d834be355a7f3c0af35dc076789093116586ce Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 16:20:49 +0200 Subject: [PATCH 13/18] added assertion to make sure ccc and otter aren't enabled at the same time --- modules/plugins/lsp/otter/config.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index fa1f740..8c4d0b7 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -14,6 +14,14 @@ mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.otter.enable) { + assertions = [ + { + assertion = !config.vim.utility.ccc.enable; + message = '' + ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them + ''; + } + ]; vim = { startPlugins = ["otter-nvim"]; From 5bbc68f5e9c66b6b6522372f7cdc32e29c34ad8f Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 16:27:40 +0200 Subject: [PATCH 14/18] configuration: otter set for isMaximal --- configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration.nix b/configuration.nix index 79df786..6fd10c0 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,7 +19,7 @@ isMaximal: { lspsaga.enable = false; trouble.enable = true; lspSignature.enable = true; - otter.enable = true; + otter.enable = isMaximal; lsplines.enable = isMaximal; nvim-docs-view.enable = isMaximal; }; From cf8764ff96e22a3bda9da5e9281569130f723cfd Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 16:37:38 +0200 Subject: [PATCH 15/18] otter: changelog --- docs/release-notes/rl-0.7.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index efb2da9..73061ec 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -198,3 +198,6 @@ everyone. - R: - Added LSP - Added Treesitter +- Otter: + - Added support + - Configured assert to prevent conflict with ccc From c5c026a18559adfe2108253a7db3b61112bfecba Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 16:43:04 +0200 Subject: [PATCH 16/18] otter: better changelog --- docs/release-notes/rl-0.7.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 73061ec..4a0d282 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -195,9 +195,6 @@ everyone. [Soliprem](https://github.com/Soliprem) -- R: - - Added LSP - - Added Treesitter -- Otter: - - Added support - - Configured assert to prevent conflict with ccc +- Add LSP and Treesitter support for R under `vim.languages.R`. +- Add Otter support under `vim.lsp.otter` and an assert to prevent conflict with + ccc From c8b0039285759c669f1a867c6c411e567b27844b Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 20:21:17 +0200 Subject: [PATCH 17/18] otter-nvim: renamed from otter to otter-nvim --- configuration.nix | 2 +- modules/plugins/lsp/otter/config.nix | 8 ++++---- modules/plugins/lsp/otter/otter.nix | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/configuration.nix b/configuration.nix index 6fd10c0..b21b26a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,7 +19,7 @@ isMaximal: { lspsaga.enable = false; trouble.enable = true; lspSignature.enable = true; - otter.enable = isMaximal; + otter-nvim.enable = isMaximal; lsplines.enable = isMaximal; nvim-docs-view.enable = isMaximal; }; diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index 8c4d0b7..ee942e1 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -10,10 +10,10 @@ cfg = config.vim.lsp; self = import ./otter.nix {inherit lib;}; - mappingDefinitions = self.options.vim.lsp.otter.mappings; - mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions; + mappingDefinitions = self.options.vim.lsp.otter-nvim.mappings; + mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions; in { - config = mkIf (cfg.enable && cfg.otter.enable) { + config = mkIf (cfg.enable && cfg.otter-nvim.enable) { assertions = [ { assertion = !config.vim.utility.ccc.enable; @@ -29,7 +29,7 @@ in { (mkSetBinding mappings.toggle "lua require'otter'.activate()") ]; - pluginRC.otter = entryAnywhere '' + pluginRC.otter-nvim = entryAnywhere '' -- Enable otter diagnostics viewer require("otter").setup() ''; diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix index 109e64c..7d47322 100644 --- a/modules/plugins/lsp/otter/otter.nix +++ b/modules/plugins/lsp/otter/otter.nix @@ -3,10 +3,10 @@ inherit (lib.nvim.binds) mkMappingOption; in { options.vim.lsp = { - otter = { + otter-nvim = { enable = mkEnableOption "Otter LSP Injector"; mappings = { - toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "lo"; + toggle = mkMappingOption "Activate LSP on Cursor Position [otter-nvim]" "lo"; }; }; }; From 1545fa0517836b2807cc06a07ebdcec6a6a2a428 Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 21:31:39 +0200 Subject: [PATCH 18/18] otter: added setupopts --- modules/plugins/lsp/otter/config.nix | 3 +- modules/plugins/lsp/otter/otter.nix | 55 +++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index ee942e1..e5df92f 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -5,6 +5,7 @@ }: let inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; cfg = config.vim.lsp; @@ -31,7 +32,7 @@ in { pluginRC.otter-nvim = entryAnywhere '' -- Enable otter diagnostics viewer - require("otter").setup() + require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}}) ''; }; }; diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix index 7d47322..79797aa 100644 --- a/modules/plugins/lsp/otter/otter.nix +++ b/modules/plugins/lsp/otter/otter.nix @@ -1,13 +1,64 @@ {lib, ...}: let - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption mkEnableOption; inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.types) bool str listOf; + inherit (lib.nvim.types) mkPluginSetupOption; in { options.vim.lsp = { otter-nvim = { - enable = mkEnableOption "Otter LSP Injector"; + enable = mkEnableOption '' + lsp features and a code completion source for code embedded in other documents [otter-nvim] + ''; mappings = { toggle = mkMappingOption "Activate LSP on Cursor Position [otter-nvim]" "lo"; }; + setupOpts = mkPluginSetupOption "otter.nvim" { + lsp = { + diagnostic_update_event = mkOption { + type = listOf str; + default = ["BufWritePost"]; + description = '' + `:h events` that cause the diagnostic to update. + Set to: {"BufWritePost", "InsertLeave", "TextChanged" } + for less performant but more instant diagnostic updates + ''; + }; + }; + buffers = { + set_filetype = mkOption { + type = bool; + default = false; + description = '' + if set to true, the filetype of the otterbuffers will be set. Other wide only + the autocommand of lspconfig that attaches the language server will be + executed without stting the filetype + ''; + }; + write_to_disk = mkOption { + type = bool; + default = false; + description = '' + write .otter. files to disk on save of main buffer. + Useful for some linters that require actual files. + Otter files are deleted on quit or main buffer close + ''; + }; + }; + strip_wrapping_quote_characters = mkOption { + type = listOf str; + default = ["'" ''"'' "`"]; + description = '' + ''; + }; + handle_leading_whitespace = mkOption { + type = bool; + default = false; + description = '' + otter may not work the way you expect when entire code blocks are indented + (eg. in Org files) When true, otter handles these cases fully. + ''; + }; + }; }; }; }