Skip to content

textDocument/publishDiagnostics: empty diagnostic messages #18174

Open
@andreaskrath

Description

@andreaskrath

I have a question regarding some empty diagnostic messages. As can be seen in the picture below, I am getting diagnostics on all enum variant fields in this scenario, however the diagnostics are just a whitespace character for the first two tuple fields (this is the reason there is a line, but no message).

Image

Looking at the rust-analyzer information, this can also be seen with multiple instances of the message key having a value of a whitespace character.

I am wondering if this is the intended behaviour, and the diagnostic "highlights" are just to indicate that there are three fields, with the third containing the message - or if there is supposed to be information on the first two fields, or if they are even supposed to be marked at all?

{
   "jsonrpc":"2.0",
   "method":"textDocument/publishDiagnostics",
   "params":{
      "uri":"file:///home/krath/Documents/kasm/src/instruction/mod.rs",
      "diagnostics":[
         {
            "range":{
               "start":{
                  "line":46,
                  "character":4
               },
               "end":{
                  "line":46,
                  "character":8
               }
            },
            "severity":4,
            "code":"E0061",
            "codeDescription":{
               "href":"https://doc.rust-lang.org/error-index.html#E0061"
            },
            "source":"rustc",
            "message":"tuple variant defined here",
            "relatedInformation":[
               {
                  "location":{
                     "uri":"file:///home/krath/Documents/kasm/src/decode/jump.rs",
                     "range":{
                        "start":{
                           "line":14,
                           "character":11
                        },
                        "end":{
                           "line":14,
                           "character":28
                        }
                     }
                  },
                  "message":"original diagnostic"
               }
            ]
         },
         {
            "range":{
               "start":{
                  "line":46,
                  "character":9
               },
               "end":{
                  "line":46,
                  "character":13
               }
            },
            "severity":4,
            "code":"E0023",
            "codeDescription":{
               "href":"https://doc.rust-lang.org/error-index.html#E0023"
            },
            "source":"rustc",
            "message":" ",
            "relatedInformation":[
               {
                  "location":{
                     "uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
                     "range":{
                        "start":{
                           "line":43,
                           "character":40
                        },
                        "end":{
                           "line":43,
                           "character":47
                        }
                     }
                  },
                  "message":"original diagnostic"
               }
            ]
         },
         {
            "range":{
               "start":{
                  "line":46,
                  "character":15
               },
               "end":{
                  "line":46,
                  "character":28
               }
            },
            "severity":4,
            "code":"E0023",
            "codeDescription":{
               "href":"https://doc.rust-lang.org/error-index.html#E0023"
            },
            "source":"rustc",
            "message":" ",
            "relatedInformation":[
               {
                  "location":{
                     "uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
                     "range":{
                        "start":{
                           "line":43,
                           "character":40
                        },
                        "end":{
                           "line":43,
                           "character":47
                        }
                     }
                  },
                  "message":"original diagnostic"
               }
            ]
         },
         {
            "range":{
               "start":{
                  "line":46,
                  "character":30
               },
               "end":{
                  "line":46,
                  "character":46
               }
            },
            "severity":4,
            "code":"E0023",
            "codeDescription":{
               "href":"https://doc.rust-lang.org/error-index.html#E0023"
            },
            "source":"rustc",
            "message":"tuple variant has 3 fields",
            "relatedInformation":[
               {
                  "location":{
                     "uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
                     "range":{
                        "start":{
                           "line":43,
                           "character":40
                        },
                        "end":{
                           "line":43,
                           "character":47
                        }
                     }
                  },
                  "message":"original diagnostic"
               }
            ]
         }
      ],
      "version":0
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-flycheckissues with flycheck a.k.a. "check on save"C-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions