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):
((impl_item
type: (type_identifier) @name @displayname
!trait) @subtree
(#set! role category)
(#append! @displayname " methods"))
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):
((impl_item
type: (type_identifier) @name
trait: (_)
) @displayname.target @subtree
(#set! role category)
(#set! displayname.query "symbols/impl_item.scm"))
This results in breaking symbol queries so no symbols are shown and this error appears in the Extension Console:
[rust] Error evaluating structure query: Invalid structure:
trait: (_)) @displayname.target @subtree
~~~~^
This is my Scheme ignorance showing, but that looked like a valid query to me. Can anyone help me fix this error?
For my final issue, if I ignore the trait
field to have my display name queries run, then with the following queries:
((impl_item
type: (type_identifier) @result)
(#append! @result ": "))
(impl_item
trait: (type_identifier) @result)
…an example impl block of impl Default for MyStruct {}
becomes:
DefaultMyStruct:
Whereas I was targeting
MyStruct: Default
I take it the display name isn’t assembled according to the order of my queries, but rather according to the order nodes show up in the syntax tree?