mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 11:55:22 +00:00
languages/tera: add injection
This commit is contained in:
parent
56db4e1cbd
commit
fbb27a80c5
2 changed files with 28 additions and 4 deletions
|
|
@ -278,7 +278,10 @@
|
||||||
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
- Added {option}`vim.treesitter.queries` to support adding custom queries.
|
||||||
|
|
||||||
- Added injections for `vim.treesitter.queries.*.content` as `query` and
|
- Added injections for `vim.treesitter.queries.*.content` as `query` and
|
||||||
`mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua`.
|
`mkLualine`, `entryAnywhere`, `entryBefore`, `entryAfter` as `lua` in nix.
|
||||||
|
|
||||||
|
- Added {option}`vim.languages.tera.treesitter.injection` to configure, what
|
||||||
|
language the content is.
|
||||||
|
|
||||||
- Added `vim.lsp.presets.<name>` to contain LSP configurations. This allows for
|
- Added `vim.lsp.presets.<name>` to contain LSP configurations. This allows for
|
||||||
more flexibility in nvf and reuse of LSPs across languages. Dropped
|
more flexibility in nvf and reuse of LSPs across languages. Dropped
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
inherit (lib) genAttrs;
|
inherit (lib) genAttrs;
|
||||||
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
inherit (lib.options) mkEnableOption literalExpression mkOption;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum listOf;
|
inherit (lib.types) enum listOf str;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption;
|
||||||
|
|
||||||
cfg = config.vim.languages.tera;
|
cfg = config.vim.languages.tera;
|
||||||
|
|
@ -26,6 +26,11 @@ in {
|
||||||
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
defaultText = literalExpression "config.vim.languages.enableTreesitter";
|
||||||
};
|
};
|
||||||
package = mkGrammarOption pkgs "tera";
|
package = mkGrammarOption pkgs "tera";
|
||||||
|
injection = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "html";
|
||||||
|
description = "Treesitter language to inject in Tera templates";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
|
|
@ -45,8 +50,24 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
(mkIf cfg.treesitter.enable {
|
(mkIf cfg.treesitter.enable {
|
||||||
vim.treesitter.enable = true;
|
vim.treesitter = {
|
||||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
enable = true;
|
||||||
|
grammars = [cfg.treesitter.package];
|
||||||
|
queries = [
|
||||||
|
{
|
||||||
|
type = "injections";
|
||||||
|
filetypes = ["tera"];
|
||||||
|
content = ''
|
||||||
|
;; extends
|
||||||
|
|
||||||
|
((content) @injection.content
|
||||||
|
(#set! injection.language "${cfg.treesitter.injection}")
|
||||||
|
(#set! injection.combined)
|
||||||
|
)
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue