Skip to content

Request textDocument/completion failed with Interpolated Bitstring #256

@pjdiiori

Description

@pjdiiori

I had the following in a test setup block:

subaccounts =
  for letter <- ?A..?Z,
      do:
        organization_fixture(%{parent_id: parent_org.id, name: "Subaccount #{<<letter>>}"})

That caused the following error to occur on every following keystroke:

2025-12-12 10:15:07.897 [info] [Error - 10:15:07 AM] Request textDocument/completion failed.
2025-12-12 10:06:25.599 [info]   Message: ** (FunctionClauseError) no function clause matching in XPForge.Ast.Tokens.get_start_pos/1
    (xp_forge 0.1.0) XPForge.Ast.Tokens.get_start_pos([{:"<<", {815, 84, nil}}, {:identifier, {815, 86, ~c"letter"}, :letter}, {:">>", {815, 92, nil}}])
    (xp_forge 0.1.0) lib/forge/ast/tokens.ex:158: anonymous fn/2 in XPForge.Ast.Tokens.interpolation_ranges/1
    (elixir 1.18.1) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
    (xp_forge 0.1.0) lib/forge/ast/tokens.ex:151: XPForge.Ast.Tokens.interpolation_ranges/1
    (xp_forge 0.1.0) lib/forge/ast/tokens.ex:97: XPForge.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

changing the code in the setup block to the following fixed the issue for me:

subaccounts =
  for letter <- ?A..?Z,
      do:
        organization_fixture(%{parent_id: parent_org.id, name: "Subaccount " <> <<letter>>})

Using VS Code on MacOS Sequoia 15.3.2
Elixir Version:

Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.18.1 (compiled with Erlang/OTP 27)

Issue also occurred with Lexical after disabling Expert.

Let me know if you need any other info, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions