Skip to content

Commit

Permalink
plugins/haskell-scope-highlighting: init + test
Browse files Browse the repository at this point in the history
Add warning for Treesitter dependency

Co-authored-by: Gaétan Lepage <33058747+GaetanLepage@users.noreply.github.com>

add test for highlights, add package

tweak warning message

enable treesitter in tests

suggested change
  • Loading branch information
garaiza-93 authored and GaetanLepage committed Jan 29, 2024
1 parent 43f3cb7 commit 3958364
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

./languages/clangd-extensions.nix
./languages/debugprint.nix
./languages/haskell-scope-highlighting.nix
./languages/julia/julia-cell.nix
./languages/lean.nix
./languages/ledger.nix
Expand All @@ -61,15 +62,15 @@
./languages/tagbar.nix
./languages/treesitter/hmts.nix
./languages/treesitter/rainbow-delimiters.nix
./languages/treesitter/treesitter.nix
./languages/treesitter/treesitter-context.nix
./languages/treesitter/treesitter-playground.nix
./languages/treesitter/treesitter-refactor.nix
./languages/treesitter/treesitter-textobjects.nix
./languages/treesitter/treesitter.nix
./languages/treesitter/ts-autotag.nix
./languages/treesitter/ts-context-commentstring.nix
./languages/typst/typst-vim.nix
./languages/typescript-tools.nix
./languages/typst/typst-vim.nix
./languages/vim-slime.nix
./languages/vimtex.nix
./languages/zig.nix
Expand Down
24 changes: 24 additions & 0 deletions plugins/languages/haskell-scope-highlighting.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
lib,
pkgs,
helpers,
config,
...
}:
with lib; let
cfg = config.plugins.haskell-scope-highlighting;
in {
options.plugins.haskell-scope-highlighting = {
enable = mkEnableOption "haskell-scope-highlighting";

package = helpers.mkPackageOption "haskell-scope-highlighting" pkgs.vimPlugins.haskell-scope-highlighting-nvim;
};

config = mkIf cfg.enable {
warnings = optional (!config.plugins.treesitter.enable) ''
Nixvim (plugins.haskell-scope-highlighting): haskell-scope-highlighting needs treesitter to function as intended. Please, enable it by setting `plugins.treesitter.enable` to `true`.
'';

extraPlugins = [cfg.package];
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
empty = {
plugins.haskell-scope-highlighting.enable = true;
plugins.treesitter.enable = true;
};

testHaskellHighlights = {
plugins.haskell-scope-highlighting.enable = true;
plugins.treesitter.enable = true;
highlight = {
HaskellCurrentScope.bg = "black";
HaskellParentScope1.bg = "black";
HaskellParentScope2.bg = "black";
HaskellParentScope3.bg = "black";
HaskellVariableDeclarationWithinScope.bg = "black";
HaskellVariableDeclaredWithinFile.bg = "black";
HaskellVariableDeclaredWithinParent1.bg = "black";
HaskellVariableDeclaredWithinParent2.bg = "black";
HaskellVariableDeclaredWithinParent3.bg = "black";
HaskellVariableDeclaredWithinScope.bg = "black";
HaskellVariableNotDeclaredWithinFile.bg = "black";
};
};
}

0 comments on commit 3958364

Please sign in to comment.