Move parsing of hspec tree to parse_positions
#49
Labels
improvement
Not a bug, but behaviour that can be improved
parse_positions
#49
After having browsed the neotest sources a bit, I think the best way to solve this is a complete rework of how neotest-haskell parses positions and later constructs the test commands from the positions.
The current
parse_positions
implementation runs one big tree-sitter query that results in what is effectively a list of positions. And thenbuild_spec
runs queries on each position to build the hspec--match
filters for each position.This works well if there's only one position to run (the "nearest"), but not if there are more than one.
If I change
parse_positions
to run separate smaller tree-sitter queries and return a tree that is equivalent to the hspec tree (as far as is possible with the limited tree-sitter capabilities), neotest should only pass the respective parent nodes tobuild_spec
.For the entire file, this would likely be a single position, unless the
Spec
is constructed using multiple top-level functions.Then I can construct the hspec
--match
filter inbuild_spec
by simply iterating over each position's parent nodes.It would still be nice to be able to merge multiple positions into a single command, but this will definitely need a patch to neotest.
Originally posted by @mrcjkb in #45 (comment)
The text was updated successfully, but these errors were encountered: