mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
Add API to .d.ts
This commit is contained in:
parent
a5b927fca1
commit
aee134f9c1
2 changed files with 11 additions and 2 deletions
5
src/monaco.d.ts
vendored
5
src/monaco.d.ts
vendored
|
|
@ -275,6 +275,11 @@ declare module monaco.languages.typescript {
|
||||||
*/
|
*/
|
||||||
getSuggestionDiagnostics(fileName: string): Promise<Diagnostic[]>;
|
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.
|
* Get diagnostic messages related to the current compiler options.
|
||||||
* @param fileName Not used
|
* @param fileName Not used
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,11 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
|
||||||
return '';
|
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 text: string;
|
||||||
let model = this._getModel(fileName);
|
let model = this._getModel(fileName);
|
||||||
if (model) {
|
if (model) {
|
||||||
|
|
@ -92,7 +96,7 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, monaco.language
|
||||||
}
|
}
|
||||||
|
|
||||||
getScriptSnapshot(fileName: string): ts.IScriptSnapshot | undefined {
|
getScriptSnapshot(fileName: string): ts.IScriptSnapshot | undefined {
|
||||||
const text = this.getScriptText(fileName);
|
const text = this._getScriptText(fileName);
|
||||||
if (!text) {
|
if (!text) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue