erlang_ls icon indicating copy to clipboard operation
erlang_ls copied to clipboard

Behaviors from Rebar dependencies are not recognized

Open eproxus opened this issue 4 years ago • 5 comments

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_ls version (tag/sha): Version: 0.14.0+build.1534.refc3ba39d
  • Editor used: Sublime Text 4 (4102)
  • LSP client used: LSP v1.2.13

eproxus avatar Apr 22 '21 12:04 eproxus

Hi @eproxus what does your erlang_ls.config file looks like? https://erlang-ls.github.io/configuration/

robertoaloi avatar Apr 22 '21 15:04 robertoaloi

@robertoaloi I don’t have one as far as I’m aware 😊

eproxus avatar Apr 22 '21 15:04 eproxus

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"

robertoaloi avatar Apr 22 '21 15:04 robertoaloi

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?).

eproxus avatar May 21 '21 08:05 eproxus

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.

gomoripeti avatar May 21 '21 08:05 gomoripeti