Introduce related spans into tsserver protocol (#24548)

* Introduce related spans into tsserver protocol

* Incorporate pretty output, implement esModuleInterop related span
This commit is contained in:
Wesley Wigham
2018-06-15 10:54:36 -07:00
committed by GitHub
parent b9794134e3
commit 640af3f75e
21 changed files with 371 additions and 142 deletions

View File

@@ -466,6 +466,7 @@ namespace ts.server.protocol {
code: number;
/** May store more in future. For now, this will simply be `true` to indicate when a diagnostic is an unused-identifier diagnostic. */
reportsUnnecessary?: {};
relatedInformation?: DiagnosticRelatedInformation[];
}
/**
@@ -2215,6 +2216,11 @@ namespace ts.server.protocol {
reportsUnnecessary?: {};
/**
* Any related spans the diagnostic may have, such as other locations relevant to an error, such as declarartion sites
*/
relatedInformation?: DiagnosticRelatedInformation[];
/**
* The error code of the diagnostic message.
*/
@@ -2233,6 +2239,23 @@ namespace ts.server.protocol {
fileName: string;
}
/**
* Represents additional spans returned with a diagnostic which are relevant to it
* Like DiagnosticWithLinePosition, this is provided in two forms:
* - start and length of the span
* - startLocation and endLocation a pair of Location objects storing the start/end line offset of the span
*/
export interface DiagnosticRelatedInformation {
/**
* Text of related or additional information.
*/
message: string;
/**
* Associated location
*/
span?: FileSpan;
}
export interface DiagnosticEventBody {
/**
* The file for which diagnostic information is reported.