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

Resolve based on open files #24

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Conversation

mnoah1
Copy link
Collaborator

@mnoah1 mnoah1 commented Oct 10, 2024

Adds support to discover targets based on a user's open files, allowing test cases in a file to be resolved even if the user hasn't specifically expanded the target in the Test Explorer tree.

During the sync process, we will now check a user's open files. If any are determined to be test files, we request the file's target from the BSP server, then resolve the test cases in that target. After this is complete, the user will be able to run tests in those files via run arrows, without first having to navigate to the test explorer tree. This is opt out via settings, as it does result in additional back and forth with the BSP server.

As a follow-up, I plan to add an inlay hint or other info to help the user update their scope if we try to find the target.

Copy link
Collaborator

@JamyDev JamyDev left a comment

Choose a reason for hiding this comment

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

lgtm

@mnoah1 mnoah1 merged commit fa3032e into uber:main Oct 17, 2024
4 checks passed
@mnoah1 mnoah1 deleted the auto-discover-test-cases branch October 17, 2024 13:46
mnoah1 added a commit that referenced this pull request Oct 30, 2024
This change adds additional guidance when users have synced their test
cases, but have then navigated to a file that is outside of their Bazel
sync scope. Instead of a lack of test run arrows with no clear reason
why, they will now see a greyed out run arrow with further information.

- Open a file that's outside of the current scope.
- Logic from #24 attempts to expand this file's target and add its test
cases to the test explorer.
- With this PR, if the step above fails, decorators will now be added in
the gutter to help provide further guidance, at the locations where the
run arrows would normally appear.
-
![image](https://github.com/user-attachments/assets/ad914118-4ea4-486f-93d3-595729f236b4)
- Adjust Project Scope will open the .bazelproject file for editing, and
sync now triggers the test explorer's existing sync functionality.
- This functionality is behind the `bazelbsp.autoExpandTarget` setting
as it is part of that logic.
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.

2 participants