dumb-jump icon indicating copy to clipboard operation
dumb-jump copied to clipboard

Jump from function usage to definition and vice versa [PHP examples]

Open ryanwinchester opened this issue 8 years ago • 4 comments

Currently I can jump from usage to definition, thanks to https://github.com/jacktasia/dumb-jump/commit/7e256808d82d22532030e4c53197426d3e082593 but can't go the other direction

PHP examples

definitions:

class Foo {
    function bar() {}
    static function bar() {}
}

function bar() {}

usages:

$bar = $foo->bar();
$bar = Foo::bar();
$bar = bar();

Explanation

If I am on a usage, I'd like to jump to the definition. e.g. possible regex:

/function\s+(bar)\s*\(/

If I have the cursor on the definition I'd like to jump to usages. e.g. possible regex:

/(?<!function\s)(bar)\s*\(/

ryanwinchester avatar Jun 10 '16 19:06 ryanwinchester

Excellent, thanks for opening this! I will try to get a system to support jumping to usages soon.

jacktasia avatar Jun 10 '16 19:06 jacktasia

@jacktasia cool.

In my opinion, it's not nearly as important as going from usage to definition, which it currently does, so I wouldn't say this is a critical feature, but still useful.

ryanwinchester avatar Jun 10 '16 19:06 ryanwinchester

@ryanwinchester FYI #69, which is now available via MELPA, provides functionality similar to this I think. Please let me know if you have any feedback. Thanks!

jacktasia avatar Aug 09 '16 20:08 jacktasia

Hello! Is this implemented in #69?

I would like this feature because I currently do it with grep or cscope and they both suck!

If this is implemented in #69, what's the interactive function to try this out? And if it's implemented, why is this issue open? If it's lack of testing, I can test!

Thansk! :)

asn-d6 avatar Oct 30 '19 09:10 asn-d6