feat(amazonq): Add support for multi-project workspaces. #5411
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.
This PR is a proof of concept for multi-project workspace support. Changes are still in progress, and I have performed only superficial local testing at time of writing.
Types of changes
Description
Problem:
Q does not support multi-root workspaces for /dev, /doc, and related features.
Solution:
This change starts by adding a
Workspace
concept for uploads involving theFeatureDevSessionContext
, which detects the IDE workspace's root directory as the common ancestor of the workspace's projects. When choosing what files to upload, files within the workspace root and in the workspace's projects are included to upload. This broadens /dev and /doc to support multi-project workspaces, while retaining intuitive behavior per-project if we imagine a composite workspace in a directory structure that is not strictly hierarchical.The change itself is straightforward, identifying the common ancestor and basing further work on that root. From here, a few changes unravel:
.gitignore
in subdirectories (across all of Q, including ProjectContext and FeatureDev). Otherwise, we would confuse users with project-level.gitignore
configurations, and it makes sense to fully support subdirectory.gitignore
configurations rather than treat projects as a special case.* From my research, JetBrains doesn't really have a concept that a project maps to a directory. For the time being I've implemented an approximation using it's project directory detection heuristic. In theory, JetBrains projects can themselves be composites of multiple modules in arbitrary directories. It would be straightforward to offer first-class alignment with the IDE's strong project/module concepts with small adjustments to
isPathInWorkspace
andfindWorkspaceRoot
to go a layer deeper with this same approach. We could enumerate modules and filter out what's not contained under the enumerated modules, which do themselves map to concrete directories. (This would remove use ofguessProjectDir
.)Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.