Replies: 5 comments 14 replies
-
Beta Was this translation helpful? Give feedback.
-
As far as I can tell, |
Beta Was this translation helpful? Give feedback.
-
Snacks.picker.treesitter {
title = 'Headings',
filter = { markdown = true },
transform = function(item)
item.text = vim.split(item.text, '\n')[1]
item.name = item.text
end,
} ; after/queries/markdown/locals.scm
[
(section
(atx_heading)
(section)
)
] @local.scope
(atx_heading (atx_h1_marker)) @local.definition.h1
(atx_heading (atx_h2_marker)) @local.definition.h2
(atx_heading (atx_h3_marker)) @local.definition.h3
(atx_heading (atx_h4_marker)) @local.definition.h4
(atx_heading (atx_h5_marker)) @local.definition.h5
(atx_heading (atx_h6_marker)) @local.definition.h6 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm pretty sure #2124 is invalid. You need a custom local query for Treesitter to recognize the header nodes. I don't believe it's Snacks' responsibility to provide that. It's the responsibility of the corresponding Treesitter parser. And if you think the local query should be included, then that sets a precedent for other situations where some user would like to do something that requires a local query as well. Snacks is not supposed to provide local queries. The treesitter picker only requests information from Treesitter itself, which does the parsing according to the queries of each language and returns the results to Snacks and then Snacks just transforms the results into items data structure that is compatible with Snacks pickers. That is just my personal opinion. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
:lua Snacks.picker.treesitter()
does not work it saysNo results found for treesitter
but treesitter is enabled for markdown files and the highlighting is working. Do I have to set something? I want to use the treesitter picker to show all markdown headings.Beta Was this translation helpful? Give feedback.
All reactions