erlang_ls icon indicating copy to clipboard operation
erlang_ls copied to clipboard

Cowboy behaviour undefined

Open Katur7 opened this issue 3 years ago • 1 comments

Erlang LS gives me a warning that behaviour cowboy_rest is undefined. Even if I include "_build/default/lib" in include_dirs in erlang_ls.config.

If I also include "_build/default/lib/cowboy/src" in include_dirs in erlang_ls.config I get the warning: Issue in included file (18): behaviour cowboy_sub_protocol undefined

I made this small repo to reproduce the issue: Repo

Expected behavior I expected the cowboy_rest behaviour to be found by default.

Actual behavior The cowboy_rest behaviour is not found

Context

  • erlang_ls version (tag/sha): 0.17.0
  • Editor used: VS Code 1.57.1
  • LSP client used: erlang-ls.erlang-ls v0.0.27

Katur7 avatar Jun 23 '21 16:06 Katur7

It's actually complaining about the cowboy_sub_protocol not being found in cowboy_rest. This is similar to this issue: https://github.com/erlang-ls/erlang_ls/issues/1024

plux avatar Jun 24 '21 13:06 plux

I worked around this for now by adding:

code_path_extra_dirs:
  - "./_build/default/lib/*/ebin/"

to my erlang_ls.config.

dweinstein avatar Mar 17 '23 00:03 dweinstein

Thank you @dweinstein. That works for me also :)

Katur7 avatar Mar 17 '23 12:03 Katur7

hi @plux was this issue fixed by some code change or is the workaround still best to use? I noticed you marked this ticket as completed so I was just curious if I should try updating my erlang_ls.config. Thanks for the work you're doing!

dweinstein avatar Dec 28 '23 14:12 dweinstein

I think this issue still exists and we should investigate it further. I will open it again.

plux avatar Jan 08 '24 10:01 plux

Unfortunately that workaround doesn't work for me with the behavior cowboy_middleware.

eproxus avatar Jan 09 '24 09:01 eproxus

I think I have found the issue for this. I will submit a PR later.

plux avatar Jan 09 '24 14:01 plux