Skip to content

language/nix: add treesitter queries for nvf idioms - #781

Draft
horriblename wants to merge 3 commits into
NotAShelf:mainfrom
horriblename:nvf-inject
Draft

language/nix: add treesitter queries for nvf idioms#781
horriblename wants to merge 3 commits into
NotAShelf:mainfrom
horriblename:nvf-inject

Conversation

@horriblename

@horriblename horriblename commented Apr 3, 2025

Copy link
Copy Markdown
Collaborator

todo: unsure if the current approach works robustly - our query has the same level of priority as nvim-treesitter in terms of rtp ordering, does this guarantee that ours will be loaded along with nvim-ts's or do we need to prepend ours in rtp?

github-actions Bot pushed a commit that referenced this pull request Apr 3, 2025
@github-actions

github-actions Bot commented Apr 3, 2025

Copy link
Copy Markdown

🚀 Live preview deployed from 029ca6d

View it here:

Debug Information

Triggered by: snoweuph

HEAD at: nvf-inject

Reruns: 2647

@snoweuph

snoweuph commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

this brings back up the discussion whether we include queries in nvf or not.

If it were me, I would prefer having an API like vim.queries.<name>.injections

examples:

{
    cfg.gotmpl.injection = "html";
    vim.queries.gotmpl.injections = mkSCMInline ''
      ;; extends
      ((text) @injection.content
	      (#set! injection.language "${cfg.gotmpl.injection}")
	      (#set! injection.combined)
      )
    '';
}
{
    cfg.tera.injection = "markdown";
    vim.queries.gotmpl.injections = mkSCMInline ''
      ;; extends
      ((content) @injection.content
	      (#set! injection.language "${cfg.tera.injection}")
	      (#set! injection.combined)
      )
    '';
}

@snoweuph snoweuph added the TBD More discussion and research is in order label Apr 16, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 16, 2026
@NotAShelf

Copy link
Copy Markdown
Owner

What would be the purpose of mkSCMInline? SCM is just a string in the eyes of Nix, unlike Lua which gets interpolated.

@snoweuph

Copy link
Copy Markdown
Collaborator

What would be the purpose of mkSCMInline? SCM is just a string in the eyes of Nix, unlike Lua which gets interpolated.

was just a thinking. then just make it a string, and when adding it, add lua and scm injections to NVF so I dont have to add lang comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TBD More discussion and research is in order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants