diff --git a/plugins/by-name/otter/default.nix b/plugins/by-name/otter/default.nix index fd841b83..34feed28 100644 --- a/plugins/by-name/otter/default.nix +++ b/plugins/by-name/otter/default.nix @@ -12,6 +12,10 @@ lib.nixvim.plugins.mkNeovimPlugin { maintainers = [ lib.maintainers.HeitorAugustoLN ]; + # `require("otter").setup()` must run **BEFORE** quarto + # https://github.com/quarto-dev/quarto-nvim/issues/187 + configLocation = lib.mkOrder 900 "extraConfigLua"; + imports = [ # TODO: introduced 2024-06-29; remove after 24.11 (lib.mkRemovedOptionModule diff --git a/plugins/by-name/quarto/default.nix b/plugins/by-name/quarto/default.nix index 50413eae..77c628d0 100644 --- a/plugins/by-name/quarto/default.nix +++ b/plugins/by-name/quarto/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, config, ... }: let inherit (lib.nixvim) defaultNullOpts; inherit (lib) types; @@ -99,4 +99,13 @@ lib.nixvim.plugins.mkNeovimPlugin { default_method = "vim-slime"; }; }; + + extraConfig = cfg: { + assertions = lib.nixvim.mkAssertions "plugins.quarto" { + assertion = (cfg.settings.codeRunner.enable or false) -> config.plugins.otter.enable; + message = '' + Quarto requires `plugins.otter` to be enabled when `settings.codeRunner.enable` is true. + ''; + }; + }; } diff --git a/tests/test-sources/plugins/by-name/quarto/default.nix b/tests/test-sources/plugins/by-name/quarto/default.nix index 45d036d1..d28c1837 100644 --- a/tests/test-sources/plugins/by-name/quarto/default.nix +++ b/tests/test-sources/plugins/by-name/quarto/default.nix @@ -1,6 +1,13 @@ { empty = { - plugins.quarto.enable = true; + plugins = { + quarto.enable = true; + otter.enable = true; + treesitter = { + enable = true; + settings.highlight.enable = true; + }; + }; }; defaults = { @@ -39,36 +46,44 @@ }; example = { - plugins.quarto = { - enable = true; + plugins = { + otter.enable = true; + treesitter = { + enable = true; + settings.highlight.enable = true; + }; - settings = { - debug = true; - closePreviewOnExit = false; - lspFeatures = { - enabled = true; - chunks = "curly"; - languages = [ - "r" - "python" - "julia" - ]; - diagnostics = { + quarto = { + enable = true; + + settings = { + debug = true; + closePreviewOnExit = false; + lspFeatures = { enabled = true; - triggers = [ "BufWritePost" ]; + chunks = "curly"; + languages = [ + "r" + "python" + "julia" + ]; + diagnostics = { + enabled = true; + triggers = [ "BufWritePost" ]; + }; + completion = { + enabled = true; + }; }; - completion = { + codeRunner = { enabled = true; + default_method = "molten"; + ft_runners = { + python = "molten"; + }; + never_run = [ "yaml" ]; }; }; - codeRunner = { - enabled = true; - default_method = "molten"; - ft_runners = { - python = "molten"; - }; - never_run = [ "yaml" ]; - }; }; }; };