Is there any way to adjust the missing field highlighting?
Sometimes it looks a bit too verbose IMO:
It would be nice if the span pointed to a comma or something
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
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.
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
The range is fetched from the body's SourceMap. It's the range of the whole record literal expression.
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
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.
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...