Unable to autocomplete/hover macro in Phoenix Project
Opened this issue · 4 comments
The project is running in VSCode devcontainer
Sample Code
defmodule AppWeb.PageController do
use AppWeb, :controller
def home(conn, _params) do
# The home page is often custom made,
# so skip the default app layout.
render(conn, :home, layout: false)
end
end
defmodule AppWeb do
@spec controller() :: {:__block__, [], [{:import, [...], [...]} | {:use, [...], [...]}, ...]}
def controller do
quote do
use Phoenix.Controller,
formats: [:html, :json],
layouts: [html: AppWeb.Layouts]
import Plug.Conn
import AppWeb.Gettext
unquote(verified_routes())
end
end
- Elixir & Erlang versions (elixir --version):
elixir 1.17.3/OTP 27 - Elixir Language Server version:
ElixirLS v0.24.1 - Operating system:
MacOS - Editor or IDE name (e.g. Emacs/VSCode):
VSCode
Elixir-LS Log
[Warn - 11:40:30 AM] Unable to expand macro AppWeb.__using__/1: ** (FunctionClauseError) no function clause matching in AppWeb.__using__/1
(app 0.1.0) expanding macro: AppWeb.__using__/1
nofile:2: AppWeb.PageController (module)
Reproduction steps
- install elixir-ls in VSCode
- Create fresh project using
mix phx.new app
Which macros are you trying to hover on? In which files is autocomplete not working?
Which macros are you trying to hover on? In which files is autocomplete not working?
i was trying to hover this :controller
which is a function defined in AppWeb
i was wondering why it doesn't allow navigation/autocomplete/hover info. This file is under lib/controllers/page_controller.ex in a fresh Phoenix project
Unable to expand macro Phoenix.Component.Declarative.pattern!/2: ** (ArgumentError) could not call Module.delete_attribute/2 because the module MyAppWeb.MyViewLive.FormComponent is already compiled
(elixir 1.17.3) lib/module.ex:2365: Module.assert_not_readonly!/2
(elixir 1.17.3) lib/module.ex:1641: Module.delete_attribute/2
(phoenix_live_view 0.20.17) lib/phoenix_component/declarative.ex:1028: Phoenix.Component.Declarative.pop_slots/1
(phoenix_live_view 0.20.17) lib/phoenix_component/declarative.ex:707: Phoenix.Component.Declarative.register_component!/4
(phoenix_live_view 0.20.17) expanding macro: Phoenix.Component.Declarative.pattern!/2
I can't make it working for any macro accessing attributes/compile time properties of module in using and before_compile functions.
Started ElixirLS v0.24.1
ElixirLS built with elixir "1.17.3" on OTP "27"
Using last version of elixir (1.17.3-otp-27) and OTP (27.1.2) installed via asdf.
im trying to work with elixir-ls lsp from zed editor on Mac OS system.
Unable to expand macro Phoenix.Component.Declarative.pattern!/2: ** (ArgumentError) could not call Module.delete_attribute/2 because the module MyAppWeb.MyViewLive.FormComponent is already compiled
That's a know limitation