treesitter

How do I match the string value only in tree-sitter?


Given that I have the code below in JavaScript/Typescript:

findOne('testing', () => {
});

findLegacy('testing2', () => {
});

findOne('testing3', () => {
});

I want to match the string value only using a tree-sitter query.

Here's where I got to, it matches the whole string, including the quotes

(call_expression
  arguments: (arguments ((string)+ @desc))
)

Can I match testing and not 'testing'?


Solution

  • This is just not possible in tree-sitter