Stream: t-compiler/rust-analyzer

Topic: Less red in the code

Kirill Bulatov (Jul 25 2020 at 11:59, on Zulip):

Is there any way to adjust the missing field highlighting?
Sometimes it looks a bit too verbose IMO:

Laurențiu (Jul 25 2020 at 12:25, on Zulip):

It would be nice if the span pointed to a comma or something

Mr Smeet (Jul 25 2020 at 13:37, on Zulip):

Complex design issue. The problem really in object declaration. But rust declaration unordered. Maybe good solution show shadowy field like "seven: unknown" with error underline or another approach we can show shadowy tip text of enumeration missed fields

Kirill Bulatov (Jul 25 2020 at 13:42, on Zulip):

I fail to understand how the highlight range is derived in the code itself, if somebody is able to shed some light there, I can provide some design input later.

Mr Smeet (Jul 25 2020 at 14:01, on Zulip):

Vs code use monaco editor . RA use also decorations so I think squiggles are kind of decorator too

Jonas Schievink [he/him] (Jul 25 2020 at 14:05, on Zulip):

The range is fetched from the body's SourceMap. It's the range of the whole record literal expression.

Jonas Schievink [he/him] (Jul 25 2020 at 14:10, on Zulip):

(create_record_literal_missing_fields_diagnostic is what creates the diagnostics, it's called with the ExprId of the record literal expression and looks it up in the SourceMap)

Kirill Bulatov (Jul 25 2020 at 15:38, on Zulip):

Thanks for the pointer.

I wonder how do we manage to handle the missing field range differently and not highlight the whole declaration :thinking:
Hope I'll find the answers soon.

matklad (Jul 26 2020 at 08:51, on Zulip):

Yes, we should more targeted highlighting here (the same for missing arg inspection). Though, the rage for the fix should be the whole struct literal. So, we need to have two ranges somewhere...

Last update: Jul 24 2021 at 19:45UTC