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

jump function doesn't respect a module name #409

Open
achempion opened this issue Dec 11, 2021 · 3 comments
Open

jump function doesn't respect a module name #409

achempion opened this issue Dec 11, 2021 · 3 comments

Comments

@achempion
Copy link

achempion commented Dec 11, 2021

I have a simple example
file.ex

defmodule Module1 do
  def create do
  end
end

defmodule Module2 do
  def create do
  end
end

defmodule Module3 do
  def create do
  end
end

Module1.create()

When I point cursor to the last line on create function and press M-., I get prompt with three suggestions

/path/to/file.ex
12:   def create do
 7:   def create do
 2:   def create do

It seems dumb-jump ignores the module name when searching for definition.


dumb-jump version: 20211018.1545
emacs version: 28.0.90 (9.0)

init.el

(dumb-jump-mode)
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
@phikal
Copy link
Contributor

phikal commented Dec 11, 2021

Well yes, dumb-jump generates a regular expression from a database that is passed to a grep-like program. For the case of elixir, these are the rules it uses. The "dumb" comes preciesly from a lack of a semantical understanding of the text that is being searched.

Also, you don't have to activate both dumb-jump-mode and add dumb-jump-xref-activate to xref-backend-functions. The former just binds the legacy commands, that are (officially) superceeded by the Xref interface.

@achempion
Copy link
Author

Nice, thank you for the response. Could I take a look into modifying those regexps in order to make them "smarter" or you want to keep them as is?

@phikal
Copy link
Contributor

phikal commented Dec 12, 2021 via email

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

2 participants