laravel-ide-macros icon indicating copy to clipboard operation
laravel-ide-macros copied to clipboard

Show where macro came from

Open mikemand opened this issue 3 years ago • 2 comments

For whatever reason, I am not able to make PhpStorm jump to the file & line. So, if you know what syntax I need to make it do that let me know and I will happily implement it. Here's an example of the output:

namespace Illuminate\Support {
    class Collection {
        public static function after($currentItem, $fallback = NULL) {
            // @see: vendor/spatie/laravel-collection-macros/src/Macros/After.php:19
        }
        public static function at($index) {
            // @see: vendor/spatie/laravel-collection-macros/src/Macros/At.php:28
        }
        public static function before($currentItem, $fallback = NULL) {
            // @see: vendor/spatie/laravel-collection-macros/src/Macros/Before.php:19
        }
        public static function chunkBy(Closure $callback, bool $preserveKeys = false): \Illuminate\Support\Collection {
            // @see: vendor/spatie/laravel-collection-macros/src/Macros/ChunkBy.php:17
        }
        public static function collectBy($key, $default = NULL): \Illuminate\Support\Collection {
            // @see: vendor/spatie/laravel-collection-macros/src/Macros/CollectBy.php:21
        }
    }
}

P.S. I ran php-cs-fixer (well, PhpStorm did automatically on save...) on the Command file. If you want me to revert the code style changes, I can do that.

mikemand avatar Aug 26 '20 16:08 mikemand

Hey @mikemand! I don't remember PHPStorm not recognizing the references, might it be a local setting in your project / editor?

Can anyone else reproduce the issue and see if this PR resolves the issue?

KristofMorva avatar Oct 01 '20 08:10 KristofMorva

Hi @KristofMorva,

I'm sorry I wasn't clearer in my description. This PR adds the line that says what file the macro came from (for example: // @see: vendor/spatie/laravel-collection-macros/src/Macros/After.php:19). That part is working fine.

What isn't working for me is jumping to that file by invoking "Jump to Declaration" or whatever it is called on that path. It might work out of the box on VS Code and with a plugin on Sublime Text, but it does not work on PhpStorm. I don't know if it is a configuration option, as I haven't found any dealing with that invocation in the settings.

mikemand avatar Oct 01 '20 17:10 mikemand