Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to jump to method definition but getting all variables as results [PHP] #51

Closed
ryanwinchester opened this issue Jun 9, 2016 · 7 comments
Assignees

Comments

@ryanwinchester
Copy link

ryanwinchester commented Jun 9, 2016

Using PHP

  • It would be nice if methods and variables were not mixed in search results.
  • It would also be nice to jump to the method definition if using C-M-g on a method usage.

I don't know, but maybe it could include open parentheses and $ in regex (or whatever is used to search) to distinguish methods from variables?

Also searching for usage vs definition would be pretty cool.

e.g.

if the cursor is on fooBar() usage (i.e. ->fooBar() search for fooBar() definition (function fooBar() and if cursor is on the definition, search for usages?

Image -- cursor on method usage but getting variables as results:

dumb-jump

@jacktasia
Copy link
Owner

Thanks for reporting this! I think this should be pretty easy to (mostly) fix by defining some language contexts for PHP. I'll try to add in some for PHP tonight or tomorrow.

@jacktasia jacktasia self-assigned this Jun 9, 2016
@jacktasia
Copy link
Owner

@ryanwinchester

In the short term adding this to your config should improve finding PHP functions depending on the context:

(add-to-list 'dumb-jump-language-contexts
             '(:language "php" :type "function" :right "^(" :left nil))

If you run into other cases, please report back here and I will try to handle them too. I will add at least this one to the next release.

Also searching for usage vs definition would be pretty cool.

It's certainly something I would like to support, but it would probably require another set of rules for each language. Please make a new issue for it if it's something you'd like me to prioritize. Thanks!

@ryanwinchester
Copy link
Author

Works way better:

@jacktasia
Copy link
Owner

Awesome! Thanks for the update. Please let me know if you run into any other context issues like this.

@jacktasia
Copy link
Owner

@ryanwinchester If you don't mind me asking: what are you using to make the GIF you have above?

@ryanwinchester
Copy link
Author

@jacktasia LICEcap

@jacktasia
Copy link
Owner

@ryanwinchester Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants