jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.58k stars 151 forks source link

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

Open ryanwinchester opened 8 years ago

ryanwinchester commented 8 years ago

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*\(/
jacktasia commented 8 years ago

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

ryanwinchester commented 8 years ago

@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.

jacktasia commented 8 years ago

@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!

asn-d6 commented 4 years ago

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! :)