lexical-lsp / lexical

Lexical is a next-generation elixir language server
776 stars 77 forks source link

FunctionClauseError on go to definition #747

Closed dvic closed 1 month ago

dvic commented 1 month ago

I can't exactly pinpoint when it happens, but I get occasionally the following:

(I can send the full stack trace privately if you want, can't share the source code publicly)

2024-05-21T14:46:14.833 helix_lsp::transport [ERROR] lexical <- InternalError: ** (ErlangError) Erlang error: {:exception, {:badmatch, #Inspect.Error<
  got FunctionClauseError with message:

      """
      no function clause matching in Inspect.LXSourceror.Zipper."-inlined-__impl__/1-"/1
      """

  while inspecting:

      %{
        node: [
          {{:__block__, [format: :keyword, line: 849, column: 15], [:enforce]},
           {:__block__, [line: 849, column: 24], [true]}},
          {{:__block__, [format: :keyword, line: 849, column: 30], [:module]},
           {:__aliases__, [last: [line: 849, column: 38], line: 849, column: 38],
            [:CreatedContract]}}
        ],
        path: %{
          parent: %{
            node: {:typedstruct,
             [
               end_of_expression: [newlines: 2, line: 853, column: 6],
               do: [line: 849, column: 54],
               end: [line: 853, column: 3],
               line: 849,
               column: 3
             ],
             [
               [
                 {{:__block__, [format: :keyword, line: 849, column: 15], [:enforce]},
                  {:__block__, [line: 849, column: 24], [true]}},
                 {{:__block__, [format: :keyword, line: 849, column: 30], [:module]},
                  {:__aliases__,
                   [last: [line: 849, column: 38], line: 849, column: 38],
                   [:CreatedContract]}}
               ],
....
     __struct__: LXSourceror.Zipper
      }

  Stacktrace:

    (lx_sourceror 1.0.3) Inspect.LXSourceror.Zipper."-inlined-__impl__/1-"(:target)
    (elixir 1.15.6) lib/inspect.ex:6: Inspect.impl_for/1
    (elixir 1.15.6) lib/inspect.ex:142: Inspect.inspect/2
    (elixir 1.15.6) lib/inspect/algebra.ex:348: Inspect.Algebra.to_doc/2
    (elixir 1.15.6) lib/inspect/algebra.ex:479: Inspect.Algebra.container_each/6
    (elixir 1.15.6) lib/inspect/algebra.ex:456: Inspect.Algebra.container_doc/6
    (elixir 1.15.6) lib/inspect/algebra.ex:479: Inspect.Algebra.container_each/6
    (elixir 1.15.6) lib/inspect/algebra.ex:456: Inspect.Algebra.container_doc/6

>}, [{LXical.RemoteControl.CodeIntelligence.Definition, :maybe_move_cursor_to_next_token, 4, [file: ~c"lib/lexical/remote_control/code_intelligence/definition.ex", line: 129]}, {LXical.RemoteControl.CodeIntelligence.Definition, :parse_location, 2, [file: ~c"lib/lexical/remote_control/code_intelligence/definition.ex", line: 110]}, {LXical.RemoteControl.CodeIntelligence.Definition, :definition, 2, []}]}
    (kernel 9.1) erpc.erl:702: :erpc.call/5
    (lx_server 0.5.0) lib/lexical/server/provider/handlers/go_to_definition.ex:9: LXical.Server.Provider.Handlers.GoToDefinition.handle/2
    (lx_server 0.5.0) lib/lexical/server/provider/queue.ex:99: anonymous fn/2 in LXical.Server.Provider.Queue.State.as_task/2
    (elixir 1.15.6) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.15.6) lib/task/supervised.ex:36: Task.Supervised.reply/4
scohen commented 1 month ago

Hop on our discord, I really need the stack.

scohen commented 1 month ago

Closing this issue, it looks like it's caused by some local config problems. I'll reopen if it's a more general problem.