Stream: t-compiler/rust-analyzer

Topic: Completions Refactoring

Eduardo Canellas (May 26 2021 at 16:43, on Zulip):

Hello, I'm new to the codebase and I've been fixing some issues involving completions.

I think the code there may need some refactoring. Currently, the completions entry point calls a dozen of different completions methods and each of them check if they should apply completions or not.

I thought about removing those code checks from these functions and, instead of always calling all of them, just call the ones which are needed based on the cursor position on the document. Does anyone have suggestions about it? :happy:

Florian Diebold (May 26 2021 at 16:59, on Zulip):

there are some things that could be improved there, but it's intentional that each completion knows by itself where it applies

Lukas Wirth (May 26 2021 at 17:02, on Zulip):

^ I believe its easier to oversee the way it is right now

Lukas Wirth (May 26 2021 at 17:04, on Zulip):

Though we do want to refactor the CompletionContext somewhat I believe, it currently has a lot of "random" different fields. Looks a bit unwieldy to me at least and is something I wanted to look into the coming week.

Last update: Jul 26 2021 at 12:30UTC