Skip to content

Commit ec6ac2c

Browse files
committed
assume 1.14+
1 parent b5218a4 commit ec6ac2c

File tree

10 files changed

+1066
-1148
lines changed

10 files changed

+1066
-1148
lines changed

apps/debug_adapter/test/debugger_test.exs

Lines changed: 509 additions & 511 deletions
Large diffs are not rendered by default.

apps/elixir_ls_utils/test/complete_test.exs

Lines changed: 107 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -273,40 +273,36 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
273273
] = expand(~c"String.Cha")
274274
end
275275

276-
if Version.match?(System.version(), ">= 1.14.0") do
277-
test "elixir submodule completion with __MODULE__" do
278-
assert [
279-
%{
280-
name: "Chars",
281-
full_name: "String.Chars",
282-
subtype: :protocol,
283-
summary:
284-
"The `String.Chars` protocol is responsible for\nconverting a structure to a binary (only if applicable)."
285-
}
286-
] = expand(~c"__MODULE__.Cha", %Env{module: String})
287-
end
276+
test "elixir submodule completion with __MODULE__" do
277+
assert [
278+
%{
279+
name: "Chars",
280+
full_name: "String.Chars",
281+
subtype: :protocol,
282+
summary:
283+
"The `String.Chars` protocol is responsible for\nconverting a structure to a binary (only if applicable)."
284+
}
285+
] = expand(~c"__MODULE__.Cha", %Env{module: String})
288286
end
289287

290-
if Version.match?(System.version(), ">= 1.14.0") do
291-
test "elixir submodule completion with attribute bound to module" do
292-
assert [
293-
%{
294-
name: "Chars",
295-
full_name: "String.Chars",
296-
subtype: :protocol,
297-
summary:
298-
"The `String.Chars` protocol is responsible for\nconverting a structure to a binary (only if applicable)."
299-
}
300-
] =
301-
expand(~c"@my_attr.Cha", %Env{
302-
attributes: [
303-
%AttributeInfo{
304-
name: :my_attr,
305-
type: {:atom, String}
306-
}
307-
]
308-
})
309-
end
288+
test "elixir submodule completion with attribute bound to module" do
289+
assert [
290+
%{
291+
name: "Chars",
292+
full_name: "String.Chars",
293+
subtype: :protocol,
294+
summary:
295+
"The `String.Chars` protocol is responsible for\nconverting a structure to a binary (only if applicable)."
296+
}
297+
] =
298+
expand(~c"@my_attr.Cha", %Env{
299+
attributes: [
300+
%AttributeInfo{
301+
name: :my_attr,
302+
type: {:atom, String}
303+
}
304+
]
305+
})
310306
end
311307

312308
test "find elixir modules that require alias" do
@@ -367,32 +363,26 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
367363
assert [%{name: "fun2ms", origin: ":ets"}] = expand(~c":ets.fun2")
368364
end
369365

370-
if Version.match?(System.version(), ">= 1.14.0") do
371-
test "function completion on __MODULE__" do
372-
assert [%{name: "version", origin: "System"}] =
373-
expand(~c"__MODULE__.ve", %Env{module: System})
374-
end
366+
test "function completion on __MODULE__" do
367+
assert [%{name: "version", origin: "System"}] =
368+
expand(~c"__MODULE__.ve", %Env{module: System})
375369
end
376370

377-
if Version.match?(System.version(), ">= 1.14.0") do
378-
test "function completion on __MODULE__ submodules" do
379-
assert [%{name: "to_string", origin: "String.Chars"}] =
380-
expand(~c"__MODULE__.Chars.to", %Env{module: String})
381-
end
371+
test "function completion on __MODULE__ submodules" do
372+
assert [%{name: "to_string", origin: "String.Chars"}] =
373+
expand(~c"__MODULE__.Chars.to", %Env{module: String})
382374
end
383375

384-
if Version.match?(System.version(), ">= 1.14.0") do
385-
test "function completion on attribute bound to module" do
386-
assert [%{name: "version", origin: "System"}] =
387-
expand(~c"@my_attr.ve", %Env{
388-
attributes: [
389-
%AttributeInfo{
390-
name: :my_attr,
391-
type: {:atom, System}
392-
}
393-
]
394-
})
395-
end
376+
test "function completion on attribute bound to module" do
377+
assert [%{name: "version", origin: "System"}] =
378+
expand(~c"@my_attr.ve", %Env{
379+
attributes: [
380+
%AttributeInfo{
381+
name: :my_attr,
382+
type: {:atom, System}
383+
}
384+
]
385+
})
396386
end
397387

398388
test "function completion with arity" do
@@ -1588,37 +1578,33 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
15881578
assert Enum.any?(entries, &(&1.name == "MyDate" and &1.subtype == :struct))
15891579
end
15901580

