Function: projectile-subproject-type

projectile-subproject-type is a byte-compiled function defined in projectile.el.

Signature

(projectile-subproject-type &optional SUBPROJECT-ROOT)

Documentation

Return the project type of the subproject at SUBPROJECT-ROOT.

Detection is rooted at the subproject instead of at the repository, so a crate inside a JavaScript monorepo comes back as rust-cargo rather than as one more node directory. SUBPROJECT-ROOT defaults to the subproject containing the current file (see projectile-subproject-root).

This is what separates a subproject from a plain subdirectory: the repository stays the project - find-file, search and switching are still repository-wide - while the lifecycle commands under the c m prefix run the member's own build. Promoting members to projects outright (by adding their manifests to projectile-project-root-files-bottom-up) is the other way to get their commands right, at the cost of the repository no longer being a project.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-subproject-type (&optional subproject-root)
  "Return the project type of the subproject at SUBPROJECT-ROOT.

Detection is rooted at the subproject instead of at the repository, so a
crate inside a JavaScript monorepo comes back as `rust-cargo' rather than
as one more `node' directory.  SUBPROJECT-ROOT defaults to the subproject
containing the current file (see `projectile-subproject-root').

This is what separates a subproject from a plain subdirectory: the
repository stays the project - find-file, search and switching are still
repository-wide - while the lifecycle commands under the `c m' prefix run
the member's own build.  Promoting members to projects
outright (by adding their manifests to
`projectile-project-root-files-bottom-up') is the other way to get their
commands right, at the cost of the repository no longer being a project."
  (let* ((root (or subproject-root (projectile-subproject-root)))
         ;; Resolve the repository's own type first, before the override is
         ;; in force.
         (repo-type (projectile-project-type))
         (detected (let ((projectile--root-override root))
                     (or (gethash root projectile-project-type-cache)
                         (projectile-detect-project-type root root)))))
    ;; A member of a JavaScript workspace holds a `package.json' and nothing
    ;; else, so on its own it looks like a plain `node' project - and running
    ;; `npm test' inside a pnpm or yarn workspace is worse than what the
    ;; repository would have run.  The repository's type is the more specific
    ;; one whenever both are identified by the same manifest, so keep it and
    ;; only switch when the member is genuinely a different toolchain.
    (if (projectile--same-manifest-type-p detected repo-type)
        repo-type
      detected)))