intellij-erlang icon indicating copy to clipboard operation
intellij-erlang copied to clipboard

how are found OTP lib/applications?

Open benoitc opened this issue 5 years ago • 5 comments

I'm wondering how the OTP applications? Can they be created in any folder? I'm thinking too make all apps part of a subfolder like this:

subfolder/
   app1/src
            src/app1.app.src
            src/...
           rebar.config
   app2/
            ...
   ...

will app1 functions be found during the code completion? Is there any seeting fo r it if not?

benoitc avatar Nov 26 '18 14:11 benoitc

We don't have any setting for that, sorry. But you may request a new one :)

ignatov avatar Nov 28 '18 10:11 ignatov

@ignatov mmm ok , does it means it won't find the apps though ? :)

benoitc avatar Nov 28 '18 10:11 benoitc

@benoitc You can use modules in Erlang project in IntelliJ with the plugin to achieve this. You create IntellIJ (erlang type) modules app1, app2, ... in your project and the code completion will work accross modules.

The default path settings for modules should match your structure. Then you can tweak also tweak the output paths for the modules (if you by any chance want to start compilation in IntelliJ) or just use rebar for building

JakaBac avatar Dec 22 '18 22:12 JakaBac

@JakaBac

You can use modules in Erlang project in IntelliJ with the plugin to achieve this. You create IntellIJ (erlang type) modules app1, app2, ... in your project and the code completion will work accross modules.

How?

benoitc avatar Jan 16 '19 22:01 benoitc

@benoitc Suppose you have your example folder structure (let's say that subfolder is your IntelliJ project folder) For app1, app2,... you create a new module in the IntelliJ project (File->New Module from Existing sources).

After the modules are created, for each one you verify/configure (File->Project Structure). In "Project Settings" go to modules and for each module select the sources tab. There you need to verify or configure that the src folder is marked as sources. Optionally if you have includes folder with .hrl files mark the folder as "includes".

Also if you want to use IntelliJ to build the project, configure Paths (compiler output paths) and dependencies.

Or you can just use rebar to build your project. The only problematic thing with running rebar3 externally is when you use it to create new app or manage dependancies, since you need to manually configure modules in IntelliJ to match the folder structure that rebar created.

With proper "Project Structure" configuration for modules, the Intellij-Erlang plugin will parse everything and code completion will work across modules (apps).

It is not as seamless as with IntelliJ "first class" languages, but gets close enough :)

JakaBac avatar Jan 18 '19 11:01 JakaBac