-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request textDocument/completion failed while piping tuple to function. #779
Comments
Thanks for the report, I'll take a look. Lexical shouldn't crash here. If i was reviewing that code, I would offer that the pipeline is unnecessary in that case and just adds noise. The first code you have there seems more idiomatic to me. |
You are right, it is a edge case and not so idiomatic. I make more test, i presume this error occurs when piping a collection type literal (I'm not sure if this is accurate) to a function in a formatting string? require Record
Record.defrecord(:foo, hello: "world")
# these will triggered error
"test: #{{"localhost", 443} |> inspect_peername()}"
"test: #{["localhost", 443] |> inspect_peername()}"
"test: #{%{} |> inspect_peername()}"
# these below won triggered error
"test: #{foo() |> inspect()}"
"test: #{"localhost" |> inspect_peername()}"
"test: #{65535 |> inspect()}"
"test: #{connect_to_server() |> elem(1) |> inspect()}"
"test: #{:localhost |> inspect()}" |
I have a very similar issue, could be the same one. The error: 2025-02-20 10:58:13.185 [info] [Error - 10:58:13 AM] Request textDocument/completion failed.
2025-02-20 10:58:13.185 [info] Message: ** (FunctionClauseError) no function clause matching in LXical.Ast.Tokens.get_start_pos/1
(lx_common 0.7.2) LXical.Ast.Tokens.get_start_pos([{:"(", {34, 53, nil}}, {:identifier, {34, 54, ~c"i"}, :i}, {:dual_op, {34, 56, nil}, :+}, {:int, {34, 58, 1}, ~c"1"}, {:")", {34, 59, nil}}, {:mult_op, {34, 61, nil}, :*}, {:int, {34, 63, 10}, ~c"10"}])
(lx_common 0.7.2) lib/lexical/ast/tokens.ex:158: anonymous fn/2 in LXical.Ast.Tokens.interpolation_ranges/1
(elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
(lx_common 0.7.2) lib/lexical/ast/tokens.ex:151: LXical.Ast.Tokens.interpolation_ranges/1
(lx_common 0.7.2) lib/lexical/ast/tokens.ex:97: LXical.Ast.Tokens.normalize_token/1
(elixir 1.18.1) lib/stream.ex:626: anonymous fn/4 in Stream.map/2
(elixir 1.18.1) lib/enum.ex:4964: Enumerable.List.reduce/3
(elixir 1.18.1) lib/stream.ex:1612: Stream.do_list_resource/6
Code: -32603 The code that triggers it: Logger.info("Sync games #{player}, #{i + 1} - #{(i + 1) * 10}") Commenting out this line makes lexical work again, so seems to be something related to string interpolation? i_end = (i + 1) * 10
Logger.info("Sync games #{player}, #{i + 1} - #{i_end}") |
I got a
Request textDocument/completion failed.
error. Here is the log:I referenced previous issues related to this error, but it didn't help much. So I went back and checked the source code pointed out in the log.
I tried changing the code to the following form and the error magically disappeared. So I tried a few different ways of writing it and found that none of these below triggered the error:
The text was updated successfully, but these errors were encountered: