erlang-ls / erlang_ls

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

OTP 27 support #1489

Open MarkoMin opened 5 months ago

MarkoMin commented 5 months ago

There will (very probably) be new attributes in OTP27: -doc and -moduledoc. They'll accept string, tuple, atom or map (with some reserved keys) which we could autocomplete.

There will also be rules like: -doc with string can only appear once

I'd want to work on this because I want to get into this project more :D

Release is still 4 months away, but I put this here as a remainder

plux commented 5 months ago

Sounds great if you want to help out :+1:

rlipscombe commented 2 months ago

Related? https://github.com/WhatsApp/erlfmt/issues/355

attah commented 1 month ago

Now that it is released, are there any news on this? (Or list of tasks to potentially contribute to?)

MarkoMin commented 1 month ago

Unfortunately, I don't have that much time to do open-source right now, but I'd still like to make some impact on this issue. I'll try to make a more detailed list of things that should be done by the end of tomorrow, but my contributions will be not before the start of the next week.

attah commented 1 month ago

I'll see if i can fix at least something. :)

MarkoMin commented 1 month ago

Core tasks:

  1. Completion for -moduledoc attribute with triple quotes appended.
  2. Completion for -moduledoc attribute without anything appended (if you want to pass atom, map or string)
  3. Completion for -moduledoc false.
  4. Completion for -doc attribute with triple quotes appended.
  5. Completion for -doc attribute without anything appended (if you want to pass atom, map or string)
  6. Completion for -doc false.
  7. Completion for sigils: ~b, ~B, ~s, ~S
  8. Support new erl_lint error: duplicate_doc_attribute,
  9. Support new epp errors {moduledoc | doc, invalid, Alternative}, {moduledoc | doc, file, Filename}

Nice to haves:

  1. Completion for files when {file,Path} is given as argument to moduledoc or doc.
  2. Completion for keys when map is given as argument to moduledoc: since, deprecated, format
  3. Completion for keys when map is given as argument to doc: since, equiv, exported, deprecated
dgud commented 1 month ago

Parsing crashes on sigils in this case: ~#string"

I'm lazy and have not even looked if it erlfmt is part of erlang_ls or an external dep.

LSP :: Error from the Language Server: Internal Error: #{reason => function_clause,type => error, params =>

{<<"textDocument">> =>

        #{<<"uri">> =>
              <<"file:///home/dgud/src/otp/lib/stdlib/test/json_SUITE.erl">>}},

stack => [{erlfmt_scan,token_anno, [{552,17}], [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt_scan.erl"}, {line,317}]}, {erlfmt_scan,split_tokens,3, [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt_scan.erl"}, {line,267}]}, {erlfmt_scan,split_tokens,2, [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt_scan.erl"}, {line,243}]}, {erlfmt_scan,continue,4, [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt_scan.erl"}, {line,127}]}, {erlfmt,read_nodes_loop,5, [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt.erl"}, {line,500}]}, {erlfmt,read_nodes_string,2, [{file,"/mnt/e/src/erlang_ls/_build/default/lib/erlfmt/src/erlfmt.erl"}, {line,436}]}, {els_parser,parse,1, [{file,"/mnt/e/src/erlang_ls/apps/els_lsp/src/els_parser.erl"}, {line,51}]}, {els_indexing,deep_index,1, [{file,"/mnt/e/src/erlang_ls/apps/els_lsp/src/els_indexing.erl"}, {line,93}]}], method => <<"textDocument/documentSymbol">>} (Internal Error)

MarkoMin commented 1 month ago

I'm lazy and have not even looked if it erlfmt is part of erlang_ls or an external dep.

It's a dependency or erlang_ls directly, it actually uses its parser (see els_parser.erl:93). That's currently blocking for implementing sigils support and (part of) moduledoc/doc support.