Skip to content
This repository was archived by the owner on Aug 30, 2025. It is now read-only.

Error when performing jump to definition #850

@tomekowal

Description

@tomekowal

I am using Zed editor with lexical-v0.7.2 on elixir 1.16.3 and erlang 26.2.5

"Jump to definition" sometimes fails

{"error":{"code":-32603,"message":"** (FunctionClauseError) no function clause matching in LXical.RemoteControl.Api.code_actions/5
    (lx_remote_control 0.7.2) lib/lexical/remote_control/api.ex:42: LXical.RemoteControl.Api.code_actions(%{__struct__: LXical.Project, entropy: 49725, project_module: nil, mix_exs_uri: "file:///Users/tomaszkowal/bluecodecom/scheme-services/mix.exs", mix_project?: true, root_uri: "file:///Users/tomaszkowal/bluecodecom/scheme-services", env_variables: %{}, mix_env: nil, mix_target: nil}, #Inspect.Error<
  got UndefinedFunctionError with message:

      """
      function Code.Identifier.inspect_as_atom/1 is undefined or private
      """

  while inspecting:

      %{
        version: 0,
        path: "/Users/tomaszkowal/bluecodecom/scheme-services/apps/token_server/lib/token_server/consumer_scan/remote_processors.ex",
        uri: "file:///Users/tomaszkowal/bluecodecom/scheme-services/apps/token_server/lib/token_server/consumer_scan/remote_processors.ex",
        __struct__: LXical.Document,
        lines: %Lines<"defmodule TokenServer.ConsumerScan.RemoteProcessors do..."(107 lines)>,
        dirty?: false,
        language_id: "elixir"
      }

  Stacktrace:

    (elixir 1.16.3) Code.Identifier.inspect_as_atom(LXical.Document)
    (lx_lexical_shared 0.5.0) lib/lexical/document.ex:25: Inspect.LXical.Document.inspect/2
    (elixir 1.16.3) lib/inspect/algebra.ex:347: Inspect.Algebra.to_doc/2
    (elixir 1.16.3) lib/kernel.ex:2352: Kernel.inspect/2
    (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
    (elixir 1.16.3) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
    (elixir 1.16.3) lib/exception.ex:732: Exception.format_arity/1
    (elixir 1.16.3) lib/exception.ex:727: Exception.format_mfa/3

>, #Protocol.Types.Range<[start: #Protocol.Types.Position<[line: 10, character: 55]>, end: #Protocol.Types.Position<[line: 10, character: 55]>]>, [], [:quick_fix, :source_organize_imports])
    (lx_server 0.7.2) lib/lexical/server/provider/handlers/code_action.ex:16: LXical.Server.Provider.Handlers.CodeAction.handle/2
    (lx_server 0.7.2) lib/lexical/server/task_queue.ex:79: anonymous fn/4 in LXical.Server.TaskQueue.State.as_task/2
    (elixir 1.16.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
    (elixir 1.16.3) lib/task/supervised.ex:36: Task.Supervised.reply/4
"},"id":15}

The error is a little bit mysterious to me because I haven't found any references to inspect_as_atom neither in Elixir 1.6.3, nor in the lexical source code.

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