mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user