atom-elixir icon indicating copy to clipboard operation
atom-elixir copied to clipboard

Create a configuration to define elixir's source path

Open msaraiva opened this issue 8 years ago • 4 comments

Discussion here.

msaraiva avatar Jun 27 '16 22:06 msaraiva

Also print a better message than "Can't find TheModule"

msaraiva avatar Jun 27 '16 22:06 msaraiva

Do not see any disadvantages for that. In addition it seems to me that along with language growth more and more developers will install binaries.

insiderq avatar Jun 27 '16 23:06 insiderq

just to inform everyone landing here, for me there was two problems:

  • I'm using asdf to manage the versions of elixir and erlang, the binary is in my classpath, but for some reason I have to symlink elixir and erl executables in my /usr/local/bin folder to make it work.
  • If the project is compiled inside a container, it has the wrong path of the file, so I think that go to definition could not work. If I compile the file from the host machine everything works as expected.

So, as far as I know, if you are using docker there is nothing you can do to make go to definition work.

matteosister avatar Aug 19 '16 09:08 matteosister

Hi everyone, I have started investigation about Go to Definition for VSCode Elixir plugin, but would like to see if in Atom community resolution would go faster :)

Confirm what @matteosister says about compiling sources inside Docker. I have even prepeared a small proof of concept repo with steps to reproduce in readme https://github.com/iJackUA/vscode-elixir-docker-test (sorry for the repo name, it is not only for vscode :) )

I think the solution is to have a special Workspace/Project scope setting variable to specify path mapping. I've succeeded to quick-fix this issue in vscode that uses Alchemist server as easy as that - just add String replace for source file

https://github.com/fr1zle/vscode-elixir/blob/bffea3539ccfd605dfc62729551d86fd886ba153/alchemist-server/lib/api/defl.exs#L118

      case module.module_info(:compile)[:source]  do
        nil    -> nil
        source -> List.to_string(source) |> String.replace("/www", "/Users/ievgen/Projects/Elixir/vscode-elixir-docker-test/")
      end

It look slike Atom elixir uses the same method (module_info) to get source file https://github.com/msaraiva/atom-elixir/blob/27582d5bcb86502366447e146151d1f5bdfceaef/lib/elixir_sense/lib/elixir_sense/providers/definition.ex#L38

@msaraiva what do you think? Is it possible to have such kind of option to manually specify what path to (in my example it is /www) to map to current project folder? I see that Atom does not have such concept as Project or Local workspace settings, but maybe at least to have an ability to put optional (!) .atom-elixir.json config file in root project folder with extension settings?

iJackUA avatar Apr 13 '17 12:04 iJackUA