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

'Method not found' for private methods when using enh-ruby-mode #47

Open
RAbraham opened this issue Feb 14, 2015 · 14 comments
Open

'Method not found' for private methods when using enh-ruby-mode #47

RAbraham opened this issue Feb 14, 2015 · 14 comments

Comments

@RAbraham
Copy link

Hi,
robe-jump works for for jumping to methods on other classes but when I do it on a private method, it shows all Modules which may have the method but not the private method?

@dgutov
Copy link
Owner

dgutov commented Feb 16, 2015

Works for me. Could you give an example?

Are you trying to jump to a private method in a different class?

@RAbraham
Copy link
Author

Nope, private method in the same class. I am in the process of creating a sample rails project and testing it in a simple setting.

@dgutov
Copy link
Owner

dgutov commented Feb 17, 2015

When closing issues, you might want to leave a mention of what your actual problem was, or what made you think there was a problem.

@RAbraham
Copy link
Author

Sorry, I am evaluating another IDE for a month now, so I won't have time to follow up on this but the problem still exists for me. I didn't want to keep the ticket open indefinitely. My bad.
Should I reopen it or keep it closed?

@dgutov
Copy link
Owner

dgutov commented Feb 17, 2015

Ah no, it's a good enough explanation. Please only reopen this when you have more details.

Good luck with that other editor.

@RAbraham
Copy link
Author

Thank you for being supportive :). People like you and bbatsov make great packages for Emacs

@ledbettj
Copy link

ledbettj commented May 6, 2016

Hi,

I'm seeing the same behavior. Jumping to public methods works fine. The following does not (rails 4.2.5, ruby 2.3.0):

class TestModel < ActiveRecord::Base

  def baz
    foo # M-. here properly takes us to `foo`.
  end

  def foo
    bar # M-. says "Method not found"
  end

  private # If I remove this line and C-c C-k we can find `bar`.

  def bar # M-. here even says "Method not found"
    'hello world'
  end
end

robe version:

robe is an installed package.

     Status: Installed in ‘robe-20160427.552/’ (unsigned). Delete
    Version: 20160427.552
    Summary: Code navigation, documentation lookup and completion for Ruby
   Requires: inf-ruby-2.3.0

@dgutov
Copy link
Owner

dgutov commented May 7, 2016

@ledbettj Hi!

This works fine for me. I've just tried it in a new rails 4.2.5/ruby 2.3.0 project.

Have you tried pressing C-c C-k without removing private? Does navigation to bar start working then?

If not, please put the cursor inside the foo definition (on the bar call, line 7) and evaluate (M-:) this expression: (robe-context). What does it return?

Which version of Emacs are you using?

@dgutov dgutov reopened this May 7, 2016
@ledbettj
Copy link

ledbettj commented May 9, 2016

Thanks for the response! C-c C-k without removing private has no effect.

(robe-context) on the bar call returns:

("TestModel" nil nil)

Emacs Version:

GNU Emacs 25.0.93.1 (x86_64-apple-darwin15.4.0, NS appkit-1404.46 Version 10.11.4 (Build 15E65)) of 2016-04-25

Let me know if there's any other info that might be useful.

@dgutov
Copy link
Owner

dgutov commented May 9, 2016

Thanks. The result is wrong, it should be ("TestModel" t "foo").

Do you by any chance have the "alternative" ruby-mode package installed through ELPA? Please remove it.

@ledbettj
Copy link

ledbettj commented May 9, 2016

That was it -- I use enh-ruby-mode instead of the default ruby-mode. Switching back to ruby-mode fixes.

@dgutov
Copy link
Owner

dgutov commented May 9, 2016

Hmm, that's a surprise. I didn't expect it to be the source of the problem.

I've filed an issue there.

@dgutov dgutov changed the title 'Method not found' for private methods? 'Method not found' for private methods when using enh-ruby-mode May 9, 2016
@zenspider
Copy link

This might be fixed over in enh-ruby-mode... Try against latest.

dgutov added a commit that referenced this issue Apr 18, 2017
@dgutov
Copy link
Owner

dgutov commented Apr 18, 2017

It's improved, and it'll probably fix the example by @ledbettj. But see my comment in the linked issue.

I've pushed a change to robe now that will allow it to use enh-ruby-add-log-current-method.

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

No branches or pull requests

4 participants