Which of the VSCode Erlang extension do you use?

There are multiple VSCode extensions for Erlang. The one I have installed is named Erlang/OTP (by Yuce Tekol) with 29k installs. There are two more extensions, one named erlang by Pierrick Gourlain with 105k installs and one named Erlang LS with 11k installs.

I don’t remember why I chose the one named Erlang/OTP among the three.

Which one do you think is the best?

5 Likes

I have only used erlang-ls and it works great.

7 Likes

Used to use the Pierrick Gourlain one, moved to Erlang LS for its integration with the compiler, Dialyzer etc. It’s not been all smooth sailing - at one point I managed to get a formatter to destructively corrupt files on save :exploding_head: - but all in all I consider Erlang LS to be the future.

4 Likes

I’m just using syntax highlight now. I was using the LS but I got annoyed with it constantly popping open a window displaying logs for no clear reason.

6 Likes

Combination of erlang_ls and and Erlang Formatter by szTheory.

> cat ~/.config/erlang_ls/erlang_ls.config
lenses:
  disabled:
    - function-references
    - suggest-spec
> cat ${PROJECT}/.vscode/settings.json
{
    "[erlang]": {
        "editor.defaultFormatter": "szTheory.erlang-formatter",
        "editor.formatOnSave": true
    },
    "erlangFormatter.formatter": "rebar3_format",
}
3 Likes

Hi @phild the formatting issue you discovered is probably due to the default formatter of rebar3_format itself, which Erlang LS uses as an optional formatter. See the root cause at: https://github.com/AdRoll/rebar3_format/issues/216

We are planning to add support for additional formatters, including erlfmt directly (since it comes with Erlang LS already).

4 Likes

@lpil That is an odd and unexpected behaviour. Did you report it? Can you show me what it looks like?

2 Likes

Hi @DevotionGeo ! Given I’m one of the core maintainers of Erlang LS I may have a biased view on this :slight_smile:

Pierrick Gourlain’s extension has been around for a very long time and it’s VSCode specific, while the Erlang LS project was started a couple of years ago. In my view, the big advantage of Erlang LS is that its core is also used outside of VS Code (many Emacs / Vim users), so it can rely on a wider community (46 contributors vs 20). Erlang LS offers a set of unique features (e.g. detection of unused includes and macros, warnings about bounded variables, etc). Most of these features are documented at: Features - Erlang LS
Feel free to give it a try, happy to help if you need support.

PS: I’m also interested in hearing the reason why other users favour other extensions. I would love to listen what Erlang LS is lacking/doing wrong.

6 Likes

I reinstalled it and it doesn’t seem to happen any more. I’ll let you know if comes back :+1:

2 Likes

As best I recall I had VSCode config relating to a different formatter than what I’d put in my rebar.config. It is my assumption that two formatters coexist a bit like two spouses :wink:

2 Likes

Hi @robertoaloi,

I’m using Pierrick Gourlain’s extension because it supports debugging (with breakpoints and everything). It’s extremely useful.

2 Likes

Thanks you @robertoaloi! :slight_smile:

2 Likes

I see. That we also support :slight_smile:
Here is a tutorial on how to use the Erlang LS debugger in both Emacs and VS Code:

https://erlang-ls.github.io/articles/tutorial-debugger/

4 Likes

if it can work with docker
I try, but I cant make it
--------------edit-------------
it work well on defacto image(but alpine not work)
cant debugger with attach but default launch config work