Try to use Projectile to find files in *compilation* buffer if possible.

If not, fallback to the original function.

* projectile.el (projectile-compilation-find-file): Use projectile to find
files in *compilation* buffer if possible.

(projectile-mode): Add the previous function around `compilation-find-file'.

Add/Remove the advice around `compilation-find-file' when the mode is on/off.
Bozhidar Batsov <notifications@github.com> writes:

> In projectile.el:
>
>> @@ -1732,6 +1732,24 @@ with a prefix ARG."
>>      (puthash project-root compilation-cmd projectile-compilation-cmd-map)
>>      (compilation-start compilation-cmd)))
>>  
>> +(defun projectile-compilation-find-file (oldfun &rest args)
>> +  "Try to find a buffer for FILENAME, if we cannot find it,
>> +fallback to the original function, OLDFUN.
>> +
>> +\(advice-add 'compilation-find-file :around projectile-compilation-find-file)"
>> +  (destructuring-bind (marker filename directory &rest formats) args
>> +    (or
>> +     ;; Try to find the filename using projectile
>> +     (and (projectile-project-p)
>
> Still, there's the problem that looping through the files in a bigger project will be pretty slow, so we should definitely check whether filename is
> absolute or relative to default-directory before doing the loop.

You're right, I've fixed this in commit f7579ba.

Also, the former implementation didn't looked in the project root
directory. This is fixed in commit 1a71ecd.