I’m admittedly new to Scheme and running into a few issues when trying to create symbols. Right now I’m trying to create symbols for impl blocks (collection of methods) and here’s what I have for methods that don’t implement a trait (interface):
The main issue here is that " methods" isn’t appended to the displayed name. Is the append! predicate not allowed for display names and I should opt for a display name query?
Next up I have the inverse, where the method(s) implement a specific trait (interface):
Im also trying to get my hands dirty with tree-sitter and Nova’s “symbols.scm”
Seems like predicates (the #set, #append, #replace, etc) are not handled directly by the Tree-sitter C library and are implemented by Nova. I found a hint of that on the Tree-sitter documentation and just searching the tree-sitter repo for more clues.
I was never able to get “append” or “replace” to work even on the most basic symbols that I know are working.
I notice that Nova always uses “displayname.query” when modifying a symbol name, I was unable to find a single transformation predicate in theirs symbols.scm files except for strip used on docs.
I found useful tree-sitter cli parse and query commands.
As @ctkjose pointed out, #append! predicate works in a display name query
Naming query captures/results are displayed in document order. I wasn’t able to rearrange components of a symbol name.
I had better results when I combined shallow symbol queries with deeper naming queries (details follow)
I still don’t fully grok Scheme and Tree Sitter queries, but the solution to my above “invalid structure” error was to remove the type field I was using to capture @name, and instead capturing it in a naming query. So, these were my queries:
One small note – @logan in the docs the name query example is currently a display name example. A very minor thing that’s easy to puzzle out but I figured Panic might like to know.