Comments (7)
Not an issue, my fault.
from edts.
This is because of where the erlang compiler looks for include-files. By default it only searches for the file relative to "." and the location of the file it's compiling. EDTS does not any directories in addition to this.
The below should work if some_lib is located one of the project's configured lib-dirs:
-include_lib("some_lib/include/other.hrl").
The below will only work if some.hrl is located in the same directory as the file where it is included, or if it's in the directory that is the current working directory at compile-time (bad idea to rely on this!).
-include("some.hrl").
The below always works since other.hrl will be found relative to the module location:
-include("../some.hrl").
from edts.
There are situations, when hrl file is still highlighed as missing, but M - . works fine. Sometimes it is not highlighted. Probably I should find out the test case which reproduce it.
from edts.
As far as I know according to otp principles hrl files should be located in include dir so it would be great if edts will have a chance to find them according to rebar information (include section in erl_opts) or in config.
-include("../include/some.hrl").
Ofcourse example above always works, but it's a bad practice in my opinion.
from edts.
Yes, M-. only parses part of the code and does not rely on the module being compiled/loaded on the project's node.
Putting hrl-files in the include-folder is the convention, but you should depend as little as possible on special configurations of your build system. In other words, alway use
-include_lib("some_lib/include/other.hrl").
or
-include("../include/other.hrl").
and never
-include("other.hrl").
Because you can never depend on that different build systems (rebar, EDTS, flymake, peoples own make-files etc.) will work in the same way. The first two examples should always work, no matter what build-system you use.
i will think about it, but I believe that the current workings are good, and that if I change it I will just hide people's compilation errors.
from edts.
As far as include-folder is the convention i think
-include("other.hrl").
should be used to point to hrl file in the include dir of application and if you want to point to hrl in the current dir or any other you can always make it explicit:
-include("./other.hrl").
But it's your turn to decide)))
p.s. So as you see I fully agree about the part of deps aplications and other build systems, the only thing I wanna change - relative paths in local app.
from edts.
Sorry, I made a mistake earlier.
There is a widespread (albeit undocumented) Erlang convention to put application-internal header-files (eg. containing records that should only be used inside the application) in the src directory and only keep header-files that are for "external" use in the include directory.
Thus
-include("other.hrl").
can be used to include application-internal headers, but should not be used for ones in the include-directory, IMHO.
from edts.
Related Issues (20)
- eproject: invalid-read-syntax HOT 3
- Does the OTP release of the EDTS node and the project node need to be the same? HOT 5
- Merging with OTP? HOT 4
- Starting node fails HOT 7
- How to run EDTS when the R19 patches haven't been merged HOT 1
- error on beam file without outdir in compile options not compiled in ebin directory HOT 1
- Command to compile current module in edts-shell HOT 8
- Windows: Could not start main server HOT 2
- project node constantly being reinitialized for each newly opened file HOT 4
- rebar3 mode for filename_to_outdir HOT 1
- EDTS Erlang files are not compiled as part of package installation HOT 4
- How to start edts with many user in 1 machine? HOT 1
- Symbol's value as variable is void: erlang-operators-regexp HOT 3
- EDTS sub package meck fails to compile on OTP 21 HOT 3
- EDTS stopped working when upgrading to OTP21 HOT 2
- edts-20200209.1523 work fail HOT 2
- When compiling MELPA package: can't find include file "otp_workarounds.hrl" HOT 1
- edts-rpc-port hardcoded to 4587
- edts-plugin-disabled-plugins default value and type mismatch HOT 2
- {error,"Release \"edts\" uses non existing application mochiweb"} HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edts.