tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

Nested modules break alias and import (for goto def) #317

Open linges opened 7 years ago

linges commented 7 years ago

If you have a nested module, all alias and imports before the inner module are not considered by alchemist-goto-definition-at-point. Steps to reproduce: Create a new project with mix new test. Add a file test/lib/test.ex with the content:

defmodule Test do
  alias Test.A
  def works do
    A.a # go to def here
  end

  defmodule Bug do end

  def doesnt do
     A.a # go to def here
  end
end

defmodule Test.A do
  def a, do: 3
end

From the first call A.a in works the goto def works, from the second in doesnt not. Version: 1.8.2 This problem seems to also happen with corresponding vim plugin. Note: A second alias right after the inner module Bug makes it work again.

linges commented 7 years ago

After some short debugging it seems like alchemist-scope-module returns the wrong module for the example above (Bug instead of Test).