1591-
if Version.match?(System.version(), ">= 1.14.0") do
1592-
test "completion for struct names with __MODULE__" do
1593-
assert [%{name: "__MODULE__"}] = expand(~c"%__MODU", %Env{module: Date.Range})
1594-
assert [%{name: "Range"}] = expand(~c"%__MODULE__.Ra", %Env{module: Date})
1595-
end
1581+
test "completion for struct names with __MODULE__" do
1582+
assert [%{name: "__MODULE__"}] = expand(~c"%__MODU", %Env{module: Date.Range})
1583+
assert [%{name: "Range"}] = expand(~c"%__MODULE__.Ra", %Env{module: Date})
15961584
end
15971585

1598-
if Version.match?(System.version(), ">= 1.14.0") do
1599-
test "completion for struct attributes" do
1600-
assert [%{name: "@my_attr"}] =
1601-
expand(~c"%@my", %Env{
1602-
attributes: [
1603-
%AttributeInfo{
1604-
name: :my_attr,
1605-
type: {:atom, Date}
1606-
}
1607-
],
1608-
module: MyMod
1609-
})
1610-
1611-
assert [%{name: "Range"}] =
1612-
expand(~c"%@my_attr.R", %Env{
1613-
attributes: [
1614-
%AttributeInfo{
1615-
name: :my_attr,
1616-
type: {:atom, Date}
1617-
}
1618-
],
1619-
module: MyMod
1620-
})
1621-
end
1586+
test "completion for struct attributes" do
1587+
assert [%{name: "@my_attr"}] =
1588+
expand(~c"%@my", %Env{
1589+
attributes: [
1590+
%AttributeInfo{
1591+
name: :my_attr,
1592+
type: {:atom, Date}
1593+
}
1594+
],
1595+
module: MyMod
1596+
})
1597+
1598+
assert [%{name: "Range"}] =
1599+
expand(~c"%@my_attr.R", %Env{
1600+
attributes: [
1601+
%AttributeInfo{
1602+
name: :my_attr,
1603+
type: {:atom, Date}
1604+
}
1605+
],
1606+
module: MyMod
1607+
})
16221608
end
16231609

16241610
# handled elsewhere
@@ -2253,45 +2239,43 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
22532239
expand(~c"inf", %Env{requires: [], module: MyModule, function: {:foo, 1}}, metadata)
22542240
end
22552241

2256-
if Version.match?(System.version(), ">= 1.14.0") do
2257-
test "Application.compile_env classified as macro" do
2258-
assert [
2259-
%{
2260-
name: "compile_env",
2261-
arity: 2,
2262-
type: :macro,
2263-
origin: "Application",
2264-
needed_require: "Application"
2265-
},
2266-
%{
2267-
name: "compile_env",
2268-
arity: 3,
2269-
type: :macro,
2270-
origin: "Application",
2271-
needed_require: "Application"
2272-
},
2273-
%{
2274-
name: "compile_env",
2275-
arity: 4,
2276-
type: :function,
2277-
origin: "Application",
2278-
needed_require: nil
2279-
},
2280-
%{
2281-
name: "compile_env!",
2282-
arity: 2,
2283-
type: :macro,
2284-
origin: "Application",
2285-
needed_require: "Application"
2286-
},
2287-
%{
2288-
name: "compile_env!",
2289-
arity: 3,
2290-
type: :function,
2291-
origin: "Application",
2292-
needed_require: nil
2293-
}
2294-
] = expand(~c"Application.compile_e")
2295-
end
2242+
test "Application.compile_env classified as macro" do
2243+
assert [
2244+
%{
2245+
name: "compile_env",
2246+
arity: 2,
2247+
type: :macro,
2248+
origin: "Application",
2249+
needed_require: "Application"
2250+
},
2251+
%{
2252+
name: "compile_env",
2253+
arity: 3,
2254+
type: :macro,
2255+
origin: "Application",
2256+
needed_require: "Application"
2257+
},
2258+
%{
2259+
name: "compile_env",
2260+
arity: 4,
2261+
type: :function,
2262+
origin: "Application",
2263+
needed_require: nil
2264+
},
2265+
%{
2266+
name: "compile_env!",
2267+
arity: 2,
2268+
type: :macro,
2269+
origin: "Application",
2270+
needed_require: "Application"
2271+
},
2272+
%{
2273+
name: "compile_env!",
2274+
arity: 3,
2275+
type: :function,
2276+
origin: "Application",
2277+
needed_require: nil
2278+
}
2279+
] = expand(~c"Application.compile_e")
22962280
end
22972281
end

0 commit comments

Comments
 (0)