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.5k stars 196 forks source link

Inconsistency in go-to definition/references for modules based on syntax #1027

Closed jaminthorns closed 11 months ago

jaminthorns commented 1 year ago

Environment

Current behavior

When doing go-to definition/references for modules, I get inconsistent behavior based on the syntax the module is being used in and whether my cursor is on the last character of the module name.

Here's a video demonstrating the inconsistencies:

https://github.com/elixir-lsp/elixir-ls/assets/6618434/09aa1327-d5dd-4959-ae72-eae09feb09bd

And here's the code used in the video:

defmodule Test do
  def test, do: nil
end

defmodule OtherModule do
  def test do
    # Module name (all characters working)
    Test

    # Remote call (last character references function instead of module)
    Test.test()

    # Remote capture (last character references function instead of module)
    _ = &Test.test/0

    # Module name in list
    [
      # Comma after (last character not working)
      Test,
      # Space after (all characters working)
      Test ,
      # Nothing after (all characters working)
      Test
    ]

    # Module name in arguments (last character not working)
    List.wrap(Test)
  end
end

It's worth noting that this is different from https://github.com/elixir-lsp/elixir-ls/issues/1038. I'm using Elixir 1.15, and function go-to/references are working properly when the cursor is at the end of the symbol.

Expected behavior

I expect the behavior of go-to definition/references to be the same regardless of where the cursor is positioned in all of the examples shown.

lukaszsamson commented 1 year ago

It seems the upstream elixir fix did not resolve the issue in all cases. It is the same problem

lukaszsamson commented 11 months ago

I reopened the original issue