erlang / erlide_eclipse

Eclipse IDE for Erlang

Home Page:http://erlide.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rebar3 Support: Code completion in Editor and Console

Morabaraba opened this issue · comments

disclaimer I'm new to erlang, rebar3 and erlide

Eclipse Platform 4.3.2.v20140221-1852
Erlide 0.32.201604231840
rebar 3.1.0 on Erlang/OTP 17 Erts 6.4

I created a project with rebar3 rebar3 new app luckyluke I then added {deps, [cowboy]}. to rebar.config and compile the project using rebar3 compile. It compiles to _build:

_build/default/lib/cowboy/ebin
_build/default/lib/cowlib/ebin
_build/default/lib/luckyluke/ebin
_build/default/lib/ranch/ebin

Each build also has a src directory with luckyluke linking to the base src and include.

I can execute my module with erl

erl -pa _build/default/lib/luckyluke/ebin/ -pa _build/default/lib/cowboy/ebin/ -pa _build/default/lib/cowlib/ebin/ -pa _build/default/lib/ranch/ebin/

What must I do to enable code completion in the editor and console. I already changed INTERNAL to REBAR in .settings/org.erlide.model.prefs.

Is this possible?

At the moment, dependencies are not detected and handled. I am working on that.

Until then, you can add the dependencies to the source directories: in the project's properties, under erlang, let "source directories" be src;_build/default/lib/cowboy/src;_build/default/lib/ranch/src;_build/default/lib/cowlib/src;_build/default/lib/luckyluke/src and similar for the include directories.

Thanks, adding it worked for code completion.

I decided to use erws as a test project. When I called application:ensure_all_started(erws) it err'd

{error,{goldrush,{"no such file or directory",
                  "goldrush.app"}}}

I symlinked the *.app files into the ebin/ directory

 cd ebin/
 ln -s ../_build/default/lib/ranch/ebin/ranch.app
 ln -s ../_build/default/lib/cowlib/ebin/cowlib.app
 ln -s ../_build/default/lib/lager/ebin/lager.app
 ln -s ../_build/default/lib/goldrush/ebin/goldrush.app

I feel it is wrong, what would be the correct method?

The lager dep failed on needing a include so I added

include;_build/default/lib/cowboy/include;_build/default/lib/ranch/include;_build/default/lib/cowlib/include;_build/default/lib/lager/include;_build/default/lib/goldrush/include;

to project properties > erlang > include directories

Ran application:ensure_all_started(erws) and it worked, also stopped on my breakpoint 😄

How hard would it be to add something like src;_build/default/lib/*/src; to erlide for source and include directories in project properties? Maybe something that runs and replace when the property change gets applied.

ps. erws atm is not working for me, but it a ws issue and not erlide one.

How hard would it be to add something like src;_build/default/lib/*/src; ?

That is a good idea!

Regarding the different *.app files, there is no good way to do that yet. The easiest way would be to do something similar for output directories (ebin:/_build/default/lib/*/ebin)

I am reopening this ticket to track these improvements.

update on the rebar3 integration status?

Unfortunately, not much, I got focused on a different track. Are the things discussed here enough for what you need @DeadZen? I will try to implement them, hopefully that will cover most of the issues.

Edit: What I am working on now is reimplementing a lot of the code in Erlang, as a language server that can be used from multiple clients (eclipse, vscode, etc). So it feels a little bit wasteful to do it in Java too; on the other hand, the new implementation might take a while longer...

update on the rebar3 integration status?

Sorry, there has not been any development on this for a (long) while, as I no longer use it myself at work and got other projects going. Unfortunately, it's not easy for someone else to improve the code. I think the best way would be to start over using the language servers available, so that the actual functionality is handled elsewhere and here there is only an adaptation to Eclipse.

It's a pity!