elixir-lsp / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"
https://elixir-lsp.github.io/elixir-ls/
Apache License 2.0
1.5k stars 198 forks source link

(CaseClauseError) no case clause matching #879

Closed nrzull closed 1 year ago

nrzull commented 1 year ago

Environment

elixir 1.14.4-otp-25 erlang 25.3.1 ubuntu 22.04 vscode vscode-elixir-ls 0.14.5

Current behavior

It fails to start with next error:

[Error - 9:53:09 AM] Process #PID<0.19378.0> raised an exception
** (CaseClauseError) no case clause matching: %{actual_subject: "Mix.Project", docs: %{callbacks: "", docs: "> Mix.Project\n\nDefines and manipulates Mix projects.\n\nA Mix project is defined by calling `use Mix.Project` in a module, usually\nplaced in `mix.exs`:\n\n    defmodule MyApp.MixProject do\n      use Mix.Project\n\n      def project do\n        [\n          app: :my_app,\n          version: \"1.0.0\"\n        ]\n      end\n    end\n\n## Configuration\n\nIn order to configure Mix, the module that `use`s `Mix.Project` should export\na `project/0` function that returns a keyword list representing configuration\nfor the project.\n\nThis configuration can be read using `Mix.Project.config/0`. Note that\n`config/0` won't fail if a project is not defined; this allows many Mix tasks\nto work without a project.\n\nIf a task requires a project to be defined or needs to access a\nspecial function within the project, the task can call `Mix.Project.get!/0`\nwhich fails with `Mix.NoProjectError` in the case a project is not\ndefined.\n\nThere isn't a comprehensive list of all the options that can be returned by\n`project/0` since many Mix tasks define their own options that they read from\nthis configuration. For example, look at the \"Configuration\" section in the\ndocumentation for the `Mix.Tasks.Compile` task.\n\nThese are a few options that are not used by just one Mix task (and will thus\nbe documented here):\n\n  * `:build_per_environment` - if `true`, builds will be *per-environment*. If\n    `false`, builds will go in `_build/shared` regardless of the Mix\n    environment. Defaults to `true`.\n\n  * `:aliases` - a list of task aliases. For more information, check out the\n    \"Aliases\" section in the documentation for the `Mix` module. Defaults to\n    `[]`.\n\n  * `:config_path` - a string representing the path of the main config\n    file. See `config_files/0` for more information. Defaults to\n    `\"config/config.exs\"`.\n\n  * `:default_task` - a string representing the default task to be run by\n    `mix` when no task is specified. Defaults to `\"run\"`.\n\n  * `:deps` - a list of dependencies of this project. Refer to the\n    documentation for the `Mix.Tasks.Deps` task for more information. Defaults\n    to `[]`.\n\n  * `:deps_path` - directory where dependencies are stored. Also see\n    `deps_path/1`. Defaults to `\"deps\"`.\n\n  * `:lockfile` - the name of the lockfile used by the `mix deps.*` family of\n    tasks. Defaults to `\"mix.lock\"`.\n\n  * `:preferred_cli_env` - a keyword list of `{task, env}` tuples where `task`\n    is the task name as an atom (for example, `:\"deps.get\"`) and `env` is the\n    preferred environment (for example, `:test`). This option overrides what\n    is specified by the tasks with the `@preferred_cli_env` attribute (see the\n    docs for `Mix.Task`). Defaults to `[]`.\n\n  * `:preferred_cli_target` - a keyword list of `{task, target}` tuples where\n    `task` is the task name as an atom (for example, `:test`) and `target`\n    is the preferred target (for example, `:host`). Defaults to `[]`.\n\nFor more options, keep an eye on the documentation for single Mix tasks; good\nexamples are the `Mix.Tasks.Compile` task and all the specific compiler tasks\n(such as `Mix.Tasks.Compile.Elixir` or `Mix.Tasks.Compile.Erlang`).\n\nNote that sometimes the same configuration option is mentioned in the\ndocumentation for different tasks; this is just because it's common for many\ntasks to read and use the same configuration option (for example,\n`:erlc_paths` is used by `mix compile.erlang`, `mix compile.yecc`, and other\ntasks).\n\n## Erlang projects\n\nMix can be used to manage Erlang projects that don't have any Elixir code. To\nensure Mix tasks work correctly for an Erlang project, `language: :erlang` has\nto be part of the configuration returned by `project/0`. This setting also\nmakes sure Elixir is not added as a dependency to the generated `.app` file or\nto the escript generated with `mix escript.build`, and so on.\n\n## Invoking this module\n\nThis module contains many functions that return project information and\nmetadata. However, since Mix is not included nor configured during releases,\nwe recommend using the functions in this module only inside Mix tasks.\nIf you need to configure your ow" <> ..., types: ""}, range: %{begin: {2, 7}, end: {2, 18}}}
    (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
    (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
[Error - 9:53:10 AM] Request textDocument/hover failed.
  Message: an exception was raised:
    ** (CaseClauseError) no case clause matching: nil
        (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
        (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  Code: -32000 
[Error - 9:53:10 AM] Process #PID<0.19379.0> raised an exception
** (CaseClauseError) no case clause matching: nil
    (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
    (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2

Expected behavior

lukaszsamson commented 1 year ago

Why are you running on master elixir_sense? ElixirLS is not updated yet to handle changed API.

nrzull commented 1 year ago

@lukaszsamson didn't get it. I just installed vscode-elixir-ls 0.14.5 version and it gives me such error. I don't use elixir_sense directly in my projects.

lukaszsamson commented 1 year ago

How did you install it?

nrzull commented 1 year ago

@lukaszsamson via extensions marketplace in vscode

fschoenfeldt commented 1 year ago

I got the same issue with the following steps:

Starting ElixirLS release v0.14.5
Running in /Users/frederik/tmp/elixir_ls_test
[Info  - 09:49:59] Started ElixirLS v0.14.5
[Info  - 09:49:59] Running in /Users/frederik/tmp/elixir_ls_test
[Info  - 09:49:59] ElixirLS built with elixir "1.14.4" on OTP "25"
[Info  - 09:49:59] Running on elixir "1.14.4 (compiled with Erlang/OTP 25)" on OTP "25"
[Warn  - 09:49:59] OTP compiled without EEP48 documentation chunks. Language features for erlang modules will run in limited mode. Please reinstall or rebuild OTP with appropriate flags.
[Info  - 09:49:59] Elixir sources not found (checking in /home/build/elixir). Code navigation to Elixir modules disabled.
[Info  - 09:49:59] Loaded DETS databases in 17ms
[Info  - 09:49:59] Starting build with MIX_ENV: test MIX_TARGET: host
==> floki
Compiling 2 files (.erl)
Compiling 28 files (.ex)
Generated floki app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app
===> Analyzing applications...
===> Compiling telemetry
==> telemetry_metrics
Compiling 7 files (.ex)
Generated telemetry_metrics app
===> Analyzing applications...
===> Compiling telemetry_poller
==> jason
Compiling 10 files (.ex)
Generated jason app
==> db_connection
Compiling 15 files (.ex)
[Info  - 09:50:04] Experimental server is disabled.
Generated db_connection app
==> expo
Compiling 2 files (.erl)
Compiling 21 files (.ex)
Generated expo app
==> phoenix_pubsub
Compiling 11 files (.ex)
Generated phoenix_pubsub app
==> plug_crypto
Compiling 5 files (.ex)
Generated plug_crypto app
==> hpax
Compiling 4 files (.ex)
Generated hpax app
==> gettext
Compiling 17 files (.ex)
Generated gettext app
===> Analyzing applications...
===> Compiling ranch
==> ecto
Compiling 56 files (.ex)
Generated ecto app
==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)
Generated plug app
==> phoenix_html
Compiling 9 files (.ex)
Generated phoenix_html app
==> phoenix_template
Compiling 4 files (.ex)
Generated phoenix_template app
==> postgrex
Compiling 68 files (.ex)
Generated postgrex app
==> ecto_sql
Compiling 25 files (.ex)
Generated ecto_sql app
==> nimble_pool
Compiling 2 files (.ex)
Generated nimble_pool app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> esbuild
Compiling 3 files (.ex)
Generated esbuild app
==> tailwind
Compiling 3 files (.ex)
Generated tailwind app
==> mint
Compiling 1 file (.erl)
Compiling 19 files (.ex)
Generated mint app
==> finch
Compiling 13 files (.ex)
Generated finch app
==> websock
Compiling 1 file (.ex)
Generated websock app
===> Analyzing applications...
===> Compiling cowlib
===> Analyzing applications...
===> Compiling cowboy
===> Analyzing applications...
===> Compiling cowboy_telemetry
==> plug_cowboy
Compiling 5 files (.ex)
Generated plug_cowboy app
==> swoosh
Compiling 42 files (.ex)
Generated swoosh app
==> websock_adapter
Compiling 2 files (.ex)
Generated websock_adapter app
==> phoenix
Compiling 71 files (.ex)
Generated phoenix app
==> phoenix_live_view
Compiling 35 files (.ex)
Generated phoenix_live_view app
==> phoenix_live_dashboard
Compiling 40 files (.ex)
Generated phoenix_live_dashboard app
==> phoenix_ecto
Compiling 7 files (.ex)
Generated phoenix_ecto app
==> elixir_ls_test
Compiling 17 files (.ex)
Generated elixir_ls_test app
[Info  - 09:50:20] Compile took 21119 milliseconds
[Info  - 09:50:20] [ElixirLS WorkspaceSymbols] Indexing...
[Info  - 09:50:20] [ElixirLS Dialyzer] Checking for stale beam files
[Info  - 09:50:20] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info  - 09:50:21] [ElixirLS WorkspaceSymbols] 403 callbacks added to index
[Info  - 09:50:21] [ElixirLS Dialyzer] Found 872 changed files in 1448 milliseconds
[Info  - 09:50:23] [ElixirLS WorkspaceSymbols] 1101 modules added to index
[Info  - 09:50:23] [ElixirLS WorkspaceSymbols] 994 types added to index
[Info  - 09:50:31] [ElixirLS WorkspaceSymbols] 13685 functions added to index
[Info  - 09:50:35] [ElixirLS Dialyzer] Analyzing 872 modules: [Swoosh.Adapters.SocketLabs, Ecto.Adapters.Postgres, Expo.PluralForms.SyntaxError, Phoenix.LiveView.Route, Expo.Message, Mix.EctoSQL, :cow_mimetypes, :ranch_conns_sup, Phoenix.LiveDashboard.SystemInfo.PortDetails, Plug.RewriteOn, Swoosh.ApiClient, Ecto.UUID, HPAX.Huffman, String.Chars.Floki.Selector, Mix.Tasks.Ecto.Rollback, Expo.PO, Mint.Core.Transport.TCP, :cowboy_telemetry_h, Postgrex.Extensions.Time, ElixirLsTestWeb.PageHTML, Jason.Encoder.Date, Ecto.Adapters.SQL.Sandbox, Phoenix.LiveDashboard.ReingoldTilford, Mix.Tasks.Phx.Gen.Embedded, Phoenix.HTML.Safe.Atom, Plug.Conn.WrapperError, Floki.FlatText, :expo_plural_forms_parser, :cowboy_middleware, Plug.Conn.Status, Phoenix.Param.BitString, Postgrex.Extensions.INET, Postgrex.Extensions.OID, Finch.Request, DBConnection.Query, Swoosh.Email.Recipient.Any, Plug.Application, Ecto.Query.Builder.CTE, Gettext.Plural, Mix.Tasks.Phx.Gen.Notifier, Phoenix.Template.EExEngine, Plug.Test, Finch.Response, Mix.Tasks.Phx.Routes, Plug.Exception.Ecto.CastError, Ecto.Query.Builder.Select, Inspect.Phoenix.LiveView.UploadConfig, Phoenix.CodeReloader.Server, :cowboy_tracer_h, Jason.Encoder.List, ...]
[Info  - 09:50:45] [ElixirLS Dialyzer] Analysis finished in 23552 milliseconds
[Info  - 09:50:45] Dialyzer analysis is up to date
[Info  - 09:50:45] [ElixirLS Dialyzer] Writing manifest...
[Info  - 09:50:46] [ElixirLS Dialyzer] Done writing manifest in 694 milliseconds.
[Error - 09:51:07] Request textDocument/hover failed.
  Message: an exception was raised:
    ** (CaseClauseError) no case clause matching: %{actual_subject: "ElixirLsTestWeb.Layouts", docs: %{callbacks: "", docs: "> ElixirLsTestWeb.Layouts\n\nNo documentation available\n", types: ""}, range: %{begin: {8, 29}, end: {8, 52}}}
        (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
        (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  Code: -32000 
[Error - 09:51:07] Process #PID<0.181.1> raised an exception
** (CaseClauseError) no case clause matching: %{actual_subject: "ElixirLsTestWeb.Layouts", docs: %{callbacks: "", docs: "> ElixirLsTestWeb.Layouts\n\nNo documentation available\n", types: ""}, range: %{begin: {8, 29}, end: {8, 52}}}
    (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
    (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
[Error - 09:51:07] Request textDocument/hover failed.
  Message: an exception was raised:
    ** (CaseClauseError) no case clause matching: %{actual_subject: "ElixirLsTestWeb.Layouts", docs: %{callbacks: "", docs: "> ElixirLsTestWeb.Layouts\n\nNo documentation available\n", types: ""}, range: %{begin: {8, 29}, end: {8, 52}}}
        (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
        (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  Code: -32000 
[Error - 09:51:07] Process #PID<0.182.1> raised an exception
** (CaseClauseError) no case clause matching: %{actual_subject: "ElixirLsTestWeb.Layouts", docs: %{callbacks: "", docs: "> ElixirLsTestWeb.Layouts\n\nNo documentation available\n", types: ""}, range: %{begin: {8, 29}, end: {8, 52}}}
    (language_server 0.14.5) lib/language_server/providers/hover.ex:24: ElixirLS.LanguageServer.Providers.Hover.hover/4
    (language_server 0.14.5) lib/language_server/server.ex:824: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2

Edit: I just noticed my comment could be more related to https://github.com/elixir-lsp/elixir-ls/issues/882 but the error message is the same.

nrzull commented 1 year ago

I discovered that such error appears on hover and not during start of vscode-elixir-ls so I close this issue in favor of #882