Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong F/A completion in exports #1488

Closed
MarkoMin opened this issue Jan 19, 2024 · 5 comments · Fixed by #1490
Closed

Wrong F/A completion in exports #1488

MarkoMin opened this issue Jan 19, 2024 · 5 comments · Fixed by #1490
Labels
bug Something isn't working

Comments

@MarkoMin
Copy link
Contributor

MarkoMin commented Jan 19, 2024

Describe the bug
How can I complete functions to f/A instead of f(Args...) when trying to export them? When I want to export few functions in export, the first function is correctly expanded to f/A (if I autocompleted -export), but next ones get wrongly completed to f(Args...). If I don't autocomplete, not even first one works correctly.

To Reproduce
Define a module with 2 functions: really_long_name/3 and really_really_long_name/3. Then type "-exp" and autocomplete it to -export([|]). (| is cursor mark :D). Now type "really_lo" and hit autocomplete, you'll get "really_long_name/3". Then type ", really_rea" and autocomplete it, you'll get -export([really_long_name/3, really_really_long_name(Arg1, Arg2, Arg3)]). - which is wrong I believe. Tested on 0.48.0 and 0.50.0 in nvim with coc as lsp plugin, OTP26. If I remember correctly this thing worked on VS-code, but I'm not 100%.

@MarkoMin MarkoMin added the bug Something isn't working label Jan 19, 2024
@fridayy
Copy link
Contributor

fridayy commented Jan 21, 2024

Hi @MarkoMin!

I've had this issue with earlier versions but with 0.50.0/master I can not reproduce it.

bug-0-.3.webm

I am using nvim v0.9.4 with this set of plugins. Completion provider is nvim-cmp. Maybe this is coc related?

cheers!

@plux
Copy link
Contributor

plux commented Jan 22, 2024

This can happen if parsing of the -export expression fails.
I got an idea how to make it more robust.

@plux
Copy link
Contributor

plux commented Jan 23, 2024

I've merged a fix for this now. Hopefully it will resolve the issue :)

@MarkoMin
Copy link
Contributor Author

Works as a charm, great job!

@MarkoMin
Copy link
Contributor Author

MarkoMin commented Jan 30, 2024

@plux I just noticed the same thing for -export_type. Maybe we should go with function like "is_in_something_that_accepts_FAs" (import, export, export_type, import_type might come soon, etc.

EDIT:
my bad, I was on previous version......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants