Can I reload erlang_ls.config without restarting VS Code?

When I edit erlang_ls.config, I have to close and reopen VS Code for my changes to have any effect. Is there a way to reload the config (or restart the language server) without restarting VS Code? I’m using the erlang-ls extension.

2 Likes

You can try to restart extension host alone. Open settings search with “Ctrl+shift+P” (default shourtcut) and search for it.

1 Like

That works, but it breaks other extensions, such as szTheory.erlang-formatter (which I’ve got installed because ErlangLS wants to use rebar3_format and I prefer erlfmt). To fix that, I have to Disable All Extensions / Enable All Extensions.

I’d prefer it if the extension watched the file for changes and restarted itself or the server.

2 Likes

There seems to be a similar command called reload window. I couldn’t find any detailed documentation, but it should do something similar to when you restart VS Code.

IMO watching erlang_ls.config would just add extra complexity to the extension. I think that this configuration is not something that changes so frequently.

It changes quite a lot when you’re initially setting up a project, though.

In case it’s an X/Y problem, here’s another idea: example erlang_ls.config files for different project types. Specifically: I can never figure out how to specify include files for erlang.mk apps vs. rebar3 apps vs. rebar3 umbrellas vs., well, the Erlang/OTP source code.

1 Like

AFAIK rebar3 apps follow the OTP structure and there are erlang_ls.config templates at ErlangLS site that let you consume include files from other apps. Merging template configurations for rebar3 app, rebar3 umbrella and Erlang source worked for me.
Including files from rebar3 app/umbrella or Erlang source should always work the same way. E.g. to include some file from rebar3 app/umbrella or Erlang source, I always use -include_lib(“< app_name >/< include >/< file_name >”).

Haven’t worked with erlang.mk so I don’t know if it’s configuration can somehow collide with rebar’s. Official documentation doesn’t mention erlang.mk projects, maybe @robertoaloi can provide some instructions on how to include files from erlang.mk projects?