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
843 stars 52 forks source link

Error in elixir-ls compilation in Visual Studio Code #167

Closed dipayanb closed 5 years ago

dipayanb commented 5 years ago

Environment

Issue

Included Ueberauth and then created a AuthController and added Ueberauth plug, then elixir-ls started giving the below error. Below is the error from the output pane in vscode

Compiling with Mix env test
==> core_service
Compiling 28 files (.ex)

== Compilation error in file lib/core_service_web/controllers/auth_controller.ex ==
** (MatchError) no match of right hand side value: :error
    lib/ueberauth.ex:307: Ueberauth.get_providers/2
    lib/ueberauth.ex:239: Ueberauth.init/1
    (plug) lib/plug/builder.ex:302: Plug.Builder.init_module_plug/4
    (plug) lib/plug/builder.ex:286: anonymous fn/5 in Plug.Builder.compile/3
    (elixir) lib/enum.ex:1940: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plug) lib/plug/builder.ex:284: Plug.Builder.compile/3
    (phoenix) expanding macro: Phoenix.Controller.Pipeline.__before_compile__/1
    lib/core_service_web/controllers/auth_controller.ex:1: CoreServiceWeb.AuthController (module)
[Info  - 11:35:49 PM] Compile took 725 milliseconds

Relevant code

defmodule CoreServiceWeb.AuthController do
  use CoreServiceWeb, :controller

  plug Ueberauth

  import Plug.Conn

  def callback(conn, params) do
    IO.inspect(conn)
    IO.inspect(params)

    conn
    |> redirect(to: "/")
  end
end

This is a normal elixir umbrella project with a phoenix app being one of the app.

There is no error in the developer tools.

No error when compiled from terminal.

> mix clean
> mix compile
==> auth_lib
Compiling 3 files (.ex)
Generated auth_lib app
==> core_service
Compiling 25 files (.ex)
Generated core_service app
dipayanb commented 5 years ago

It is not an issue as the default mixEnv was set to test ("elixirLS.mixEnv": "test") and I did not have some settings in test configuration. Changed it to "dev" and things started working fine.