提交 bc433d65 编写于 作者: S Sandeep Somavarapu

Fix #79206

上级 21de711c
......@@ -23,7 +23,6 @@ import { IExtensionsConfiguration, ConfigurationKey, ShowRecommendationsOnlyOnDe
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { flatten, distinct, shuffle, coalesce } from 'vs/base/common/arrays';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { guessMimeTypes, MIME_UNKNOWN } from 'vs/base/common/mime';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IRequestService, asJson } from 'vs/platform/request/common/request';
......@@ -41,8 +40,9 @@ import { extname } from 'vs/base/common/resources';
import { IExeBasedExtensionTip, IProductService } from 'vs/platform/product/common/product';
import { timeout } from 'vs/base/common/async';
import { IWorkspaceStatsService } from 'vs/workbench/contrib/stats/common/workspaceStats';
import { Platform, setImmediate } from 'vs/base/common/platform';
import { Platform, setImmediate, IProcessEnvironment } from 'vs/base/common/platform';
import { platform } from 'vs/base/common/process';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
const milliSecondsInADay = 1000 * 60 * 60 * 24;
const choiceNever = localize('neverShowAgain', "Don't Show Again");
......@@ -66,7 +66,7 @@ function caseInsensitiveGet<T>(obj: { [key: string]: T }, key: string): T | unde
return undefined;
}
export class ExtensionTipsService extends Disposable implements IExtensionTipsService {
export abstract class BaseExtensionTipsService extends Disposable implements IExtensionTipsService {
_serviceBrand: any;
......@@ -99,7 +99,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IExtensionService private readonly extensionService: IExtensionService,
@IRequestService private readonly requestService: IRequestService,
@IViewletService private readonly viewletService: IViewletService,
......@@ -1020,11 +1020,12 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
if (!windowsPath || typeof windowsPath !== 'string') {
return;
}
windowsPath = windowsPath.replace('%USERPROFILE%', process.env['USERPROFILE']!)
.replace('%ProgramFiles(x86)%', process.env['ProgramFiles(x86)']!)
.replace('%ProgramFiles%', process.env['ProgramFiles']!)
.replace('%APPDATA%', process.env['APPDATA']!)
.replace('%WINDIR%', process.env['WINDIR']!);
const processEnv = this.getProcessEnvironment();
windowsPath = windowsPath.replace('%USERPROFILE%', processEnv['USERPROFILE']!)
.replace('%ProgramFiles(x86)%', processEnv['ProgramFiles(x86)']!)
.replace('%ProgramFiles%', processEnv['ProgramFiles']!)
.replace('%APPDATA%', processEnv['APPDATA']!)
.replace('%WINDIR%', processEnv['WINDIR']!);
promises.push(findExecutable(exeName, entry.value, windowsPath));
} else {
promises.push(findExecutable(exeName, entry.value, join('/usr/local/bin', exeName)));
......@@ -1144,4 +1145,15 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
private isExtensionAllowedToBeRecommended(id: string): boolean {
return this._allIgnoredRecommendations.indexOf(id.toLowerCase()) === -1;
}
protected abstract getProcessEnvironment(): IProcessEnvironment;
}
export class ExtensionTipsService extends BaseExtensionTipsService implements IExtensionTipsService {
protected getProcessEnvironment(): IProcessEnvironment {
return {};
}
}
......@@ -10,7 +10,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ExtensionsLabel, ExtensionsChannelId, PreferencesLabel, IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementServerService, IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IExtensionManagementServerService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } from 'vs/workbench/common/actions';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/contrib/output/common/output';
......@@ -45,10 +45,8 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { RemoteExtensionsInstaller } from 'vs/workbench/contrib/extensions/browser/remoteExtensionsInstaller';
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/browser/extensionTipsService';
// Singletons
registerSingleton(IExtensionTipsService, ExtensionTipsService);
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService);
Registry.as<IOutputChannelRegistry>(OutputExtensions.OutputChannels)
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/browser/extensionTipsService';
// Singletons
registerSingleton(IExtensionTipsService, ExtensionTipsService);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BaseExtensionTipsService } from 'vs/workbench/contrib/extensions/browser/extensionTipsService';
import { IProcessEnvironment } from 'vs/base/common/platform';
export class ExtensionTipsService extends BaseExtensionTipsService {
protected getProcessEnvironment(): IProcessEnvironment {
return process.env as IProcessEnvironment;
}
}
......@@ -21,8 +21,11 @@ import { RuntimeExtensionsInput } from 'vs/workbench/contrib/extensions/electron
import { URI } from 'vs/base/common/uri';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ExtensionsAutoProfiler } from 'vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler';
import { IExtensionTipsService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { ExtensionTipsService } from 'vs/workbench/contrib/extensions/electron-browser/extensionTipsService';
// Singletons
registerSingleton(IExtensionTipsService, ExtensionTipsService);
registerSingleton(IExtensionHostProfileService, ExtensionHostProfileService, true);
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
......
......@@ -87,6 +87,9 @@ import 'vs/workbench/contrib/debug/browser/extensionHostDebugService';
import 'vs/workbench/contrib/webview/browser/webviewService';
import 'vs/workbench/contrib/webview/browser/webviewEditorService';
// Extensions Management
import 'vs/workbench/contrib/extensions/browser/extensions.web.contribution';
// Terminal
import 'vs/workbench/contrib/terminal/browser/terminalNativeService';
import 'vs/workbench/contrib/terminal/browser/terminalInstanceService';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册