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

"Go to definition" does not work within the scope of a Phoenix router #618

Closed
Sleepful opened this issue Nov 1, 2021 · 3 comments
Closed

Comments

@Sleepful
Copy link

Sleepful commented Nov 1, 2021

This is in the README.

* "Go to definition" does not work within the `scope` of a Phoenix router

Is there a GH issue for this already?

Any clue why it doesn't work?

@khanakia
Copy link

khanakia commented Nov 7, 2021

Go To Definition also does not work for elixir source code.
Ref: elixir-lsp/elixir_sense#44

@lukaszsamson
Copy link
Collaborator

Any clue why it doesn't work?

@Sleepful Phoenix Router macros mess with modules in scopes. e.g. in

scope "/", Foo.Bar do
    pipe_through :browser

    scope "/some" do
      get "/:id", MyController, :index
    end
end

MyController is transformed to Foo.Bar.MyController. To make it work someone would need to write a phoenix plugin to elixir_sense or add some hacks to ElixirSense.MetadataBuilder to make it understand how those macros work.
If you use a full module name (or properly alias it), then go to definition should work (not sure if router would still work though)

@lukaszsamson
Copy link
Collaborator

Tracked in elixir-lsp/elixir_sense#281

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

3 participants