提交 8b470712 编写于 作者: J Johannes Rieken

make diagnostics read api public, #30075

上级 95101bf3
......@@ -3680,6 +3680,17 @@ declare module 'vscode' {
constructor(uri: Uri, rangeOrPosition: Range | Position);
}
/**
* The event that is fired when diagnostics change.
*/
export interface DiagnosticChangeEvent {
/**
* An array of resources for which diagnostics have changed.
*/
readonly uris: Uri[];
}
/**
* Represents the severity of diagnostics.
*/
......@@ -6044,6 +6055,29 @@ declare module 'vscode' {
*/
export function match(selector: DocumentSelector, document: TextDocument): number;
/**
* An [event](#Event) which fires when the global set of diagnostics changes. This is
* newly added and removed diagnostics.
*/
export const onDidChangeDiagnostics: Event<DiagnosticChangeEvent>;
/**
* Get all diagnostics for a given resource. *Note* that this includes diagnostics from
* all extensions but *not yet* from the task framework.
*
* @param resource A resource
* @returns An arrary of [diagnostics](#Diagnostic) objects or an empty array.
*/
export function getDiagnostics(resource: Uri): Diagnostic[];
/**
* Get all diagnostics. *Note* that this includes diagnostics from
* all extensions but *not yet* from the task framework.
*
* @returns An array of uri-diagnostics tuples or an empty array.
*/
export function getDiagnostics(): [Uri, Diagnostic[]][];
/**
* Create a diagnostics collection.
*
......
......@@ -11,32 +11,6 @@ declare module 'vscode' {
export function sampleFunction(): Thenable<any>;
}
//#region Joh: readable diagnostics
export interface DiagnosticChangeEvent {
uris: Uri[];
}
export namespace languages {
/**
*
*/
export const onDidChangeDiagnostics: Event<DiagnosticChangeEvent>;
/**
*
*/
export function getDiagnostics(resource: Uri): Diagnostic[];
/**
*
*/
export function getDiagnostics(): [Uri, Diagnostic[]][];
}
//#endregion
//#region Aeschli: folding
export class FoldingRangeList {
......
......@@ -237,9 +237,9 @@ export function createApiFactory(
checkProposedApiEnabled(extension);
return extHostDiagnostics.onDidChangeDiagnostics;
},
getDiagnostics: <any>proposedApiFunction(extension, (resource?) => {
return extHostDiagnostics.getDiagnostics(resource);
}),
getDiagnostics: (resource?) => {
return <any>extHostDiagnostics.getDiagnostics(resource);
},
getLanguages(): TPromise<string[]> {
return extHostLanguages.getLanguages();
},
......
......@@ -229,6 +229,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
}
}
}
Object.freeze(uris);
return { uris };
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册