Stream: t-compiler/rust-analyzer

Topic: Making quickfixes out of assists

Timo Freiberg (Jul 12 2020 at 10:39, on Zulip):

Hey everyone, I've been fixing an issue with the fix_visibility assist and I want to do some refactoring while I'm there - namely turning it into a quickfix.
I guess I'll have to first generate a diagnostic, right? Does anyone already have a rough idea where such a diagnostic could be created?

Jeremy Kolb (Jul 12 2020 at 16:43, on Zulip):

fix_visibility should already be a quickfix:

Jeremy Kolb (Jul 12 2020 at 16:45, on Zulip):

Are you using vscode? If not you'll need to make sure that your client is sending down that it supports the capability

Timo Freiberg (Jul 12 2020 at 17:21, on Zulip):

well, it's currently an assist, not a quickfix. see the discussion in this ticket:

Timo Freiberg (Jul 15 2020 at 16:47, on Zulip):

hmm, I've been reading through the code a little bit, trying to find if Visibility is used somewhere in the analysis where I could maybe generate a new Diagnostic, and so far all usages of Visibility that I found were for autocompletion/find usages/fix visibility.
does RA currently ignore visibility, leaving visibility errors completely up to cargo check?

Florian Diebold (Jul 15 2020 at 17:08, on Zulip):


Timo Freiberg (Jul 15 2020 at 18:34, on Zulip):

I'm still struggling to find a place where that could be added though... maybe something inside InferenceContext::infer_expr_inner?

Florian Diebold (Jul 15 2020 at 18:52, on Zulip):

yeah, I think adding such diagnostics requires a bunch of design work and refactoring, because currently names get resolved in lots of places depending on where they are

Timo Freiberg (Jul 15 2020 at 19:40, on Zulip):

damnit... okay that dampens my enthusiasm a little :)

Last update: Jul 28 2021 at 04:30UTC