Skip to content

Commit

Permalink
Add regression test for autocompletion of 'fn' within parentheses (el…
Browse files Browse the repository at this point in the history
…ixir-lsp#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
  • Loading branch information
vanderhoop authored Nov 13, 2022
1 parent 04407d3 commit 2984b66
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apps/language_server/test/providers/completion_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@ defmodule ElixirLS.LanguageServer.Providers.CompletionTest do
end
end

test "returns fn autocompletion when inside parentheses" do
text = """
defmodule MyModule do
def dummy_function() do
Task.async(fn)
# ^
end
end
"""

{line, char} = {3, 17}
TestUtils.assert_has_cursor_char(text, line, char)
{:ok, %{"items" => [first_suggestion | _tail]}} = Completion.completion(text, line, char, @supports)

assert first_suggestion["label"] === "fn"
end

test "unless with snippets not supported does not return a completion" do
text = """
defmodule MyModule do
Expand Down

0 comments on commit 2984b66

Please sign in to comment.