erlang-ls / erlang_ls

The Erlang Language Server
https://erlang-ls.github.io/
Apache License 2.0
632 stars 136 forks source link

No warning for malformed erlang_ls.config file #615

Open alanz opened 4 years ago

alanz commented 4 years ago

Describe the bug

The logic for loading erlang_ls.config files is to take a list of locations, attempt to load from them in order, until one succeeds.

It does not distinguish between a file not existing, and one existing but having a YAML syntax error in it.

So making a typo in your config can cause it to load a completely different config file.

Expected behavior

I would expect it to report a diagnostic for the first config file it finds, if it has a syntax error in it.

Context

alanz commented 4 years ago

There are two cases here

Examples of invalid config are trying to enable/disable lenses that do not exist.

alanz commented 4 years ago

A related issue would be if there is a config file specified, but it does not exist.

I think the logic for that should be

The current search logic includes tagging a non-absolute path onto all the possible config file locations. I think this is too loose, and likely to result in unexpected and hard to debug results.