JakeBecker / elixir-ls

A frontend-independent IDE "smartness" server for Elixir. Implements the JSON-based "Language Server Protocol" standard and provides debugger support via VS Code's debugger protocol.
Apache License 2.0
846 stars 52 forks source link

Switching projects in Sublime Text triggers a crash #189

Closed jtrees closed 4 years ago

jtrees commented 5 years ago

Description

When switching projects in Sublime Text (e.g. from an elixir project to a ruby project) the language server crashes.

Steps to Reproduce

  1. Open an elixir project in Sublime Text.
  2. Ensure the language server is running.
  3. Switch to a non-elixir project (e.g. via Ctrl+Alt+P).

Expected Behavior

The language server should shutdown cleanly.

Actual Behavior

An error is raised and the language server crashes.

Environment

Elixir & Erlang versions (elixir --version)

Erlang/OTP 22 [erts-10.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Elixir 1.9.0 (compiled with Erlang/OTP 22)

Operating system

elementary OS 5.0 (based on Ubuntu 18.04)

Client (editor or IDE)

Sublime Text 3.2.1

Related Logs

14:21:41.764 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (FunctionClauseError) no function clause matching in ElixirLS.LanguageServer.Server.handle_notification/2
    (language_server) lib/language_server/server.ex:208: ElixirLS.LanguageServer.Server.handle_notification(%{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}, %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [%Mix.Task.Compiler.Diagnostic{compiler_name: "ElixirLS", details: nil, file: "/foo/mix.exs", message: "No mixfile found in project. To use a subdirectory, set `elixirLS.projectDir` in your settings", position: nil, severity: :error}], build_ref: #Reference<0.3463561736.958922755.34657>, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => []}}}, "colorProvider" => %{}, "completion" => %{"completionItem" => %{"snippetSupport" => true}, "completionItemKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, "declaration" => %{}, "definition" => %{}, "documentHighlight" => %{}, "documentSymbol" => %{"symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, "formatting" => %{}, "hover" => %{"contentFormat" => ["markdown", "plaintext"]}, "implementation" => %{}, "rangeFormatting" => %{}, "references" => %{}, "rename" => %{}, "signatureHelp" => %{"signatureInformation" => %{"documentationFormat" => ["markdown", "plaintext"], "parameterInformation" => %{"labelOffsetSupport" => true}}}, "synchronization" => %{"didSave" => true}, "typeDefinition" => %{}}, "workspace" => %{"applyEdit" => true, "didChangeConfiguration" => %{}, "executeCommand" => %{}, "symbol" => %{"symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}}}, dialyzer_diagnostics: [], dialyzer_sup: #PID<0.108.0>, needs_build?: false, project_dir: "/foo", received_shutdown?: false, requests: %{}, root_uri: "file:///foo", settings: %{}, source_files: %{}})
    (language_server) lib/language_server/server.ex:145: ElixirLS.LanguageServer.Server.handle_cast/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:receive_packet, %{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}}}
State: %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [%Mix.Task.Compiler.Diagnostic{compiler_name: "ElixirLS", details: nil, file: "/foo/mix.exs", message: "No mixfile found in project. To use a subdirectory, set `elixirLS.projectDir` in your settings", position: nil, severity: :error}], build_ref: #Reference<0.3463561736.958922755.34657>, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => []}}}, "colorProvider" => %{}, "completion" => %{"completionItem" => %{"snippetSupport" => true}, "completionItemKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}}, "declaration" => %{}, "definition" => %{}, "documentHighlight" => %{}, "documentSymbol" => %{"symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}, "formatting" => %{}, "hover" => %{"contentFormat" => ["markdown", "plaintext"]}, "implementation" => %{}, "rangeFormatting" => %{}, "references" => %{}, "rename" => %{}, "signatureHelp" => %{"signatureInformation" => %{"documentationFormat" => ["markdown", "plaintext"], "parameterInformation" => %{"labelOffsetSupport" => true}}}, "synchronization" => %{"didSave" => true}, "typeDefinition" => %{}}, "workspace" => %{"applyEdit" => true, "didChangeConfiguration" => %{}, "executeCommand" => %{}, "symbol" => %{"symbolKind" => %{"valueSet" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}}}}, dialyzer_diagnostics: [], dialyzer_sup: #PID<0.108.0>, needs_build?: false, project_dir: "/foo", received_shutdown?: false, requests: %{}, root_uri: "file:///foo", settings: %{}, source_files: %{}}

Notes

lukaszsamson commented 4 years ago

See https://github.com/elixir-lsp/elixir-ls/pull/130#issuecomment-589934892

JakeBecker commented 4 years ago

This project has moved!

It's now being maintained by proactive volunteers from the Elixir community over at elixir-lsp/elixir-ls. Updates will continue to be published from that repo to the original VS Code extension, so no need to switch plugins if you're using VS Code.

To avoid inundating the new maintainers with issues, please verify that your issue persists with the latest version of the extension (which is published from the new repo) before re-filing your issue there.

Thanks for using ElixirLS!