Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after upgrading to Elixir 0.18 #235

Closed
igorgue opened this issue Jan 12, 2025 · 1 comment
Closed

Error after upgrading to Elixir 0.18 #235

igorgue opened this issue Jan 12, 2025 · 1 comment

Comments

@igorgue
Copy link

igorgue commented Jan 12, 2025

Ever since upgrading Elixir to 0.18, I get this error at the very top of the module, it happens when I have another error and I fix it and save.

Diagnostics:
** (MatchError) no match of right hand side value: {:debug_info_v1, :elixir_erl, {:elixir_v1, %{attributes: [behaviour: Plug], module: NsWeb.HlsController, file: "/home/igor/Code/nerdystreamer/lib/ns_web/controllers/hls_controller.ex", deprecated: [], unreachable: [], anno: {1, 1}, struct: nil, after_verify: [{NsWeb.HlsController, :__phoenix_verify_routes__}], defines_behaviour: false, definitions: [{{:send_file, 2}, :defp, [line: 13, column: 8], [{[line: 13, column: 8], [{:conn, [version: 0, line: 13, column: 18], nil}, {:normalized_path, [version: 1, line: 13, column: 24], nil}], [], {:case, [line: 14, optimize_boolean: true], [{{:., [line: 14, column: 14], [String, :starts_with?]}, [closing: [line: 14, column: 66], line: 14, column: 15], [{:normalized_path, [version: 1, line: 14, column: 28], nil}, {{:., [line: 14, column: 49], [Path, :expand]}, [closing: [line: 14, column: 65], line: 14, column: 50], ["output"]}]}, [do: [{:->, [line: 14], [[{:when, [line: 14], [{:x, [version: 2, line: 14, counter: {NsWeb.HlsController, 30}], Kernel}, {{:., [line: 14], [:erlang, :orelse]}, [line: 14], [{{:., [line: 14], [...]}, [line: 14], [{...}, ...]}, {{:., [...], ...}, [line: 14], [...]}]}]}], {{:., [line: 21, column: 24], [Plug.Conn, :send_resp]}, [closing: [line: 21, column: 58], line: 21, column: 25], [{:conn, [version: 0, line: 21, column: 7], nil}, 400, "Invalid filename"]}]}, {:->, [line: 14], [[{:_, [line: 14], Kernel}], {:case, [line: 15, optimize_boolean: true], [{{:., [line: 15, column: 14], [File, :exists?]}, [closing: [line: 15, column: 38], line: 15, column: 15], [{:normalized_path, [version: 1, line: 15, ...], nil}]}, [do: [{:->, [line: 15], [[{...}], {...}]}, {:->, [line: 15], [[...], ...]}]]]}]}]]]}}]}, {{:phoenix_controller_pipeline, 2}, :defp, [line: 1, context: Phoenix.Controller.Pipeline], [{[line: 1, context: Phoenix.Controller.Pipeline], [{:conn, [version: 0, line: 1], Plug.Builder}, {:action, [version: 1, line: 1, if_undefined: :raise], nil}], [], {:__block__, [line: 1], [{:=, [line: 1], [{:conn, [version: 2, line: 1, if_undefined: :raise], nil}, {:conn, [version: 0, line: 1], Plug.Builder}]}, {:=, [line: 1], [{:controller, [version: 3, line: 1, if_undefined: :raise], nil}, NsWeb.HlsController]}, {:=, [line: 1], [{:_, [line: 1], Phoenix.Controller.Pipeline}, {:conn, [version: 2, line: 1, if_undefined: :raise], nil}]}, {:=, [line: 1], [{:_, [line: 1], Phoenix.Controller.Pipeline}, {:controller, [version: 3, line: 1, if_undefined: :raise], nil}]}, {:=, [line: 1], [{:_, [line: 1], Phoenix.Controller.Pipeline}, {:action, [version: 1, line: 1, if_undefined: :raise], nil}]}, {:case, [line: 1, generated: true], [{{:., [line: 1], [Phoenix.Controller, :put_new_layout]}, [line: 1], [{:conn, [version: 0, line: 1], Plug.Builder}, [html: {NsWeb.Layouts, :app}]]}, [do: [{:->, [line: 1, generated: true], [[{:=, [line: 1, ...], [...]}], {:__block__, [line: 1, ...], [...]}]}, {:->, [line: 1, generated: true], [[{:=, [...], ...}], {:case, [...], ...}]}, {:->, [line: 1, generated: true], [[{:other, ...}], {{...}, ...}]}]]]}]}}]}, {{:init, 1}, :def, [from_super: false, line: 2, context: Phoenix.Controller.Pipeline], [{[line: 2, context: Phoenix.Controller.Pipeline], [{:opts, [version: 0, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}], [], {:opts, [version: 0, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}}]}, {{:index, 2}, :def, [line: 6, column: 7], [{[line: 6, column: 7], [{:conn, [version: 0, line: 6, column: 13], nil}, {:%{}, [closing: [line: 6, column: 43], line: 6, column: 19], [{"filename", {:filename, [version: 1, line: 6, column: 35], nil}}]}], [], {:__block__, [], [{:=, [end_of_expression: [newlines: 1, line: 7, column: 41], line: 7, column: 10], [{:path, [version: 2, line: 7, column: 5], nil}, {{:., [line: 7, column: 16], [Path, :join]}, [closing: [line: 7, column: 40], line: 7, column: 17], ["output", {:filename, [version: 1, line: 7, column: 32], nil}]}]}, {:=, [end_of_expression: [newlines: 2, line: 8, column: 40], line: 8, column: 21], [{:normalized_path, [version: 3, line: 8, column: 5], nil}, {{:., [line: 8, column: 27], [Path, :expand]}, [closing: [line: 8, column: 39], line: 8, column: 28], [{:path, [version: 2, line: 8, column: 35], nil}]}]}, {:send_file, [closing: [line: 10, column: 38], line: 10, column: 13], [{:conn, [version: 0, line: 10, column: 5], nil}, {:normalized_path, [version: 3, line: 10, column: 23], nil}]}]}}]}, {{:call, 2}, :def, [from_super: false, line: 2, context: Phoenix.Controller.Pipeline], [{[line: 2, context: Phoenix.Controller.Pipeline], [{:conn, [version: 0, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}, {:action, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}], [{{:., [line: 2, context: Phoenix.Controller.Pipeline, imports: [{1, Kernel}]], [:erlang, :is_atom]}, [line: 2, context: Phoenix.Controller.Pipeline, imports: [{1, Kernel}]], [{:action, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}]}], {:phoenix_controller_pipeline, [line: 2], [{{:., [line: 2], [Plug.Conn, :merge_private]}, [line: 2], [{:conn, [version: 0, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}, [phoenix_controller: NsWeb.HlsController, phoenix_action: {:action, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}]]}, {:action, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}]}}]}, {{:"action (overridable 2)", 2}, :defp, [from_super: true, from_super: false, line: 2, context: Phoenix.Controller.Pipeline], [{[line: 2, context: Phoenix.Controller.Pipeline], [{:=, [line: 2], [{:%, [line: 2], [Plug.Conn, {:%{}, [line: 2], [private: {:%{}, [line: 2], [phoenix_action: {:action, [version: 0, line: 2, ...], Phoenix.Controller.Pipeline}]}]}]}, {:conn, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}]}, {:_options, [version: 2, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}], [], {{:., [line: 2, context: Phoenix.Controller.Pipeline, imports: [{2, Kernel}, {3, Kernel}]], [:erlang, :apply]}, [line: 2, context: Phoenix.Controller.Pipeline, imports: [{2, Kernel}, {3, Kernel}]], [NsWeb.HlsController, {:action, [version: 0, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}, [{:conn, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}, {{:., [line: 2], [{:conn, [version: 1, line: 2, counter: {NsWeb.HlsController, 6}], Phoenix.Controller.Pipeline}, :params]}, [line: 2, no_parens: true], []}]]}}]}, {{:action, 2}, :def, [line: 1, context: Phoenix.Controller.Pipeline], [{[line: 1, context: Phoenix.Controller.Pipeline], [{:conn_before, [version: 0, line: 1, if_undefined: :raise], nil}, {:opts, [version: 1, line: 1, counter: {NsWeb.HlsController, 37}], Phoenix.Controller.Pipeline}], [], {:try, [line: 1], [[do: {:__block__, [line: 1], [{:=, [line: 1], [{:conn_after, [version: 2, line: 1, if_undefined: :raise], nil}, {:super, [super: {:defp, :"action (overridable 2)"}, line: 1], [{:conn_before, ...}, {...}]}]}, {:conn_after, [version: 2, line: 1, if_undefined: :raise], nil}]}, catch: [{:->, [line: 1], [[:error, {:reason, [version: 3, line: 1, counter: {NsWeb.HlsController, ...}], Phoenix.Controller.Pipeline}], {{:., [line: 1], [Phoenix.Controller.Pipeline, :__catch__]}, [line: 1], [{:conn_before, [version: 0, ...], nil}, {:reason, [...], ...}, NsWeb.HlsController, {...}, ...]}]}]]]}}]}, {{:__phoenix_verify_routes__, 1}, :def, [line: 1, context: Phoenix.VerifiedRoutes], [{[line: 1, context: Phoenix.VerifiedRoutes], [{:_module, [version: 0, line: 1, counter: {NsWeb.HlsController, 65}], Phoenix.VerifiedRoutes}], [], {{:., [line: 1], [Phoenix.VerifiedRoutes, :__verify__]}, [line: 1], [[]]}}]}], signatures: %{{:__phoenix_verify_routes__, 1} => {:infer, [{[%{dynamic: :term}], %{dynamic: :term}}]}, {:action, 2} => {:infer, [{[%{dynamic: :term}, %{dynamic: :term}], %{dynamic: :term}}]}, {:call, 2} => {:infer, [{[%{dynamic: :term}, %{dynamic: :term}], %{dynamic: %{map: [{:closed, %{owner: :term, port: :term, private: :term, scheme: :term, status: :term, script_name: :term, state: :term, host: :term, cookies: :term, params: :term, __struct__: %{atom: {:union, %{Plug.Conn => []}}}, halted: %{atom: {:union, %{true: []}}}, adapter: :term, secret_key_base: :term, request_path: :term, method: :term, assigns: :term, path_params: :term, query_params: :term, query_string: :term, resp_headers: :term, ...}, []}, {:closed, %{owner: :term, port: :term, private: :term, scheme: :term, status: :term, script_name: :term, state: :term, host: :term, cookies: :term, params: :term, __struct__: %{atom: {:union, %{Plug.Conn => []}}}, halted: :term, adapter: :term, secret_key_base: :term, request_path: :term, method: :term, assigns: :term, path_params: :term, query_params: :term, query_string: :term, ...}, []}]}}}]}, {:index, 2} => {:infer, [{[%{dynamic: :term}, %{dynamic: %{map: [{:open, %{}, []}]}}], %{dynamic: :term}}]}, {:init, 1} => {:infer, [{[%{dynamic: :term}], %{dynamic: :term}}]}}, impls: [], compile_opts: [], relative_file: "lib/ns_web/controllers/hls_controller.ex"}, []}}
    /home/igor/.local/share/.burrito/next_ls_erts-15.0_0.23.2/lib/next_ls-0.23.2/priv/monkey/_next_ls_private_compiler.ex:196: NextLSPrivate.Tracer.trace/2
    (elixir 1.18.1) src/elixir_env.erl:30: :elixir_env."-trace/2-lc$^0/1-0-"/3
    (elixir 1.18.1) src/elixir_env.erl:30: :elixir_env.trace/2
    (elixir 1.18.1) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

IEx 1.18.1 (compiled with Erlang/OTP 27)

Neovim latest nightly, so 0.11.x

My LazyVim extra config:

local elixir_ft = { "elixir", "eex", "heex", "surface" }

vim.filetype.add({
  extension = {
    ["neex"] = "heex",
  },
})

local ok, icons = pcall(require, "nvim-web-devicons")
if ok then
  icons.set_icon({
    [".neex"] = { icon = "", color = "#916AB2", name = "Neex" },
  })
  icons.set_icon({
    neex = { icon = "", color = "#916AB2", name = "Neex" },
  })
end

return {
  {
    "SmiteshP/nvim-navic",
    optional = true,
    opts = {
      lsp = {
        preference = { "nextls" },
      },
    },
  },
  {
    "nvim-treesitter/nvim-treesitter",
    lazy = false,
    ft = elixir_ft,
    opts = {
      ensure_installed = elixir_ft,
      highlight = {
        enable = true,
      },
      indent = {
        enable = true,
      },
    },
  },
  {
    "neovim/nvim-lspconfig",
    ft = elixir_ft,
    opts = {
      setup = {
        -- stylua: ignore start
        elixirls = function() return true end,
        nextls = function() return true end,
        -- stylua: ignore end
      },
    },
  },
  {
    "elixir-tools/elixir-tools.nvim",
    dependencies = {
      "elixir-editors/vim-elixir",
      "nvim-lua/plenary.nvim",
    },
    ft = elixir_ft,
    -- stylua: ignore
    enabled = not vim.o.diff,
    config = function()
      local elixir = require("elixir")

      local register_keys = function()
        local wk = require("which-key")
        local bufnr = vim.api.nvim_get_current_buf()

        wk.add({
          { "<leader>cE", group = "elixir" },
          { "<leader>cEp", "<cmd>ElixirToPipe<cr>", desc = "To Pipe" },
          { "<leader>cEP", "<cmd>ElixirFromPipe<cr>", desc = "From Pipe" },
          { "<leader>cEm", "<cmd>ElixirExpandMacro<cr>", desc = "Expand Macro" },
          { "<leader>cEr", "<cmd>ElixirRestart<cr>", desc = "Restart" },
          { "<leader>cEo", "<cmd>ElixirOutputPanel<cr>", desc = "Output Panel" },
        }, { buffer = bufnr })
      end

      vim.api.nvim_create_autocmd(
        "FileType",
        { pattern = { "elixir", "eex", "heex", "surface" }, callback = register_keys }
      )

      elixir.setup({
        nextls = {
          enable = true,
          spitfire = true,
          init_options = {
            experimental = {
              completions = {
                enable = true,
              },
            },
            extensions = {
              credo = {
                enable = false,
              },
              elixir = {
                enable = false,
              },
            },
          },
        },
        credo = { enable = false },
        elixirls = { enable = false, tag = "v0.26.2" },
      })
    end,
  },
  {
    "mfussenegger/nvim-dap",
    config = function()
      -- FIXME: I think this is broken... Is not debugging right now,
      -- lets use `pry` instead...
      -- TODO: this needs to use the one on elixir-tools not mason's
      -- elixir-tools does not download this `debug_adaper.sh` script
      -- but mason does, so we use the one on mason.
      local mason = (os.getenv("HOME") or "") .. "/.local/share/nvim/mason"
      local dap = require("dap")

      dap.adapters.elixir = {
        type = "executable",
        command = mason .. "/packages/elixir-ls/debug_adapter.sh",
      }

      dap.configurations.elixir = {
        type = "elixir",
        name = "Run Elixir Program",
        task = "phx.server",
        taskArgs = { "--trace" },
        request = "launch",
        startApps = true, -- for Phoenix projects
        projectDir = "${workspaceFolder}",
        requireFiles = {
          "test/**/test_helper.exs",
          "test/**/*_test.exs",
        },
      }
    end,
  },
}
@mhanberg
Copy link
Collaborator

Duplicate of elixir-tools/next-ls#558

@mhanberg mhanberg marked this as a duplicate of elixir-tools/next-ls#558 Jan 12, 2025
@mhanberg mhanberg closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants