elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.46k stars 193 forks source link

Definition provider not able to detect modules in multi require/import/use syntax #1075

Open albertored opened 1 year ago

albertored commented 1 year ago

I'm using the last version of the plugin (0.13.0) but it seems that somehow the package elixir_sense is not correctly updated.

The symptom I have is not being able to go to the definition of multiple uses:

defmodule A do
  use B.C.{D, E}
end

I can click on D and correctly go to its definition but not on E.

The strange thing is that if I add :elixir_sense (from its master on github) on my app deps, I get a lot of warnings on the ElixirLS output panel:

[Warn  - 10:56:15 PM] warning: redefining module ElixirSense.Providers.Suggestion (current version loaded from /home/user/.vscode-insiders/extensions/jakebecker.elixir-ls-0.13.0/elixir-ls-release/elixir_sense-2.0.0.ez/elixir_sense-2.0.0/ebin/Elixir.ElixirSense.Providers.Suggestion.beam)
  lib/elixir_sense/providers/suggestion.ex:1

but then the "Go to definition" command starts to work. After cleaning up that dep on my app the broken behavior comes back.

It seems like the plugin is using an outdated version of :elixir_sense but I can't figure out how that is possible...

Unfortunately I cant get the commit sha of :elixir_sense from the .ez archive

lukaszsamson commented 1 year ago

There is no problem with elixir_sense version. The navigation works correctly for alias but is broken for require, import and use. The problem is the provider does not understand the expression. It works for alias only because it sets an alias. There are tests for alias added in 67fc6f05384467cfe153e558e76ebbe50d3a059b