diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b45450c6..56a3b0813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### New features +* [#1874](https://github.com/bbatsov/projectile/pull/1874): Changes `compilation-find-file-projectile-find-compilation-buffer` to navigate directly to the file if already present on disk to help improve performance in scenarios where there are a large number of project directories. * [#1870](https://github.com/bbatsov/projectile/pull/1870): Add package command for CMake projects. * [#1875](https://github.com/bbatsov/projectile/pull/1875): Add support for Sapling VCS. * [#1876](https://github.com/bbatsov/projectile/pull/1876): Add support for Jujutsu VCS. diff --git a/projectile.el b/projectile.el index b7f794f9a..5d030dc95 100644 --- a/projectile.el +++ b/projectile.el @@ -5406,14 +5406,18 @@ We enhance its functionality by appending the current project's directories to its search path. This way when filenames in compilation buffers can't be found by compilation's normal logic they are searched for in project directories." - (let* ((root (projectile-project-root)) - (compilation-search-path - (if (projectile-project-p) - (append compilation-search-path (list root) - (mapcar (lambda (f) (expand-file-name f root)) - (projectile-current-project-dirs))) - compilation-search-path))) - (apply orig-fun `(,marker ,filename ,directory ,@formats)))) + ; If the file already exists, don't bother running the extra logic as the project directories might be massive (i.e. Unreal-sized). + (if (file-exists-p filename) + (apply orig-fun `(,marker ,filename ,directory ,@formats)) + + (let* ((root (projectile-project-root)) + (compilation-search-path + (if (projectile-project-p) + (append compilation-search-path (list root) + (mapcar (lambda (f) (expand-file-name f root)) + (projectile-current-project-dirs))) + compilation-search-path))) + (apply orig-fun `(,marker ,filename ,directory ,@formats))))) (defun projectile-open-projects () "Return a list of all open projects.