KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.8k stars 152 forks source link

Attach Sources so that Go To Declaration for SDK shows source and not decompiled #1758

Open sv158 opened 4 years ago

sv158 commented 4 years ago

Describe the bug in Intellij IDEA 2020.1, right-click at a function and then select "Go to>Implementation", it will show the source file of that function. But in Pycharm 2020.1 community edition, it will show the related beam file(and there is nothing except a function stub). Moreover, no only the "go to implementation", but other "go to" feature such as "go to declaration" also work in the wrong way.

To Reproduce Steps to reproduce the behavior:

  1. Move cursor to arbitrary function, e.g. Enum.slice/2
  2. Right click at the function, choose 'Go to'>'Implementation'
  3. the file C:\Program Files (x86)\Elixir\lib\elixir\ebin\Elixir.Enum.beam will be opened at located to line:338

Expected behavior the file C:\Program Files (x86)\Elixir\lib\elixir\lib\enum.ex opened and located to line:2364

Screenshots

图片 图片

Logs

No related logs.

Desktop:

Erlang:

Elixir:

Plugin:

Additional context

Sometimes the Pycharm will noticed that "Elixir Facet SDK is not defined", however I'm surely confirmed that both Erlang SDK and Elixir SDK has been config in place. And in the Pycharm, there can not find something call "Elixir Facet SDK" to config.

KronicDeth commented 4 years ago

That's not how the SDK system works. It doesn't know you have the source files as most package managers and installers don't include the sources, but just the beams. There's no way currently for the Go To Declaration to know where the source for a given .beam file is. The .beam Chunk CInf has a :source key, but it is the location of the file on the build machine.

Screen Shot 2020-04-24 at 8 06 08 AM

What you're looking for is an Attach Sources feature.

sv158 commented 4 years ago

@KronicDeth Thanks for your reply, But I think it is totally two different things. What you said is find the source file of such a .beam file, and what I talk about is the different behavior of "Go to Implementation"(also for "Go to Declaration") between Intellij IDEA and Pycharm. In Intellij, the plugin do works well(see img below): 图片 and compared with pycharm side: pycharm That's the difference.

Btw, it can be an enhancement of the plugin like you said.