Hi guys, may I ask a question?
How can I capture (only “rust” AND all comments) in the langs
table:
return {
features = {
"git",
"lsp",
},
langs = {
-- comment 1 (@section_comment) parenthesis represents captures used in my query below.
-- comment 2 (@section_comment)
"python",
-- comment 3 (@section_comment)
"rust", (@module_string)
},
themes = {
"dayfox",
"doom-one"
},
}
QUERY:
If I only keep the @section_key
predicate by commenting out the @module_string
predicate, then each capture
highlights as expected. However, if I try to narrow down the query to only
the single string then each capture stops from being highlighted when moved over by the cursor.
In summary, using two predicates for capturing only "rust"
fails for me.
;THIS DOES NOT WORK / should target both all comments and single field string.
(return_statement (expression_list
(table_constructor
(field
name: (identifier) @section_key
value: (table_constructor
(comment) @section_comment
(field value: (string) @module_string) (#eq? @module_string "rust")
) ; why doesn't predicate on line above work?
)
) (#eq? @section_key "langs")
))