projectile icon indicating copy to clipboard operation
projectile copied to clipboard

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

Open latpaw opened this issue 3 years ago • 1 comments

Projectile is pretty good project manager for me, I have been annoyed for switching between web project and backend project (api) recently.

It's so slow when I run projectile-find-file-in-known-projects. Probably because the projectile-known-projects have more than 50 projects.

So I tried to do something to deal with this condition, here is my plan:

  1. write a variable named 'projectile-related-project into .dir-locals.el, the variable may be string or list of string
  2. concatenate all the files in root and related project

extra: maybe define a function to edit the variable

(defun projectile-related-project-files (root)
  "Projectile list all files in related projects with keyword ROOT."
  (if (boundp 'projectile-related-project)
    (cl-mapcan
     (lambda (project)
       (when (file-exists-p project)
         (mapcar (lambda (file)
                   (expand-file-name file project))
                 (projectile-project-files project))))
     (list root projectile-related-project))
    (projectile-project-files root)
    ))

(defun projectile-find-file-in-related-projects ()
  "Find file in related projects.  The variable 'projectile-related-project can be defined in .dir-locals.el."
  (interactive)
  (let* ((root (projectile-acquire-root))
        (files (projectile-related-project-files root)))
    (find-file (projectile-completing-read "Find file in related projects: " files))))

So is this workable ?

latpaw avatar Feb 11 '22 07:02 latpaw

I think that's an interesting idea and I'd welcome a PR on the subject. Alternatively we can have something like "project sets", that'd be essentially the same but can be global configuration (each set would be a list of related projects, perhaps with an optional name).

bbatsov avatar Oct 29 '22 05:10 bbatsov