ignatov / intellij-erlang

Erlang IDE
https://www.jetbrains.com/help/idea/2018.2/getting-started-with-erlang.html
Other
735 stars 120 forks source link

unresolved record/function even if rebar compilation succeeded. #326

Closed oujinliang closed 11 years ago

oujinliang commented 11 years ago

inetllij-erlang version 0.5, just upgraded a few days ago.

In erlang editor, I see 'unresolved record error' like this: erlang-ide-error

But it compiled successfully with rebar (Make module) It seems I have to add non-standard include paths manually after I upgraded the plugin.

jmarksharkey commented 11 years ago

just upgraded and am seeing the same thing

WS-129.541

ignatov commented 11 years ago

Please provide code examples for reproducing.

deadok22 commented 11 years ago

Hi, guys! Could you please provide some information concerning your projects? Where are unresolved records and functions located? I guess they are in deps/%lib_name% folders. Please share your rebar.config and .app files and check if each directory under deps/%lib_name% contains .iml files.

jmarksharkey commented 11 years ago

Hey, thanks for looking into this.

so my project is using the standard erlang/OTP directory structure as far as I'm aware.

This is the rebar.config in the root directory of the project

{sub_dirs,["deps","apps"]}. {lib_dirs,["apps"]}. {depsdir,["deps"]}. {deps, [ {n2o, ".", {git, "git://github.com/5HT/n2o.git", "HEAD"}}, {jiffy, ".", {git, "git://github.com/davisp/jiffy.git", "HEAD"}}, {gettext, ".", {git, "git://github.com/etnt/gettext", "HEAD"}}, {sockjs, "._", {git, "git://github.com/sockjs/sockjs-erlang", "HEAD"}}, {rabbitcommon, ".", {git, "git://github.com/jbrisbin/rabbit_common", "HEAD"}}, {amqpclient, ".", {git, "git://github.com/jbrisbin/amqp_client", "HEAD"}}, {mochiweb, ".*", {git, "git://github.com/mochi/mochiweb", "HEAD"}}

]}.

The .hrl file for the app is in the apps/web/include directory of the project

No sign of .iml files in deps/%lib_name%

ignatov commented 11 years ago

@oujinliang Also please specify your IDE version.

jmarksharkey commented 11 years ago

WebStorm -129.541

ignatov commented 11 years ago

@jmarksharkey As I understand correctly, initially you've created the project via 'Open directory' action, right?

jmarksharkey commented 11 years ago

correct - it was an existing project. 


From: Sergey Ignatov notifications@github.com To: ignatov/intellij-erlang intellij-erlang@noreply.github.com Cc: jmarksharkey jmarksharkey@yahoo.com.au Sent: Sunday, September 29, 2013 9:46 PM Subject: Re: [intellij-erlang] unresolved record/function even if rebar compilation succeeded. (#326)

@jmarksharkey As I understand correctly, initially you've created the project via 'Open directory' action, right? — Reply to this email directly or view it on GitHub.

brigadier commented 11 years ago

probably related to this https://github.com/ignatov/intellij-erlang/issues/296

oujinliang commented 11 years ago

Thanks for quick response my IDEA version is 12.1.4 My rebar.config is as below:

     {lib_dirs, ["lib"]}.
     {sub_dirs, ["apps/stringprep"]}.
     {erl_opts, [
           {i, ["src/queue_processor/xmpush" ]},
            {i, ["src/thrift" ]},
            {i, ["src/rabbitmq" ]},
            {i, ["src/zookeeper" ]},
            {i, ["include/xmpp" ]},
            {i, ["deps/xmqp_protocol/include" ]},
            {i, ["deps/amqp_client/include" ]},
            {i, ["deps/eredis/include" ]},
            {i, ["lib/xmqp_client/include" ]},
            {parse_transform, lager_transform}
           ]}.

     {deps_dir, "./deps"}.
     {deps, [ % some dependencies
     ]}.

some *.hrl which define the unresolved records/functions are under ./deps/%lib name %/include and under ./src/%subfolder%/

deadok22 commented 11 years ago

@jmarksharkey could you show me an example of your 'include' or 'include_lib' attributes which are causing the problem? It would also be great if you could point out some open source project or come up with a sample project of your own, where the issue occurs.

brigadier commented 11 years ago

deadok22, this happens in absolutely every project. Clone any project and open directory. I've just tried it with bitcask.

-include("path/to/include.hrl"). - works -include("include.hrl"). - does not work, even if the lib is as usually placed in include/ directory

include directory isn't marked as "include path", as it is impossible (and imo it always should be marked by default for directory named "include") to "setup include directory in the facet correctly" in small IDE's. And there's no "Some 'include' folders are not marked as include paths" notification.

PyCharm, Gentoo Linux, if it is matter

ignatov commented 11 years ago

@brigadier Sure, it's really matter.

deadok22 commented 11 years ago

Thank you, guys - the fix is about to come.

ignatov commented 11 years ago

Hi guys, please check out the 385 build.

brigadier commented 11 years ago

385th works correctly when Idea root is the same as app root (i.e. almost always). Does not work when Idea root is one directory above app root (rare case, only needed when working simultaneously with two or more somewhat related, but independent apps.

oujinliang commented 11 years ago

@ignatov , 385 build works fine after reimported the module (remove the module and reimport), thanks for the fix. BTW, I didn't find a way to reimport for the existing module, like maven module does.

ignatov commented 11 years ago

@oujinliang we haven't this feature yet.

ignatov commented 11 years ago

@brigadier PyCharm?

brigadier commented 11 years ago

Yes, PyCharm

deadok22 commented 11 years ago

@brigadier could you please provide an example of what you're talking about? That is directory structure, 'open directory' action's root, location of includes, paths from include strings that fail to resolve.

brigadier commented 11 years ago

I'm sorry, disregard my previous mesage. I was wrong when talked about idea root and app root. What does not work is includes in nested source directories. For example, in an app with the following structure:

app -
        ebin -
                app.app
        include -
                appinc.hrl
        src -
                foo.erl
                src2 -
                      bar.erl

-include("appinc.hrl") works in foo.erl but shows an error in bar.erl.

rebar compiles this app just fine.

ignatov commented 11 years ago

@brigadier Please try the 391 build.

brigadier commented 11 years ago

Works, thank you!