erlang-ls / erlang_ls

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

Erlang LS crash when source code file use erlfmt pragma noformat #1482

Closed eoskblo closed 5 months ago

eoskblo commented 5 months ago

Describe the bug Erlang LS picks up erlfmt pragmas when using Erlang LS on erlang source files that contain erlfmt pragmas. Pragma noformat causes crash in Erlang LS.

To Reproduce Using Erlang LS with source file that use erlfmt pragma "noformat" causes a crash in Erlang LS server. The erlfmt code in Erlang LS returns skip, which is not handled in els_parser.

Expected behavior That it is possible to use Erlang LS with source files that contain erlfmt pragmas, such as "noformat" but also erlfmt "control"-comments such as "%% erlfmt-ignore", "%% erlfmt-ignore-begin" and "%% erlfmt-ignore-end" (the erlfmt "control" comments are introduced in erlfmt version 1.2.0)

Actual behavior Erlang LS crashes and it is not possible to use with erlang source code files with "noformat" pragma.

Context