Jumping to nested module
Closed this issue · 10 comments
Is jumping to definitions in nested modules possible without using a fully-qualified module name? Consider this example:
defmodule Outer do
defmodule Inner do
@doc "doc"
def foo, do: []
end
def foo do
Inner.foo # XXX cannot jump to the definition using ctrl-]
Outer.Inner.foo # can jump to the definition using ctrl-]
end
end
When I try to jump (ctrl-]
) to Inner.foo
, error E426
is returned. Is this a bug or am I missing something?
This also applies to opening the documentation of a nested module and its functions (shift-k
).
Version Information:
- Elixir v1.5
- alchemist.vim c455e53
@evnu thanks for reporting the issue
I'm working on elixir-sense which solves lots of problem like this.
I keep the issuer open until that new feature is ready
Works like a charm, thank you! Note that I stumbled over the missing Python 3 support. In ArchLinux, Python 3 is the default. I fixed it temporarily by changing the first line in elixir_sense_client
to #!/usr/bin/env python2
.
I found one related problem when using alias
and use
within an umbrella. I will state it here, but I think this might be something which should be reported upstream.
mix new --umbrella project
cd project/apps
mix new a
mix new b
# 1) make :a an umbrella dep of :b
# 2) then, paste some code
echo "defmodule A do\ndefmodule Inner do\n def __using__(_), do: :ok\nend\nend" > a/lib/a.ex
echo "defmodule B do\nalias A.Inner\nuse Inner\n\nend" > b/lib/b.ex
cd ..
mix compile # should compile properly
Now, when I try to jump to Inner
from use Inner
in b/lib/b.ex
, elixir_sense
reports that module Inner is not loaded and could not be found
. When this happens, jumping to any identifier does not work anymore in that module. Here is the complete error message:
alchemist.vim: failed with message error:/home/evnu/conf/vimrc/bundle/alchemist.vim/elixir_sense/lib/elixir_sense/core/as
t.ex:16: module Inner is not loaded and could not be found
I guess this is not fixable within alchemist.vim
? It seems that elixir_sense stumbles over the alias definition. When I use use A.Inner
, jumping to the definition works as expected.
@evnu Yeah it's all elixir_sense, can you open an issue there with the same detail?
Yes, I will open an issue. What is the current version of elixir_sense
within alchemist.vim
?
See msaraiva/elixir_sense#12 for the upstream issue.
Fixed on v1.0.1!