Closed GustavoJCL closed 1 year ago
How does such a file look like?
this is how look the rust file, i'm trying to add html support for this macro
You'll need a TS query where either one capture called @_lang
captures the name of a language and @content
captures the content or where the name of the capture is the name of a language (e.g. @html
). You can find examples for both in this query:
https://github.com/quarto-dev/quarto-nvim/blob/14a80ffab90567e360eb97b19039c4c16913ad79/lua/quarto/init.lua#L125-L138
tsquery = [[
(fenced_code_block
(info_string
(language) @_lang
) @info
(#match? @info "{")
(code_fence_content) @content (#offset! @content)
)
((html_block) @html @combined)
((minus_metadata) @yaml (#offset! @yaml 1 0 -1 0))
((plus_metadata) @toml (#offset! @toml 1 0 -1 0)
]]
Or define a query that creates an injection and it can work without passing an additional query.
hi, i try to config this plugin for add support for add lsp features to the html macro, i try to follow the config i found in quarto-nvim but it didn't work, this is the config:
{ "jmbuhr/otter.nvim", opts = function(_, opts) local rsquery = [[ (macro_invocation name: (indentifier) @name (#eq? @name "html") (token_tree (ERROR) @html_macro ) ) ]] local otter = require("otter") otter.activate( { "html" }, { true }, { true }, rsquery ) end },