erlang_ls icon indicating copy to clipboard operation
erlang_ls copied to clipboard

Go-to-definition for variables behaves incorrectly

Open robertoaloi opened this issue 3 years ago • 0 comments

Given the following examples, where the ~ represents the cursor location:

one() ->
    Var = 1,
    [V~ar || Var <- [1, 2, 3]].
     
two() ->
    [ Var || Var <- [1, 2, 3] ],
    [ V~ar || Var <- [4, 5, 6] ].

Go-to-definition jumps to the locations indicated by *:

one() ->
    *Var = 1,
    [Var || Var <- [1, 2, 3]].
     
two() ->
    [ *Var || Var <- [1, 2, 3] ],
    [ Var || Var <- [4, 5, 6] ].

Which is surprising for the user. Instead, they should jump to:

one() ->
    Var = 1,
    [Var || *Var <- [1, 2, 3]].
     
two() ->
    [ Var || Var <- [1, 2, 3] ],
    [ Var || *Var <- [4, 5, 6] ].

robertoaloi avatar Jun 14 '22 16:06 robertoaloi