Skip to content

Work across a group of projects, not just the one you're in - #2160

Merged
bbatsov merged 5 commits into
masterfrom
feature/1752-group-project-commands
Aug 18, 2026
Merged

Work across a group of projects, not just the one you're in#2160
bbatsov merged 5 commits into
masterfrom
feature/1752-group-project-commands

Conversation

@bbatsov

@bbatsov bbatsov commented Aug 17, 2026

Copy link
Copy Markdown
Owner

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 f completes over the files of every related project, and s-p n s searches 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-projects and projectile-search-in-projects, which take any list of projects. projectile-find-file-in-known-projects and projectile-search-review are 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 n is now a prefix for the whole family rather than a command, so projectile-switch-sibling-project moves to s-p n p. The sub-keys mirror the project-wide ones a level down, the way c m does for subprojects.

Fixes #1752.

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.
@bbatsov
bbatsov merged commit 8927963 into master Aug 18, 2026
10 checks passed
@bbatsov
bbatsov deleted the feature/1752-group-project-commands branch August 18, 2026 10:34
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.

feature some like projectile-find-file-in-known-projects

1 participant