Stream: t-compiler/wg-rls-2.0

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:
image.png

Laurențiu Nicola (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

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 https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-line-and-inline-decorations . RA use also decorations https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/inlay_hints.ts so I think squiggles are kind of decorator too

Jonas Schievink (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 (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: Sep 27 2020 at 14:30UTC