gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
17.22k stars 713 forks source link

LSP: auto-imports feature doesn't handle `_` well #3380

Open LoipesMas opened 1 month ago

LoipesMas commented 1 month ago

The new auto-imports feature doesn't work with functions/constants that have _ in their name. For example, when I try to get wisp.html_response, the moment I get to html_, the wisp.html_response entry no longer shows up. What's left is html.parse_multipart_body and html.parse_multipart_headers. image

If I instead enter htmlres (skipping the _), then wisp.html_response shows up as expected. image

Normal completion (on wisp.html_r) handles it just fine. image

Gleam version 1.3.0 completion setup: neovim 0.10.0 + nvim-cmp

lpil commented 1 month ago

Thank you

teodorstupnicki commented 1 month ago

@lpil I would like to try this one, any tips on where to start?

Acepie commented 1 month ago

FWIW I would start by double checking what completions the LSP engine is returning in these cases. I have a feeling this is actually editor specific behavior and the _ is not the root issue. Most likely if we wanted to improve this we'd need to use either the filter text or the sort text field in the LSP protocol

LoipesMas commented 1 month ago

If you need more information or want me to test something, let me know