Work across a group of projects, not just the one you're in - #2160
Merged
Conversation
Same idea as the .claude/ entry above it: agent-facing notes are personal to whoever is working on the repo, not something to carry in tree.
Both the search-review suite and the new group suite want "which files have matches in this buffer", so it belongs next to the other match helpers rather than being spelled twice.
Two commands take a list of projects rather than the current project: `projectile-find-file-in-projects' and `projectile-search-in-projects'. `projectile-find-file-in-known-projects' and `projectile-search-review' are now the "all of them" and "just this one" cases of them, and the new `projectile-find-file-in-sibling-projects' (s-p N) and `projectile-search-in-sibling-projects' (s-p s n) are the case worth having: the handful of projects that belong together, which is the difference between a useful completion list and a hopeless one. The search reviewer already took a candidate file list, so a group search is the ordinary reviewer pointed at several projects, with the file names shown relative to the innermost directory containing them so each match is labelled with the project it came from. It records the group it scanned, since re-search recomputes candidates and would otherwise silently narrow to the display root, and it skips the ripgrep fast-path, which runs one rg over one directory tree. Candidates are de-duplicated: two members of a group can nest - a monorepo and a project inside it, both known projects - and a file scanned twice would be replaced twice by the replace reviewer, corrupting it. `projectile-files-with-string' also had to start asking each directory about its own VCS instead of the current project's, or a non-git member of a group got git-grep run inside it and silently contributed nothing. [Fix #1752]
The cheatsheet is where people look up a binding and neither command was in it. In the dispatch, "file in sibling projects" sat under Project while the command it narrows, "file in known projects", is under Find. The sibling search also went straight to the command, so the --regexp, --case-sensitive and --word switches above it did nothing to it - every other search entry routes through a projectile-dispatch- wrapper that honours them, and now this one does too.
s-p n is now the prefix for everything that works across related projects, with each key mirroring the project-wide one a level down the way c m does for subprojects: n p switches, n f finds a file, n s searches. That costs the s-p n binding from 3.4.0, but three commands scattered across n, N and s n were never going to read as one family, and better to pay it now with three than later with more. Switching to a sibling project and to a worktree were missing from the menu entirely, which was easy to miss while they were the only commands in the family.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Switching to a related project isn't the only thing a family of projects is good for - more often I want to find a file in one of them, or search all of them at once.
s-p n fcompletes over the files of every related project, ands-p n ssearches them and collects the matches in a single buffer, named so each match says which project it came from.Underneath both are thin wrappers over
projectile-find-file-in-projectsandprojectile-search-in-projects, which take any list of projects.projectile-find-file-in-known-projectsandprojectile-search-revieware now the widest and narrowest cases of those same two functions, so a command for a group of your own is a two-line wrapper.Heads up on one break:
s-p nis now a prefix for the whole family rather than a command, soprojectile-switch-sibling-projectmoves tos-p n p. The sub-keys mirror the project-wide ones a level down, the wayc mdoes for subprojects.Fixes #1752.