Add API to .d.ts

pull/2748/head
Alex Dima 5 years ago
parent a5b927fca1
commit aee134f9c1
No known key found for this signature in database
GPG Key ID: 6E58D7B045760DA0

5
src/monaco.d.ts vendored

@ -275,6 +275,11 @@ declare module monaco.languages.typescript {
*/
getSuggestionDiagnostics(fileName: string): Promise<Diagnostic[]>;
/**
* Get the content of a given file.
*/
getScriptText(fileName: string): Promise<string | undefined>;
/**
* Get diagnostic messages related to the current compiler options.
* @param fileName Not used

@ -69,7 +69,11 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
return '';
}
getScriptText(fileName: string): string | undefined {
getScriptText(fileName: string): Promise<string | undefined> {
return Promise.resolve(this._getScriptText(fileName));
}
_getScriptText(fileName: string): string | undefined {
let text: string;
let model = this._getModel(fileName);
if (model) {
@ -92,7 +96,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
}
getScriptSnapshot(fileName: string): ts.IScriptSnapshot | undefined {
const text = this.getScriptText(fileName);
const text = this._getScriptText(fileName);
if (!text) {
return;
}

Loading…
Cancel
Save