This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Add setting to use project from active panel #2393
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
In #2308 the behavior for determining the selected project changed to use the project selected from a project management dropdown instead of using the project from the currently active pane. This behavior can be useful however I also think it can be valuable to have the old behavior, specifically when switching between several projects quickly.
In this PR I implement a setting to bring back the old behavior. The setting is disabled by default (so behavior from before this PR remains the same by default).
If enabled, the project management dropdown will become disabled (the text color changes to be more subtle in the dropdown and it is no longer selectable). It will still show the active project however it will change on its own based on the current active pane with an associated project.
This setting can be toggled and will have an impact immediately (listeners for the setting changes are all configured).
Screenshot/Gif
Disabled Project Dropdown:

New Setting:

Alternate Designs
I considered hiding the project selection UI entirely but I believe it is actually helpful to view the project name the git pane is showing for.
There are alternate designs being considered as a part of #2335 but I do not think they completely solve the issue. All of the options suggest adding at least 1 step to what the previous behavior was (at the very least, running a command to switch projects). This design does not conflict with the designs considered in that issue because they both provide different levels of autonomy to power users.
Benefits
Power users can switch project with no more effort than opening a file. I think this is a huge win for when you are working in multiple projects quickly. An example is if you say, have to update a node dependency in several projects at once and want to quickly commit the change and open a PR.
Without this setting you would need to open the package.json file, update it, find your project in the dropdown (if you have more than a few projects it can take some effort to find the correct one), then continue to do the actions with git / github.
With this setting you need to open the package.json file, updated it and then continue to do the actions with git / github.
Possible Drawbacks
It can be slightly disorienting when the selected project in git changes as you change to open files from a different project if you are not expecting it. With that said it is rare you open a file from another project unintentionally. Also if this is disabled by default you would expect this behavior since you explicitly opted in to it.
Applicable Issues
There is discussion that the previous workflow (re-added in this PR as a setting) is more useful to some: #2308 (comment)
As mentioned above there is an issue with proposed resolutions that do not fully solve the problem: #2335
Metrics
N/A
Tests
Unit tests were added to test this behavior and existing tests updated for the new pass-thru props.
Documentation
A new setting was added with a title & description. Not sure if that is what this section is referring to about documentation though.
Release Notes