mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 18:48:00 +00:00
debt - extensions path is always defined
This commit is contained in:
parent
ffec932655
commit
96b2c670d7
|
@ -187,7 +187,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
|
|||
appender: telemetryAppender,
|
||||
commonProperties: resolveCommonProperties(product.commit, product.version, configuration.machineId, product.msftInternalDomains, installSourcePath),
|
||||
sendErrorTelemetry: true,
|
||||
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
|
||||
piiPaths: [appRoot, extensionsPath]
|
||||
};
|
||||
|
||||
telemetryService = new TelemetryService(config, configurationService);
|
||||
|
|
|
@ -531,7 +531,7 @@ export class CodeApplication extends Disposable {
|
|||
const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender')));
|
||||
const appender = new TelemetryAppenderClient(channel);
|
||||
const commonProperties = resolveCommonProperties(product.commit, product.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
|
||||
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
|
||||
const piiPaths = [this.environmentService.appRoot, this.environmentService.extensionsPath];
|
||||
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, sendErrorTelemetry: true };
|
||||
|
||||
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
|
||||
|
@ -731,11 +731,11 @@ export class CodeApplication extends Disposable {
|
|||
});
|
||||
|
||||
// Create a URL handler which forwards to the last active window
|
||||
const activeWindowManager = new ActiveWindowManager({
|
||||
const activeWindowManager = this._register(new ActiveWindowManager({
|
||||
onDidOpenWindow: nativeHostMainService.onDidOpenWindow,
|
||||
onDidFocusWindow: nativeHostMainService.onDidFocusWindow,
|
||||
getActiveWindowId: () => nativeHostMainService.getActiveWindowId(-1)
|
||||
});
|
||||
}));
|
||||
const activeWindowRouter = new StaticRouter(ctx => activeWindowManager.getActiveClientId().then(id => ctx === id));
|
||||
const urlHandlerRouter = new URLHandlerRouter(activeWindowRouter);
|
||||
const urlHandlerChannel = electronIpcServer.getChannel('urlHandler', urlHandlerRouter);
|
||||
|
|
|
@ -343,15 +343,7 @@ class CodeMain {
|
|||
|
||||
private handleStartupDataDirError(environmentService: IEnvironmentMainService, error: NodeJS.ErrnoException): void {
|
||||
if (error.code === 'EACCES' || error.code === 'EPERM') {
|
||||
const directories = [environmentService.userDataPath];
|
||||
|
||||
if (environmentService.extensionsPath) {
|
||||
directories.push(environmentService.extensionsPath);
|
||||
}
|
||||
|
||||
if (XDG_RUNTIME_DIR) {
|
||||
directories.push(XDG_RUNTIME_DIR);
|
||||
}
|
||||
const directories = coalesce([environmentService.userDataPath, environmentService.extensionsPath, XDG_RUNTIME_DIR]);
|
||||
|
||||
this.showStartupWarningDialog(
|
||||
localize('startupDataDirError', "Unable to write program user data."),
|
||||
|
|
|
@ -93,7 +93,7 @@ export class Main {
|
|||
} else if (argv['locate-extension']) {
|
||||
await this.locateExtension(argv['locate-extension']);
|
||||
} else if (argv['telemetry']) {
|
||||
console.log(buildTelemetryMessage(this.environmentService.appRoot, this.environmentService.extensionsPath ? this.environmentService.extensionsPath : undefined));
|
||||
console.log(buildTelemetryMessage(this.environmentService.appRoot, this.environmentService.extensionsPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ export async function main(argv: NativeParsedArgs): Promise<void> {
|
|||
appender: combinedAppender(...appenders),
|
||||
sendErrorTelemetry: false,
|
||||
commonProperties: resolveCommonProperties(product.commit, product.version, stateService.getItem('telemetry.machineId'), product.msftInternalDomains, installSourcePath),
|
||||
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
|
||||
piiPaths: [appRoot, extensionsPath]
|
||||
};
|
||||
|
||||
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
|
||||
|
|
|
@ -119,7 +119,7 @@ export interface INativeEnvironmentService extends IEnvironmentService {
|
|||
sharedIPCHandle: string;
|
||||
|
||||
// --- Extensions
|
||||
extensionsPath?: string;
|
||||
extensionsPath: string;
|
||||
extensionsDownloadPath: string;
|
||||
builtinExtensionsPath: string;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ export class ExtensionsScanner extends Disposable {
|
|||
) {
|
||||
super();
|
||||
this.systemExtensionsPath = environmentService.builtinExtensionsPath;
|
||||
this.extensionsPath = environmentService.extensionsPath!;
|
||||
this.extensionsPath = environmentService.extensionsPath;
|
||||
this.uninstalledPath = path.join(this.extensionsPath, '.obsolete');
|
||||
this.uninstalledFileLimiter = new Queue();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ export const enum WindowMode {
|
|||
|
||||
export interface ICodeWindow extends IDisposable {
|
||||
|
||||
readonly onLoad: Event<void>;
|
||||
readonly onReady: Event<void>;
|
||||
readonly onClose: Event<void>;
|
||||
readonly onDestroy: Event<void>;
|
||||
|
||||
readonly whenClosedOrLoaded: Promise<void>;
|
||||
|
||||
readonly id: number;
|
||||
|
|
|
@ -73,10 +73,8 @@ class ExtensionsContributions implements IWorkbenchContribution {
|
|||
@ISharedProcessService sharedProcessService: ISharedProcessService,
|
||||
) {
|
||||
sharedProcessService.registerChannel('IExtensionRecommendationNotificationService', new ExtensionRecommendationNotificationServiceChannel(extensionRecommendationNotificationService));
|
||||
if (environmentService.extensionsPath) {
|
||||
const openExtensionsFolderActionDescriptor = SyncActionDescriptor.from(OpenExtensionsFolderAction);
|
||||
actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Extensions: Open Extensions Folder', ExtensionsLabel);
|
||||
}
|
||||
const openExtensionsFolderActionDescriptor = SyncActionDescriptor.from(OpenExtensionsFolderAction);
|
||||
actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, 'Extensions: Open Extensions Folder', ExtensionsLabel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,20 +27,18 @@ export class OpenExtensionsFolderAction extends Action {
|
|||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
if (this.environmentService.extensionsPath) {
|
||||
const extensionsHome = URI.file(this.environmentService.extensionsPath);
|
||||
const file = await this.fileService.resolve(extensionsHome);
|
||||
const extensionsHome = URI.file(this.environmentService.extensionsPath);
|
||||
const file = await this.fileService.resolve(extensionsHome);
|
||||
|
||||
let itemToShow: URI;
|
||||
if (file.children && file.children.length > 0) {
|
||||
itemToShow = file.children[0].resource;
|
||||
} else {
|
||||
itemToShow = extensionsHome;
|
||||
}
|
||||
let itemToShow: URI;
|
||||
if (file.children && file.children.length > 0) {
|
||||
itemToShow = file.children[0].resource;
|
||||
} else {
|
||||
itemToShow = extensionsHome;
|
||||
}
|
||||
|
||||
if (itemToShow.scheme === Schemas.file) {
|
||||
return this.nativeHostService.showItemInFolder(itemToShow.fsPath);
|
||||
}
|
||||
if (itemToShow.scheme === Schemas.file) {
|
||||
return this.nativeHostService.showItemInFolder(itemToShow.fsPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
|
|||
|
||||
sharedIPCHandle: string = undefined!;
|
||||
|
||||
extensionsPath?: string | undefined;
|
||||
extensionsPath: string = undefined!;
|
||||
extensionsDownloadPath: string = undefined!;
|
||||
builtinExtensionsPath: string = undefined!;
|
||||
|
||||
|
|
|
@ -273,18 +273,14 @@ export class CachedExtensionScanner {
|
|||
finalBuiltinExtensions = ExtensionScanner.mergeBuiltinExtensions(builtinExtensions, extraBuiltinExtensions);
|
||||
}
|
||||
|
||||
const userExtensions = (
|
||||
!environmentService.extensionsPath
|
||||
? Promise.resolve([])
|
||||
: this._scanExtensionsWithCache(
|
||||
hostService,
|
||||
notificationService,
|
||||
environmentService,
|
||||
USER_MANIFEST_CACHE_FILE,
|
||||
new ExtensionScannerInput(version, commit, locale, devMode, environmentService.extensionsPath, false, false, translations),
|
||||
log
|
||||
)
|
||||
);
|
||||
const userExtensions = (this._scanExtensionsWithCache(
|
||||
hostService,
|
||||
notificationService,
|
||||
environmentService,
|
||||
USER_MANIFEST_CACHE_FILE,
|
||||
new ExtensionScannerInput(version, commit, locale, devMode, environmentService.extensionsPath, false, false, translations),
|
||||
log
|
||||
));
|
||||
|
||||
// Always load developed extensions while extensions development
|
||||
let developedExtensions: Promise<IExtensionDescription[]> = Promise.resolve([]);
|
||||
|
|
|
@ -38,7 +38,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
|
|||
const config: ITelemetryServiceConfig = {
|
||||
appender: new TelemetryAppenderClient(channel),
|
||||
commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.machineId, productService.msftInternalDomains, environmentService.installSourcePath, environmentService.remoteAuthority),
|
||||
piiPaths: environmentService.extensionsPath ? [environmentService.appRoot, environmentService.extensionsPath] : [environmentService.appRoot],
|
||||
piiPaths: [environmentService.appRoot, environmentService.extensionsPath],
|
||||
sendErrorTelemetry: true
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue