Skip to content

Commit 5790779

Browse files
GaetanLepagenixvim-ci[bot]
authored andcommitted
plugins/quarto: fix by enforcing enabling otter when settings.codeRunner is enabled
See quarto-dev/quarto-nvim#187
1 parent b7e64b2 commit 5790779

File tree

3 files changed

+54
-26
lines changed

3 files changed

+54
-26
lines changed

plugins/by-name/otter/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ lib.nixvim.plugins.mkNeovimPlugin {
1212

1313
maintainers = [ lib.maintainers.HeitorAugustoLN ];
1414

15+
# `require("otter").setup()` must run **BEFORE** quarto
16+
# https://github.com/quarto-dev/quarto-nvim/issues/187
17+
configLocation = lib.mkOrder 900 "extraConfigLua";
18+
1519
imports = [
1620
# TODO: introduced 2024-06-29; remove after 24.11
1721
(lib.mkRemovedOptionModule

plugins/by-name/quarto/default.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, pkgs, ... }:
1+
{ lib, config, ... }:
22
let
33
inherit (lib.nixvim) defaultNullOpts;
44
inherit (lib) types;
@@ -99,4 +99,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
9999
default_method = "vim-slime";
100100
};
101101
};
102+
103+
extraConfig = cfg: {
104+
assertions = lib.nixvim.mkAssertions "plugins.quarto" {
105+
assertion = (cfg.settings.codeRunner.enable or false) -> config.plugins.otter.enable;
106+
message = ''
107+
Quarto requires `plugins.quarto` to be enabled when `settings.codeRunner.enable` is true.
108+
'';
109+
};
110+
};
102111
}

tests/test-sources/plugins/by-name/quarto/default.nix

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
empty = {
3-
plugins.quarto.enable = true;
3+
plugins = {
4+
quarto.enable = true;
5+
otter.enable = true;
6+
treesitter = {
7+
enable = true;
8+
settings.highlight.enable = true;
9+
};
10+
};
411
};
512

613
defaults = {
@@ -39,36 +46,44 @@
3946
};
4047

4148
example = {
42-
plugins.quarto = {
43-
enable = true;
49+
plugins = {
50+
otter.enable = true;
51+
treesitter = {
52+
enable = true;
53+
settings.highlight.enable = true;
54+
};
4455

45-
settings = {
46-
debug = true;
47-
closePreviewOnExit = false;
48-
lspFeatures = {
49-
enabled = true;
50-
chunks = "curly";
51-
languages = [
52-
"r"
53-
"python"
54-
"julia"
55-
];
56-
diagnostics = {
56+
quarto = {
57+
enable = true;
58+
59+
settings = {
60+
debug = true;
61+
closePreviewOnExit = false;
62+
lspFeatures = {
5763
enabled = true;
58-
triggers = [ "BufWritePost" ];
64+
chunks = "curly";
65+
languages = [
66+
"r"
67+
"python"
68+
"julia"
69+
];
70+
diagnostics = {
71+
enabled = true;
72+
triggers = [ "BufWritePost" ];
73+
};
74+
completion = {
75+
enabled = true;
76+
};
5977
};
60-
completion = {
78+
codeRunner = {
6179
enabled = true;
80+
default_method = "molten";
81+
ft_runners = {
82+
python = "molten";
83+
};
84+
never_run = [ "yaml" ];
6285
};
6386
};
64-
codeRunner = {
65-
enabled = true;
66-
default_method = "molten";
67-
ft_runners = {
68-
python = "molten";
69-
};
70-
never_run = [ "yaml" ];
71-
};
7287
};
7388
};
7489
};

0 commit comments

Comments
 (0)