Closed sidlatau closed 2 years ago
Great to hear you're writing an adapter!
You can change the names before returning them
local tree = lib.treesitter.parse_positions(path, query)
for position in tree:iter() do
if position.type == "test" then
position.name = ...
end
end
return tree
end
Though if you want to edit the IDs you have to do that before the tree is constructed by providing a position_id
function to the third opts argument.
If you haven't already, enable type checking for the lua LSP to check neotest you should see everything nicely typed (such as position.type will show valid values).
Thanks, this worked:
for _, position in tree:iter() do
if position.type == "test" or position.type == "namespace" then
position.name = remove_surrounding_quates(position.name)
end
end
And thanks for the hint to enable types, that helps a lot!
I am writing adapter to
dart
tests and have an issue with test names - there could be valid names with variation of single/double/triple quates:Is it possible to transform namespace/test names that are shown in the test summary? I would want to remove surrounding quates.
Here is a tree-sitter query: