Skip to content

v3.5.0

Latest

Choose a tag to compare

@bbatsov bbatsov released this 29 Nov 14:16
· 3 commits to master since this release

New features

  • #2208: The search prompts are smarter about what you might be looking for, while staying plain text prompts.
    • TAB completes the word before point against the identifiers that occur in the project, most common first (projectile-search-complete-identifiers).
    • M-n offers the name of the function around point, the name of the current file and the last Isearch string, after the symbol or region at point.
    • They have a history of their own, projectile-search-history, instead of sharing the generic minibuffer history.
  • #2182: Add projectile-todos-in-projects and projectile-multi-occur-in-projects, so every sibling command now has a public generic taking any list of projects behind it and a command for a group of your own is a two-line wrapper for all five.
  • #2181: Sapling and Bazaar projects can now list their own ignored files, via the new projectile-sapling-ignored-command and projectile-bzr-ignored-command.
  • #2180: Every shell backend can now open in another window (s-p x 4 <key>), not just vterm, eat and ghostel: shell, eshell, ielm, term and the backend-dispatching projectile-run gained -other-window commands.
  • #2160: Add projectile-find-file-in-sibling-projects (s-p n f) and projectile-search-in-sibling-projects (s-p n s), which work across the family of related projects rather than just the one you're in.
    • Both are built on projectile-find-file-in-projects and projectile-search-in-projects, which take any list of projects, so a command for a group of your own is a two-line wrapper.
    • A group search puts every match in one *projectile-search* buffer, named relative to the directory containing the group, so each one is labelled with the project it came from.
  • #2165: A subproject now has its own project type, so the s-p c m lifecycle commands build a monorepo member with the member's own toolchain - a Rust crate or Go module under a JavaScript repository runs cargo test or go test rather than the repository's npm test. New projectile-subproject-type.
    • A member identified by the same manifest as the repository keeps the repository's type: a pnpm or yarn workspace member holds only a package.json and would otherwise fall back to plain npm.
  • #2166: Subprojects now come from the workspace's own member list when the repository declares one - pnpm, npm/yarn/bun, Cargo and go.work - instead of from scanning for manifests, so test fixtures and excluded crates stop showing up as subprojects. Babel's repository goes from 205 to its declared 162. New projectile-subproject-functions.
    • Build tools that compute their members rather than declaring them (Gradle, Bazel) keep using the scan, which is why it remains the fallback.
  • #2163: Add projectile-switch-to-buffer-in-sibling-projects (s-p n b), projectile-multi-occur-in-sibling-projects (s-p n o) and projectile-todos-in-sibling-projects (s-p n t), so buffers and annotations follow the same family as files and searches.
    • projectile-switch-to-buffer-in-projects joins the two existing generic commands, and projectile-todos now shares one implementation with its group form.
  • #2202: projectile-run-task now also offers the recipes of the modules a justfile declares with mod (and mod?), qualified the way just names them (just:foo::build), including nested modules and modules with an explicit path (#2158).

Changes

  • #2209: M-n at a compile, test or run prompt goes through what the project suggests running: the default command of its type and the commands of its tasks (Make targets, npm scripts and so on), the ones named after the phase first.
  • #2209: The prompts for which files to search (C-u s-p s g) and which to replace in (C-u s-p r) complete over the file extensions that occur in the project, most common first.
  • #2209: The replace commands read what to replace with the search prompt, so it has the same suggestions, history and identifier completion, and M-n at the "with" prompt brings up the text being replaced, ready to be edited. Replacements have a history of their own, projectile-replace-history.
  • #2210: The "Compare against:" prompt of C-u projectile-find-changed-file completes over tags as well as branches and defaults to the branch the remote treats as its default, with the tracked branch and the latest tag on M-n.
  • #2210: The keep and flush by file prompts of the search and replace results buffers suggest regexps: the directory of the match at point by default, then its extension, the file itself and the top-level directories with matches in them on M-n.
  • #2210: M-n at the prompts of projectile-run-shell-command-in-root and projectile-run-async-shell-command-in-root goes through the commands of the project's tasks.
  • #2210: projectile-add-known-project and projectile-add-and-switch-project start their prompt at the root of the current project when it is not a known one yet.
  • #2211: The prompts with an obvious answer default to it: the project's most recent other buffer for projectile-switch-to-buffer, the subproject of the current file for projectile-find-file-in-subproject, the task run last for projectile-run-task and the current project for C-u projectile-invalidate-cache.
  • #2211: M-n at the projectile-find-file prompt brings up the file named at point, then the test or the implementation of the current file and its other files, before going through the rest of the project's files.
  • #2208: projectile-find-references uses the same prompt as the other search commands, so the symbol at point is the default rather than text already typed into the minibuffer.
  • #2206: Deleting files inside a project with a persistent cache no longer writes the cache file once per deleted file. The write waits until Emacs is idle, and pending cache writes are flushed when Emacs exits.
  • #2206: projectile-find-test-file is much faster on large projects: the project type and its test conventions are looked up once, not once per file.
  • #2206: Listing the known projects is faster with projectile-ignored-projects set: its entries are symlink-resolved once per listing, not once per project.
  • #2206: The search and replace reviewers scan a large file with many matches much faster: line numbers are counted from the previous match instead of from the top of the file.
  • #2206: projectile-replace and the replace reviewer no longer slow down on large projects when narrowing a literal search to the files of the project.
  • #2213: Matching files against the ignore rules is several times faster, which shows when listing a project of tens of thousands of files with a command that cannot take the rules itself (#2198).
  • #2205: Deprecate projectile-ag and the ag search backend, to be removed in Projectile 4.0. The Silver Searcher has not been developed since 2020 and the ag package is archived; projectile-ripgrep and projectile-search-review take its place.
    • Running projectile-ripgrep through the archived ripgrep package is deprecated as well, in favour of the rg package.
    • Each warns once per session when used.
  • #2205: projectile-ripgrep now uses the rg package when both rg and ripgrep are installed, instead of the other way around. ripgrep was archived by its author in 2022.
  • #2205: projectile-replace and the replace reviewer no longer use ag to narrow down the files to look at; rg, git grep and grep do that now.
  • #2204: projectile-replace and the replace reviewer no longer use ack to narrow down the files to look at. It was only ever reached with ack installed and neither rg nor ag, where git grep or grep now do the same job.
  • #2184: Rename the options that still broke their naming schemes: projectile-ignored-project-patterns to projectile-ignored-project-regexps (it holds regexps, and since 3.4 "patterns" means globs), projectile-track-known-projects-automatically to projectile-auto-track-known-projects, projectile-watch-directory-limit to projectile-watch-max-directories, projectile-dashboard-recent-files to projectile-dashboard-max-recent-files (a count, not a list) and projectile-session-autosave to projectile-session-auto-save. The old names still work as obsolete aliases.
  • #2179: projectile-session-auto-save now defaults to t. projectile-session-restore-on-switch reads what autosave writes, so with the save off by default projectile-session-mode restored layouts it had never recorded and did nothing until you saved one by hand.
  • #2160: projectile-switch-sibling-project moved from s-p n to s-p n p. s-p n is now the prefix for every command that works across related projects, with each key mirroring the project-wide one a level down, the way c m does for subprojects.
  • #2168: Search results are redrawn at most every projectile-search-render-interval while streaming, instead of on every chunk. The buffer is redrawn from scratch, so drawing per chunk cost roughly chunks times matches - two thirds of a sibling-group search went on redrawing. A search across 18 projects drops from 0.32s to 0.18s, and across 122 from 4.8s to 2.8s.
  • #2164: A search across several projects now uses ripgrep, one run per project, instead of falling back to the Emacs Lisp scanner. The candidate file list is also only computed when something is going to scan it, so the ripgrep path no longer pays for a directory walk it never reads.

Bugs fixed

  • #2209: C-u projectile-replace asked for a file extension and then matched it against whole file names, so answering el replaced nothing. A bare extension is now turned into the glob (*.el).
  • #2206: Deleting a file removes it from the file cache of the project it belongs to, not from the cache of the project the current buffer happens to be in.
  • #2206: The search reviewer now shows what rg reported when it fails (a pattern it rejects, an unreadable directory) instead of an empty "No matches" buffer.
  • #2204: On an Emacs built without native JSON, projectile-search-review and projectile-todos fall back to the Emacs Lisp scanner instead of running rg and reporting no matches.
  • #2204: projectile-session-switch-to-buffer, projectile-find-file-in-projects and projectile-find-file-in-directory advertise the completion category their candidates really are (buffer and file), so Marginalia and Embark stop treating them as files relative to the project root.
  • #2204: A nested projectile-project-compilation-dir such as build/debug is created along with its parents when it does not exist yet, instead of the lifecycle command failing.
  • #2204: Visiting a match from the search or replace results works after the buffer it was found in has been killed, and lands on the right line in a narrowed buffer.
  • #2204: The search and replace reviewers now scan the whole of an open buffer that is narrowed, instead of missing the matches outside the restriction and numbering the rest from its start.
  • #2204: Visiting a file no longer reads and rewrites the known projects file when its project is already the most recent one, which was most of the cost of the find-file hook.
  • #2204: Saving the known projects, a file cache, frecency data or a session no longer stops to ask for a coding system when a path has characters the locale cannot encode, and the file is replaced in one step so that another Emacs never reads it half written.
  • #2204: projectile-replace and the replace reviewer can search for a term that starts with a dash, such as --verbose; rg, ag, git grep and grep read it as an option and the replace found nothing.
  • #2204: projectile-ripgrep searches hidden files for a regexp search too when it runs through the ripgrep package, as it already did for a literal one.
  • #2204: A Cargo or Go workspace with a plain package.json at its root gets its subprojects from its own manifest again, instead of falling back to scanning for markers.
  • #2204: projectile-switch-project now hides known projects matched by projectile-ignored-project-regexps even when that is the only ignore option set.
  • #2204: projectile-run-test-at-point is autoloaded again; its autoload cookie had ended up on an internal helper.
  • #2204: projectile-search-review and projectile-todos no longer run a local rg for a remote project, which searched a local directory and labelled its hits with remote paths; remote projects use the Emacs Lisp scanner.
  • #2204: projectile-switch-worktree no longer lists the root of a remote project over TRAMP before reporting that it does not look for the checkouts of one.
  • #2196: With the default in-memory cache, a project with a .projectile no longer throws its cache away and re-indexes on every projectile-find-file (#2193).
  • #2195: projectile-dispatch can be extended with transient-insert-suffix/transient-append-suffix as soon as transient is loaded, instead of failing with "Not a transient prefix command" until the menu had been opened once (#2194).
  • #2191: The test suite passes under native compilation with an empty eln cache, as in distro package builds, instead of failing two dirconfig specs with native-lisp-load-failed (#2100).
  • #2190: Alien indexing no longer hands git exclude pathspecs to an fd whose projectile-git-fd-args lacks --strip-cwd-prefix, which made it fail with No valid search paths given (#2187).
  • #2183: projectile-run-test-at-point now builds a usable file path when the project is reached through a symlink (anything under /tmp on macOS, or a symlinked ~/src), instead of one that climbs out of the project and gets rejected by the test runner.
  • #2178: The file-extension filter of projectile-replace and friends is now shell-quoted. ag received it unquoted, so a *.el filter reached it as the regexp .el$ and also matched files ending in model or panel; on the other tools an extension containing a quote broke the command outright.
  • #2177: projectile-ripgrep no longer dies under zsh with no matches found. The ripgrep package runs its command line through the shell, and the ignore exclusions went in unquoted - harmless until the generated-directory defaults introduced a pattern with a * in it.
  • #2172: Fix subproject detection in a Go workspace. A go.work names its modules as ./api, and the leading ./ survived into the subproject name, which then matched none of the project's file paths - so projectile-find-file-in-subproject offered nothing at all in a Go monorepo. Members are now spelled relative to the project root whatever the manifest wrote.
  • #2171: The commands that list the known projects now load the persisted list first. They read the projectile-known-projects variable, which stays nil until the same-named accessor loads it from disk and which nothing loads at startup - so whichever of them you reached for first in a session offered nothing. projectile-find-file-in-known-projects completed over an empty list; projectile-vc, projectile-remove-known-project and the "Switch to project" prompt of projectile-require-project-root were affected too.
  • #2170: Navigating a search results buffer while the scan is still running is no longer undone by the next chunk. Each redraw ended by going to the top of the buffer, so point jumped back on every batch of matches; it now stays where you left it.
  • #2167: The Emacs Lisp search scanner no longer decompresses or decrypts the files it reads. It went through file-name-handler-alist, so every archive in the candidate set was run through gzip and every .gpg handed to EPA - work discarded a moment later as binary, and on an encrypted file a passphrase prompt in the middle of a project search.
    • Matches inside compressed files are no longer reported by that scanner, which is what the ripgrep path already did.
  • #2162: Listing another project's files now applies that project's own ignore rules instead of the rules of whichever project you happen to be visiting. projectile-find-file-in-known-projects and the sibling commands used to filter every other project by the current one's dirconfig, and with caching on they stored that wrong list under the other project's key - so an ordinary projectile-find-file there kept offering ignored files, and with persistent caching it survived a restart.
  • #2161: Customizing projectile-mode-line-prefix now reaches buffers whose lighter is never recomputed - every buffer when projectile-dynamic-mode-line is off, which is the case its docstring describes, and remote ones always. The prefix used to be frozen at whatever it was when Projectile loaded.
  • #2157: projectile-use-comint-mode now covers the named tasks run by projectile-run-task, which were always given a read-only compilation buffer however it was set - so a task that needs to ask for a sudo password had nowhere to type one (#2156). Name task in the list, or set the option to t.
  • #2212: The prompts for a task, a file kind, a related file kind and a CMake preset advertised their candidates as project files, so marginalia annotated them and embark acted on them as if they were files.
  • #2214: File names with non-ASCII characters no longer show up as octal escapes (\321\202.txt) in the prompts and the cache when the coding system of a process is left for Emacs to detect, as it is by default on Windows (#1743).