Skip to content

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

@jaminthorns

Description

@jaminthorns

Environment

  • Elixir & Erlang versions (elixir --version):
    • Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
    • Elixir 1.15.7 (compiled with Erlang/OTP 24)
  • VSCode ElixirLS version: 0.17.9
  • Operating System Version: darwin 23.1.0

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:

compressed.mp4

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 #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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions