Add ID field to SourceKit's diagnostics

This commit is contained in:
fwcd
2021-05-07 14:52:06 +02:00
parent 25ba22c879
commit f6ba1314d0
4 changed files with 6 additions and 0 deletions

View File

@@ -310,6 +310,7 @@ entity ::=
```
diagnostic ::=
{
<key.id>: (string) // The internal ID of the diagnostic.
<key.line>: (int64) // The line upon which the diagnostic was emitted.
<key.column>: (int64) // The column upon which the diagnostic was emitted.
<key.filepath>: (string) // The absolute path to the file that was being parsed

View File

@@ -200,6 +200,7 @@ struct DiagnosticEntryInfoBase {
std::string Text;
};
std::string ID;
std::string Description;
unsigned Offset = 0;
unsigned Line = 0;

View File

@@ -2824,6 +2824,9 @@ static void fillDictionaryForDiagnosticInfo(
static void fillDictionaryForDiagnosticInfoBase(
ResponseBuilder::Dictionary Elem, const DiagnosticEntryInfoBase &Info) {
if (!Info.ID.empty())
Elem.set(KeyID, Info.ID);
Elem.set(KeyDescription, Info.Description);
if (Info.Line != 0) {
Elem.set(KeyLine, Info.Line);

View File

@@ -54,6 +54,7 @@ UID_KEYS = [
KEY('EnableSyntaxMap', 'key.enablesyntaxmap'),
KEY('SyntaxTreeTransferMode', 'key.syntaxtreetransfermode'),
KEY('EnableStructure', 'key.enablesubstructure'),
KEY('ID', 'key.id'),
KEY('Description', 'key.description'),
KEY('TypeName', 'key.typename'),
KEY('RuntimeName', 'key.runtime_name'),