Skip to content

Commit 1a0f422

Browse files
committed
another attempt
1 parent 05ea318 commit 1a0f422

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

test/elixir_sense/core/compiler_test.exs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -979,24 +979,6 @@ defmodule ElixirSense.Core.CompilerTest do
979979
meta = Keyword.delete(meta, :capture)
980980
{{:fn, meta, args}, state}
981981

982-
# Normalize binding variables in quote bind_quoted
983-
# ElixirSense (1.19+ behavior) removes :column, but Elixir < 1.19 keeps it
984-
{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]} = _node, state
985-
when is_atom(var_name) and is_list(var_meta) and is_atom(context) ->
986-
# Add :column back for Elixir < 1.19
987-
var_meta =
988-
if Version.match?(System.version(), "< 1.19.0") do
989-
# For Elixir < 1.19, add :column: 1 if not present
990-
case Keyword.has_key?(var_meta, :column) do
991-
true -> var_meta
992-
false -> [{:column, 1} | var_meta]
993-
end
994-
else
995-
var_meta
996-
end
997-
998-
{{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]}, state}
999-
1000982
{atom, meta, nil} = node, state when is_atom(atom) ->
1001983
# ElixirSense intentionally uses :"&#{pos}" instead of :capture
1002984
# Convert to :capture to match Elixir 1.17+ behavior
@@ -1070,6 +1052,21 @@ defmodule ElixirSense.Core.CompilerTest do
10701052

10711053
{{:capture, meta, nil}, state}
10721054

1055+
# Normalize binding variables in quote bind_quoted/context
1056+
# Elixir < 1.19 has :column in metadata, 1.19+ removes it
1057+
# ElixirSense follows 1.19+ behavior, so remove :column from Elixir < 1.19
1058+
{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]} = _node, state
1059+
when is_atom(var_name) and is_list(var_meta) and is_atom(context) ->
1060+
var_meta =
1061+
if Version.match?(System.version(), "< 1.19.0") do
1062+
# Remove :column to match ElixirSense (1.19+) behavior
1063+
Keyword.delete(var_meta, :column)
1064+
else
1065+
var_meta
1066+
end
1067+
1068+
{{:{}, [], [:=, meta1, [{:{}, [], [var_name, var_meta, context]}, value]]}, state}
1069+
10731070
{atom, meta, nil} = node, state when is_atom(atom) ->
10741071
# Handle old :"&#{pos}" format from Elixir < 1.18
10751072
node =

0 commit comments

Comments
 (0)