tonini/alchemist.el

Nested modules break alias and import (for goto def)

Opened this issue · 1 comments

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.

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