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

fix(neotest): nested modules + position updates when switching buffers #223

Merged
merged 5 commits into from
Feb 11, 2024

Conversation

jameshurst
Copy link
Contributor

This PR fixes calculating positions for nested test modules.

I've removed the dir position as well as that was restricting neotest to a single file rather than the project directory, and was also preventing positions being updated when changing buffers.

I also had to add some naive matching logic to is_test_file as without the overriden dir position neotest will show all .rs files in the project directory, even if they contain no tests.

Before

After

Copy link
Contributor

github-actions bot commented Feb 10, 2024

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

  • For example, fix(lsp): some lsp-related bugfix

  • Pull request title has the appropriate conventional commit prefix.

If applicable:

  • Tested
    • Tests have been added.
    • Tested manually (Steps to reproduce in PR description).
  • Updated documentation.
  • Updated CHANGELOG.md

@mrcjkb mrcjkb enabled auto-merge (squash) February 11, 2024 00:10
auto-merge was automatically disabled February 11, 2024 00:13

Head branch was pushed to by a user without write access

Copy link
Owner

@mrcjkb mrcjkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great! 🙏

Just some small comments...

I've removed the dir position as well as that was restricting neotest to a single file rather than the project directory, and was also preventing positions being updated when changing buffers.

This fixes #208, which is great.
However, it also means that the neotest test_executor can't be used with "all targets" runnables when using :RustLsp testables. I'll have to come up with a solution for that.
I've implemented a fix for that, so it should work if you rebase 😄

lua/rustaceanvim/neotest/init.lua Outdated Show resolved Hide resolved
lua/rustaceanvim/neotest/init.lua Outdated Show resolved Hide resolved
@mrcjkb mrcjkb changed the title fix(neotest): fix nested modules, remove 'dir' position fix(neotest): nested modules + position updates when switching buffers Feb 11, 2024
@mrcjkb mrcjkb linked an issue Feb 11, 2024 that may be closed by this pull request
@mrcjkb
Copy link
Owner

mrcjkb commented Feb 11, 2024

Looks like luacheck is failing in CI:

pre-commit-run> Checking lua/rustaceanvim/neotest/init.lua        2 warnings
pre-commit-run>     lua/rustaceanvim/neotest/init.lua:49:38: unused argument name
pre-commit-run>     lua/rustaceanvim/neotest/init.lua:49:54: unused argument root

Copy link
Owner

@mrcjkb mrcjkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks again for the great work 🙏 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

neotest only discovers positions for new buffers after writing a file
2 participants