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

Debugging Scenic silently exits on launch #194

Closed tiger808 closed 4 years ago

tiger808 commented 5 years ago

Environment

Crash Report

Attempting to debug an app using Scenic: https://github.com/boydm/scenic

  1. Make a new Scenic example app:
    mix scenic.new.example my_app
    cd my_app
    mix do deps.get, scenic.run
  2. Add a launch configuration that excludes the NIF modules:
    {
        "type": "mix_task",
        "env": {"MIX_ENV": "dev"},
        "name": "mix scenic.run",
        "request": "launch",
        "task": "scenic.run",
        "projectDir": "${workspaceRoot}",
        "excludeModules": ["Scenic.Math.Line", "Scenic.Math.Matrix", "Scenic.Utilities.Texture"]
    }
  3. SELECT THE "mix scenic.run" configuration and debug. Debug console shows:
    Started ElixirLS debugger
    Elixir version: "1.9.1 (compiled with Erlang/OTP 22)"
    Erlang version: "22"

    The Scenic app window flashes on the screen for a fraction of a second, and then exits.

I don't see anything suspicious looking in the logs.

mattraykowski commented 5 years ago

I don't think this is specific to Scenic, as we're seeing it in Phoenix and other non-Phoenix projects as well. See #185 .

joshua-andrassy commented 5 years ago

Have been experiencing this myself with various Plug and Phoenix projects using Elixir 1.9.x. Using 1.8.x always resolves the issue for me.

Did some tinkering this weekend and it appears this is where things are going awry: https://github.com/JakeBecker/elixir-ls/blob/ca277c10a81ab0486cd1426da1386ef573701240/apps/debugger/lib/debugger/server.ex#L566

With 1.8.x, Mix.Task.run does not return With 1.9.x, Mix.Task.run returns with :ok.

Elixir is still very much a language I'm working with in my spare time and next steps for me would be to compare differences between 1.8.x and 1.9.x in regards to Mix.Task.run.

Additional notes Curious if its related to this change in 1.9.x from 1.8.x where Process.sleep is no longer called in favor of System.no_halt

1.8.2 https://github.com/elixir-lang/elixir/blob/98485daab0a9f3ac2d7809d38f5e57cd73cb22ac/lib/mix/lib/mix/tasks/run.ex#L87

1.9.4 https://github.com/elixir-lang/elixir/blob/055526057ac9992cc1df87441357c4e56d45235d/lib/mix/lib/mix/tasks/run.ex#L86

axelson commented 4 years ago

I just published version 0.2.28 of the ElixirLS fork that solves this issue: https://github.com/elixir-lsp/elixir-ls

And thanks @joshua-andrassy for the investigation! That was very helpful.

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!