Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move parsing of hspec tree to parse_positions #49

Closed
mrcjkb opened this issue Feb 27, 2023 · 0 comments · Fixed by #61
Closed

Move parsing of hspec tree to parse_positions #49

mrcjkb opened this issue Feb 27, 2023 · 0 comments · Fixed by #61
Assignees
Labels
improvement Not a bug, but behaviour that can be improved

Comments

@mrcjkb
Copy link
Owner

mrcjkb commented Feb 27, 2023

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 then build_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 to build_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 in build_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)

@mrcjkb mrcjkb added the improvement Not a bug, but behaviour that can be improved label Mar 3, 2023
@mrcjkb mrcjkb self-assigned this Mar 3, 2023
@mrcjkb mrcjkb linked a pull request Mar 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Not a bug, but behaviour that can be improved
Projects
None yet
1 participant