Behaviors from Rebar dependencies are not recognized
Describe the bug In projects using Rebar 3 with dependencies that supply a behavior, the following warning is generated:
src/module.erl:
4:1 warning behavior thebehaviour undefined Compiler
To Reproduce Use a behavior from a Rebar 3 dependency.
Expected behavior
Compilation should behave exactly as rebar3 compile.
Actual behavior Invalid warnings are generated.
Context
-
erlang_lsversion (tag/sha):Version: 0.14.0+build.1534.refc3ba39d - Editor used: Sublime Text 4 (4102)
- LSP client used: LSP v1.2.13
Hi @eproxus what does your erlang_ls.config file looks like? https://erlang-ls.github.io/configuration/
@robertoaloi I don’t have one as far as I’m aware 😊
Ah, then your Erlang LS experience may be suboptimal :) This is what I have for an "umbrella" project:
apps_dirs:
- "apps/*"
deps_dirs:
- "_build/default/lib/*"
include_dirs:
- "apps"
- "apps/*/include"
- "_build/default/lib/"
- "_build/default/lib/*/include"
I successfully used this config in a normal Rebar project (which supports checkouts):
deps_dirs:
- "_build/default/lib/*"
- "_build/default/checkouts/*"
include_dirs:
- "_build/default/lib/*/include"
- "_checkouts/*/include"
I understand that Erlang LS is a general tool, but I also find it a bit odd that it doesn't work out of the box with Rebar projects (which by now are ~95% of Erlang projects?).
good to hear it worked. To clarify, Erlang LS does not work out of the box not because it is a general tool, but because some things are not yet implemented. The keyword is "Build Server Protocol". Work on a rebar3 BSP server and BSP support in ELS is on the way, so there is hope, it will eventually work out of the box for rebar3 projects.