Skip to content

Commit 2984b66

Browse files
authored
Add regression test for autocompletion of 'fn' within parentheses (#768)
- so, this behavior wasn't working for me in vs-code, so I hopped into the repo to write a failing test, but the test passed right away (🤔) and I'm now seeing the behavior _sometimes_ work and sometimes not in vs-code - conclusion is that the issue is likely in the vs-code extension, but I figured I'd submit a PR with the regression test if it's desired
1 parent 04407d3 commit 2984b66

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

apps/language_server/test/providers/completion_test.exs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,24 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
128128
end
129129
end
130130

131+
test "returns fn autocompletion when inside parentheses" do
132+
text = """
133+
defmodule MyModule do
134+
135+
def dummy_function() do
136+
Task.async(fn)
137+
# ^
138+
end
139+
end
140+
"""
141+
142+
{line, char} = {3, 17}
143+
TestUtils.assert_has_cursor_char(text, line, char)
144+
{:ok, %{"items" => [first_suggestion | _tail]}} = Completion.completion(text, line, char, @supports)
145+
146+
assert first_suggestion["label"] === "fn"
147+
end
148+
131149
test "unless with snippets not supported does not return a completion" do
132150
text = """
133151
defmodule MyModule do

0 commit comments

Comments
 (0)