erlang_ls icon indicating copy to clipboard operation
erlang_ls copied to clipboard

Rebar3 checkout dependencies problematic

Open eproxus opened this issue 3 years ago • 0 comments

Describe the bug Configuring and using Rebar 3 checkout dependencies is problematic.

To Reproduce Have a Rebar 3 project with another dependency symbolically linked in _checkouts:

$ tree .
.
├── _build
│  └── default
│     ├── checkouts
│     │  └──my_lib 
│     │     ├── ebin
│     │     │  ├── my_lib.app
│     │     │  └── my_lib.beam
│     │     ├── include -> ../../../../_checkouts/my_lib/include
│     │     └── src -> ../../../../_checkouts/my_lib/src
│     └── lib
│        └──my_app 
│           ├── ebin
│           │  ├── my_app.app
│           │  └── my_app.beam
│           ├── include -> ../../../../include
│           ├── priv -> ../../../../priv
│           └── src -> ../../../../src
├── _checkouts
│  └── my_lib -> ../..my_lib/    # ← Note that this is symlinked _outside_ the project!
├── erlang_ls.config
├── rebar.config
└── src
   ├── my_app.app.src
   └── my_app.erl

Use the following erlang_ls.config:

apps_dirs:
  - "_build/default/lib/*"
  - "_build/default/checkout/*"
include_dirs:
  - "include"
  - "_build/default/lib/*/include"
  - "_build/default/checkouts/*/include"
  - "_checkouts/*/include"
deps_dirs:
  - "_build/default/lib/*"
  - "_build/default/checkouts/*"

Expected behavior Include files and behaviors can be found in symlinked projects inside _checkouts.

Actual behavior Some things are "found" while others are missing and generate errors:

~/my_app/src/my_app.erl:
   20:1   warning Unused file: my_lib.hrl ​UnusedIncludes
   20:1   error   can't find include lib "my_lib/include/my_lib.hrl" ​Compiler:E1516

It seems erlang_ls both can and can't find the include file with this configuration. The include is used, and does exist (Rebar 3 finds it when compiling, obviously).

Context

  • erlang_ls version (tag/sha): 0.27.0
  • Editor used: Sublime Text 4 (4131)
  • LSP client used: Sublime-LSP 1.16.1

Possible related issues:

  • #1046
  • #988 (The configuration suggested in this issue does not work for includes)

eproxus avatar Mar 25 '22 11:03 eproxus