mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Fix exception if extension is not installed
This commit is contained in:
@@ -155,11 +155,13 @@ export class TypeScriptVersionProvider {
|
||||
|
||||
private getContributedVersion(extensionId: string, pathToTs: readonly string[]): TypeScriptVersion | undefined {
|
||||
try {
|
||||
const { extensionPath } = vscode.extensions.getExtension(extensionId)!;
|
||||
const typescriptPath = path.join(extensionPath, ...pathToTs, 'typescript', 'lib');
|
||||
const bundledVersion = new TypeScriptVersion(typescriptPath, '');
|
||||
if (bundledVersion.isValid) {
|
||||
return bundledVersion;
|
||||
const extension = vscode.extensions.getExtension(extensionId);
|
||||
if (extension) {
|
||||
const typescriptPath = path.join(extension.extensionPath, ...pathToTs, 'typescript', 'lib');
|
||||
const bundledVersion = new TypeScriptVersion(typescriptPath, '');
|
||||
if (bundledVersion.isValid) {
|
||||
return bundledVersion;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// noop
|
||||
|
||||
Reference in New Issue
Block a user