Signed-off-by: yangbo <1442420648@qq.com>
Change-Id: I9e977a9a60b103a32ecad6efd280b88f3d843a45
This commit is contained in:
yangbo
2022-03-21 19:03:38 +08:00
parent 3a6e772317
commit 3eab9211fa
+13 -6
View File
@@ -103,23 +103,30 @@ export function createLanguageService(rootFileNames: string[]): ts.LanguageServi
const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts');
if (ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.d.ts'));
} else {
resolvedModules.push(null);
}
} else if (/\.ets$/.test(moduleName)) {
const modulePath: string = path.resolve(path.dirname(containingFile), moduleName);
if (ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.ets'));
} else {
resolvedModules.push(null);
}
} else if (/\.ts$/.test(moduleName)) {
const modulePath: string = path.resolve(path.dirname(containingFile), moduleName);
if (ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.ts'));
} else {
resolvedModules.push(null);
}
} else {
const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts');
if (ts.sys.fileExists(modulePath)) {
resolvedModules.push(getResolveModule(modulePath, '.d.ts'));
} else {
resolvedModules.push(null);
}
}
}
if (moduleNames.length !== resolvedModules.length) {
const length: number = moduleNames.length - resolvedModules.length;
for (let i = 0; i < length; i++) {
resolvedModules.push(null);
}
}
return resolvedModules;