WhatsApp / erlang-language-platform

Erlang Language Platform. LSP server and CLI.
https://whatsapp.github.io/erlang-language-platform/
Apache License 2.0
235 stars 19 forks source link

Extract variable names from EEP-48 doc chunks when available #53

Open robertoaloi opened 1 week ago

robertoaloi commented 1 week ago

For features such as inlay hints and doc-on-hover, ELP extracts variable names from the function specs or - when variables in specs are not available - from the first function clause.

A better option would be to extract them from the EEP-48 doc chunks (format documented here).

Originally proposed here.

garazdawi commented 1 week ago

For features such as inlay hints and doc-on-hover, ELP extracts variable names from the function specs or - when variables in specs are not available - from the first function clause.

If by this your mean that ELP today prioritises specs over function variable names, then atleast in my ELP (v0.28.0) it is not true.

image

The ML in this image should be Data: https://github.com/erlang/otp/blob/master/lib/stdlib/src/unicode.erl#L281-L295.

Or is this only something that does not work for me as I'm developing within the Erlang/OTP tree?

robertoaloi commented 1 week ago

Just checked. The extraction algorithm is extremely basic right now and does not take guards into account: https://github.com/WhatsApp/erlang-language-platform/blob/main/crates/hir/src/module_data.rs#L293