Stream: t-compiler/wg-rls-2.0

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: https://github.com/rust-analyzer/rust-analyzer/blob/f51b0cfdd6c23dd57a0a11154179730171c0425d/crates/ra_assists/src/handlers/fix_visibility.rs#L61

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: https://github.com/rust-analyzer/rust-analyzer/issues/4563

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):

yes

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: Sep 27 2020 at 12:45UTC