mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Always instantiate .d.ts models as typescript
This commit is contained in:
parent
e8f34f3e53
commit
f2e2b1d3a4
2 changed files with 4 additions and 7 deletions
|
|
@ -98,10 +98,7 @@ export class LibFiles {
|
|||
private _hasFetchedLibFiles: boolean;
|
||||
private _fetchLibFilesPromise: Promise<void> | null;
|
||||
|
||||
constructor(
|
||||
private readonly modeId: string,
|
||||
private readonly _worker: (...uris: Uri[]) => Promise<TypeScriptWorker>
|
||||
) {
|
||||
constructor(private readonly _worker: (...uris: Uri[]) => Promise<TypeScriptWorker>) {
|
||||
this._libFiles = {};
|
||||
this._hasFetchedLibFiles = false;
|
||||
this._fetchLibFilesPromise = null;
|
||||
|
|
@ -123,7 +120,7 @@ export class LibFiles {
|
|||
return model;
|
||||
}
|
||||
if (this.isLibFile(uri) && this._hasFetchedLibFiles) {
|
||||
return editor.createModel(this._libFiles[uri.path.slice(1)], this.modeId, uri);
|
||||
return editor.createModel(this._libFiles[uri.path.slice(1)], 'typescript', uri);
|
||||
}
|
||||
const extraLibs = typescriptDefaults.getExtraLibs();
|
||||
const extraLibPaths = Object.keys(extraLibs);
|
||||
|
|
@ -131,7 +128,7 @@ export class LibFiles {
|
|||
const currentPath = extraLibPaths[i];
|
||||
const currentUri = Uri.parse(currentPath);
|
||||
if (currentUri.path === uri.path) {
|
||||
return editor.createModel(extraLibs[currentPath].content, this.modeId, uri);
|
||||
return editor.createModel(extraLibs[currentPath].content, 'typescript', uri);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ function setupMode(
|
|||
return client.getLanguageServiceWorker(...uris);
|
||||
};
|
||||
|
||||
const libFiles = new languageFeatures.LibFiles(modeId, worker);
|
||||
const libFiles = new languageFeatures.LibFiles(worker);
|
||||
|
||||
languages.registerCompletionItemProvider(modeId, new languageFeatures.SuggestAdapter(worker));
|
||||
languages.registerSignatureHelpProvider(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue