mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 17:23:45 -05:00
Merge vscode source through 1.62 release (#19981)
* Build breaks 1 * Build breaks * Build breaks * Build breaks * More build breaks * Build breaks (#2512) * Runtime breaks * Build breaks * Fix dialog location break * Update typescript * Fix ASAR break issue * Unit test breaks * Update distro * Fix breaks in ADO builds (#2513) * Bump to node 16 * Fix hygiene errors * Bump distro * Remove reference to node type * Delete vscode specific extension * Bump to node 16 in CI yaml * Skip integration tests in CI builds (while fixing) * yarn.lock update * Bump moment dependency in remote yarn * Fix drop-down chevron style * Bump to node 16 * Remove playwrite from ci.yaml * Skip building build scripts in hygine check
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -7,6 +7,12 @@
|
||||
</script>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<!-- Mobile tweaks -->
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-title" content="Code">
|
||||
<link rel="apple-touch-icon" href="/code-192.png" />
|
||||
|
||||
<!-- Disable pinch zooming -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
performance.mark('code/didStartRenderer')
|
||||
performance.mark('code/didStartRenderer');
|
||||
</script>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<!-- Mobile tweaks -->
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-title" content="Code">
|
||||
<link rel="apple-touch-icon" href="/code-192.png" />
|
||||
|
||||
<!-- Disable pinch zooming -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { localize } from 'vs/nls';
|
||||
import { parseLogLevel } from 'vs/platform/log/common/log';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { create, ICredentialsProvider, IHomeIndicator, IProductQualityChangeHandler, ISettingsSyncOptions, IURLCallbackProvider, IWindowIndicator, IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from 'vs/workbench/workbench.web.api';
|
||||
import { create, ICredentialsProvider, IHomeIndicator, IProductQualityChangeHandler, ISettingsSyncOptions, IURLCallbackProvider, IWelcomeBanner, IWindowIndicator, IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from 'vs/workbench/workbench.web.api';
|
||||
|
||||
function doCreateUri(path: string, queryValues: Map<string, string>): URI {
|
||||
let query: string | undefined = undefined;
|
||||
@@ -185,6 +185,10 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider {
|
||||
url: doCreateUri('/auth/logout', queryValues).toString(true)
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
|
||||
async clear(): Promise<void> {
|
||||
window.localStorage.removeItem(LocalStorageCredentialsProvider.CREDENTIALS_OPENED_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
class PollingURLCallbackProvider extends Disposable implements IURLCallbackProvider {
|
||||
@@ -390,14 +394,14 @@ class WindowIndicator implements IWindowIndicator {
|
||||
|
||||
// Repo
|
||||
if (repositoryName && repositoryOwner) {
|
||||
this.label = localize('playgroundLabelRepository', "$(remote) VS Code Web Playground: {0}/{1}", repositoryOwner, repositoryName);
|
||||
this.tooltip = localize('playgroundRepositoryTooltip', "VS Code Web Playground: {0}/{1}", repositoryOwner, repositoryName);
|
||||
this.label = localize('playgroundLabelRepository', "$(remote) Visual Studio Code Playground: {0}/{1}", repositoryOwner, repositoryName);
|
||||
this.tooltip = localize('playgroundRepositoryTooltip', "Visual Studio Code Playground: {0}/{1}", repositoryOwner, repositoryName);
|
||||
}
|
||||
|
||||
// No Repo
|
||||
else {
|
||||
this.label = localize('playgroundLabel', "$(remote) VS Code Web Playground");
|
||||
this.tooltip = localize('playgroundTooltip', "VS Code Web Playground");
|
||||
this.label = localize('playgroundLabel', "$(remote) Visual Studio Code Playground");
|
||||
this.tooltip = localize('playgroundTooltip', "Visual Studio Code Playground");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,6 +485,15 @@ class WindowIndicator implements IWindowIndicator {
|
||||
title: localize('home', "Home")
|
||||
};
|
||||
|
||||
// Welcome Banner
|
||||
const welcomeBanner: IWelcomeBanner = {
|
||||
message: localize('welcomeBannerMessage', "{0} Web. Browser based playground for testing.", product.nameShort),
|
||||
actions: [{
|
||||
href: 'https://github.com/microsoft/vscode',
|
||||
label: localize('learnMore', "Learn More")
|
||||
}]
|
||||
};
|
||||
|
||||
// Window indicator (unless connected to a remote)
|
||||
let windowIndicator: WindowIndicator | undefined = undefined;
|
||||
if (!workspaceProvider.hasRemote()) {
|
||||
@@ -517,6 +530,7 @@ class WindowIndicator implements IWindowIndicator {
|
||||
settingsSyncOptions,
|
||||
homeIndicator,
|
||||
windowIndicator,
|
||||
welcomeBanner,
|
||||
productQualityChangeHandler,
|
||||
workspaceProvider,
|
||||
urlCallbackProvider: new PollingURLCallbackProvider(),
|
||||
|
||||
@@ -36,7 +36,7 @@ export class CodeCacheCleaner extends Disposable {
|
||||
}
|
||||
|
||||
private async cleanUpCodeCaches(currentCodeCachePath: string): Promise<void> {
|
||||
this.logService.info('[code cache cleanup]: Starting to clean up old code cache folders.');
|
||||
this.logService.trace('[code cache cleanup]: Starting to clean up old code cache folders.');
|
||||
|
||||
try {
|
||||
const now = Date.now();
|
||||
@@ -56,7 +56,7 @@ export class CodeCacheCleaner extends Disposable {
|
||||
const codeCacheEntryPath = join(codeCacheRootPath, codeCache);
|
||||
const codeCacheEntryStat = await Promises.stat(codeCacheEntryPath);
|
||||
if (codeCacheEntryStat.isDirectory() && (now - codeCacheEntryStat.mtime.getTime()) > this._DataMaxAge) {
|
||||
this.logService.info(`[code cache cleanup]: Removing code cache folder ${codeCache}.`);
|
||||
this.logService.trace(`[code cache cleanup]: Removing code cache folder ${codeCache}.`);
|
||||
|
||||
return Promises.rm(codeCacheEntryPath);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export class LanguagePackCachedDataCleaner extends Disposable {
|
||||
}
|
||||
|
||||
private async cleanUpLanguagePackCache(): Promise<void> {
|
||||
this.logService.info('[language pack cache cleanup]: Starting to clean up unused language packs.');
|
||||
this.logService.trace('[language pack cache cleanup]: Starting to clean up unused language packs.');
|
||||
|
||||
try {
|
||||
const installed: IStringDictionary<boolean> = Object.create(null);
|
||||
@@ -74,11 +74,11 @@ export class LanguagePackCachedDataCleaner extends Disposable {
|
||||
const entries = await Promises.readdir(cacheDir);
|
||||
for (const entry of entries) {
|
||||
if (installed[entry]) {
|
||||
this.logService.info(`[language pack cache cleanup]: Skipping folder ${entry}. Language pack still in use.`);
|
||||
this.logService.trace(`[language pack cache cleanup]: Skipping folder ${entry}. Language pack still in use.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.logService.info(`[language pack cache cleanup]: Removing unused language pack: ${entry}`);
|
||||
this.logService.trace(`[language pack cache cleanup]: Removing unused language pack: ${entry}`);
|
||||
|
||||
await Promises.rm(join(cacheDir, entry));
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export class LanguagePackCachedDataCleaner extends Disposable {
|
||||
const candidate = join(folder, entry);
|
||||
const stat = await Promises.stat(candidate);
|
||||
if (stat.isDirectory() && (now - stat.mtime.getTime()) > this._DataMaxAge) {
|
||||
this.logService.info(`[language pack cache cleanup]: Removing language pack cache folder: ${join(packEntry, entry)}`);
|
||||
this.logService.trace(`[language pack cache cleanup]: Removing language pack cache folder: ${join(packEntry, entry)}`);
|
||||
|
||||
await Promises.rm(candidate);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class LogsDataCleaner extends Disposable {
|
||||
}
|
||||
|
||||
private async cleanUpOldLogs(): Promise<void> {
|
||||
this.logService.info('[logs cleanup]: Starting to clean up old logs.');
|
||||
this.logService.trace('[logs cleanup]: Starting to clean up old logs.');
|
||||
|
||||
try {
|
||||
const currentLog = basename(this.environmentService.logsPath);
|
||||
@@ -39,7 +39,7 @@ export class LogsDataCleaner extends Disposable {
|
||||
const sessionsToDelete = oldSessions.slice(0, Math.max(0, oldSessions.length - 9));
|
||||
|
||||
if (sessionsToDelete.length > 0) {
|
||||
this.logService.info(`[logs cleanup]: Removing log folders '${sessionsToDelete.join(', ')}'`);
|
||||
this.logService.trace(`[logs cleanup]: Removing log folders '${sessionsToDelete.join(', ')}'`);
|
||||
|
||||
await Promise.all(sessionsToDelete.map(sessionToDelete => Promises.rm(join(logsRoot, sessionToDelete))));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export class StorageDataCleaner extends Disposable {
|
||||
}
|
||||
|
||||
private async cleanUpStorage(): Promise<void> {
|
||||
this.logService.info('[storage cleanup]: Starting to clean up storage folders.');
|
||||
this.logService.trace('[storage cleanup]: Starting to clean up storage folders.');
|
||||
|
||||
try {
|
||||
|
||||
@@ -50,7 +50,7 @@ export class StorageDataCleaner extends Disposable {
|
||||
}
|
||||
|
||||
if (emptyWorkspaces.indexOf(storageFolder) === -1) {
|
||||
this.logService.info(`[storage cleanup]: Deleting storage folder ${storageFolder}.`);
|
||||
this.logService.trace(`[storage cleanup]: Deleting storage folder ${storageFolder}.`);
|
||||
|
||||
await Promises.rm(join(this.environmentService.workspaceStorageHome.fsPath, storageFolder));
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import * as fs from 'fs';
|
||||
import { gracefulify } from 'graceful-fs';
|
||||
import { hostname, release } from 'os';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
@@ -65,7 +63,7 @@ import { ICustomEndpointTelemetryService, ITelemetryService } from 'vs/platform/
|
||||
import { TelemetryAppenderChannel } from 'vs/platform/telemetry/common/telemetryIpc';
|
||||
import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
|
||||
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { combinedAppender, ITelemetryAppender, NullAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { supportsTelemetry, ITelemetryAppender, NullAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { CustomEndpointTelemetryService } from 'vs/platform/telemetry/node/customEndpointTelemetryService';
|
||||
import { LocalReconnectConstants, TerminalIpcChannels, TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
@@ -86,26 +84,51 @@ import { UserDataSyncChannel } from 'vs/platform/userDataSync/common/userDataSyn
|
||||
import { UserDataSyncStoreManagementService, UserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSyncStoreService';
|
||||
import { UserDataAutoSyncService } from 'vs/platform/userDataSync/electron-sandbox/userDataAutoSyncService';
|
||||
import { ActiveWindowManager } from 'vs/platform/windows/node/windowTracker';
|
||||
import { IExtensionHostStarter, ipcExtensionHostStarterChannelName } from 'vs/platform/extensions/common/extensionHostStarter';
|
||||
import { ExtensionHostStarter } from 'vs/platform/extensions/node/extensionHostStarter';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { SignService } from 'vs/platform/sign/node/signService';
|
||||
import { ISharedTunnelsService } from 'vs/platform/remote/common/tunnel';
|
||||
import { SharedTunnelsService } from 'vs/platform/remote/node/tunnelService';
|
||||
import { ipcSharedProcessTunnelChannelName, ISharedProcessTunnelService } from 'vs/platform/remote/common/sharedProcessTunnelService';
|
||||
import { SharedProcessTunnelService } from 'vs/platform/remote/node/sharedProcessTunnelService';
|
||||
import { ipcSharedProcessWorkerChannelName, ISharedProcessWorkerConfiguration, ISharedProcessWorkerService } from 'vs/platform/sharedProcess/common/sharedProcessWorkerService';
|
||||
import { SharedProcessWorkerService } from 'vs/platform/sharedProcess/electron-browser/sharedProcessWorkerService';
|
||||
import { IUserConfigurationFileService, UserConfigurationFileServiceId } from 'vs/platform/configuration/common/userConfigurationFileService';
|
||||
|
||||
class SharedProcessMain extends Disposable {
|
||||
|
||||
private server = this._register(new MessagePortServer());
|
||||
|
||||
private sharedProcessWorkerService: ISharedProcessWorkerService | undefined = undefined;
|
||||
|
||||
constructor(private configuration: ISharedProcessConfiguration) {
|
||||
super();
|
||||
|
||||
// Enable gracefulFs
|
||||
gracefulify(fs);
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
|
||||
// Dispose on exit
|
||||
// Shared process lifecycle
|
||||
const onExit = () => this.dispose();
|
||||
process.once('exit', onExit);
|
||||
ipcRenderer.once('vscode:electron-main->shared-process=exit', onExit);
|
||||
|
||||
// Shared process worker lifecycle
|
||||
//
|
||||
// We dispose the listener when the shared process is
|
||||
// disposed to avoid disposing workers when the entire
|
||||
// application is shutting down anyways.
|
||||
//
|
||||
const eventName = 'vscode:electron-main->shared-process=disposeWorker';
|
||||
const onDisposeWorker = (event: unknown, configuration: ISharedProcessWorkerConfiguration) => this.onDisposeWorker(configuration);
|
||||
ipcRenderer.on(eventName, onDisposeWorker);
|
||||
this._register(toDisposable(() => ipcRenderer.removeListener(eventName, onDisposeWorker)));
|
||||
}
|
||||
|
||||
private onDisposeWorker(configuration: ISharedProcessWorkerConfiguration): void {
|
||||
this.sharedProcessWorkerService?.disposeWorker(configuration);
|
||||
}
|
||||
|
||||
async open(): Promise<void> {
|
||||
@@ -170,6 +193,10 @@ class SharedProcessMain extends Disposable {
|
||||
const logService = this._register(new FollowerLogService(logLevelClient, multiplexLogger));
|
||||
services.set(ILogService, logService);
|
||||
|
||||
// Worker
|
||||
this.sharedProcessWorkerService = new SharedProcessWorkerService(logService);
|
||||
services.set(ISharedProcessWorkerService, this.sharedProcessWorkerService);
|
||||
|
||||
// Files
|
||||
const fileService = this._register(new FileService(logService));
|
||||
services.set(IFileService, fileService);
|
||||
@@ -181,15 +208,20 @@ class SharedProcessMain extends Disposable {
|
||||
const configurationService = this._register(new ConfigurationService(environmentService.settingsResource, fileService));
|
||||
services.set(IConfigurationService, configurationService);
|
||||
|
||||
await configurationService.initialize();
|
||||
|
||||
// Storage (global access only)
|
||||
const storageService = new NativeStorageService(undefined, mainProcessService, environmentService);
|
||||
services.set(IStorageService, storageService);
|
||||
|
||||
await storageService.initialize();
|
||||
this._register(toDisposable(() => storageService.flush()));
|
||||
|
||||
// Initialize config & storage in parallel
|
||||
await Promise.all([
|
||||
configurationService.initialize(),
|
||||
storageService.initialize()
|
||||
]);
|
||||
|
||||
// User Configuration File
|
||||
services.set(IUserConfigurationFileService, ProxyChannel.toService<IUserConfigurationFileService>(mainProcessService.getChannel(UserConfigurationFileServiceId)));
|
||||
|
||||
// Request
|
||||
services.set(IRequestService, new SyncDescriptor(RequestService));
|
||||
|
||||
@@ -210,31 +242,32 @@ class SharedProcessMain extends Disposable {
|
||||
|
||||
// Telemetry
|
||||
let telemetryService: ITelemetryService;
|
||||
let telemetryAppender: ITelemetryAppender;
|
||||
if (!environmentService.isExtensionDevelopment && !environmentService.disableTelemetry && productService.enableTelemetry) {
|
||||
telemetryAppender = new TelemetryLogAppender(loggerService, environmentService);
|
||||
|
||||
const { appRoot, extensionsPath, isBuilt, installSourcePath } = environmentService;
|
||||
const appenders: ITelemetryAppender[] = [];
|
||||
if (supportsTelemetry(productService, environmentService)) {
|
||||
const logAppender = new TelemetryLogAppender(loggerService, environmentService);
|
||||
appenders.push(logAppender);
|
||||
const { appRoot, extensionsPath, installSourcePath } = environmentService;
|
||||
|
||||
// Application Insights
|
||||
if (productService.aiConfig && productService.aiConfig.asimovKey && isBuilt) {
|
||||
if (productService.aiConfig && productService.aiConfig.asimovKey) {
|
||||
const appInsightsAppender = new AppInsightsAppender('adsworkbench', null, productService.aiConfig.asimovKey); // {{SQL CARBON EDIT}} Use our own event prefix
|
||||
this._register(toDisposable(() => appInsightsAppender.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
|
||||
telemetryAppender = combinedAppender(appInsightsAppender, telemetryAppender);
|
||||
appenders.push(appInsightsAppender);
|
||||
}
|
||||
|
||||
telemetryService = new TelemetryService({
|
||||
appender: telemetryAppender,
|
||||
appenders,
|
||||
commonProperties: resolveCommonProperties(fileService, release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, productService.msftInternalDomains, installSourcePath),
|
||||
sendErrorTelemetry: true,
|
||||
piiPaths: [appRoot, extensionsPath]
|
||||
}, configurationService);
|
||||
} else {
|
||||
telemetryService = NullTelemetryService;
|
||||
telemetryAppender = NullAppender;
|
||||
const nullAppender = NullAppender;
|
||||
appenders.push(nullAppender);
|
||||
}
|
||||
|
||||
this.server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(telemetryAppender));
|
||||
this.server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appenders));
|
||||
services.set(ITelemetryService, telemetryService);
|
||||
|
||||
// Custom Endpoint Telemetry
|
||||
@@ -271,22 +304,30 @@ class SharedProcessMain extends Disposable {
|
||||
services.set(IUserDataSyncResourceEnablementService, new SyncDescriptor(UserDataSyncResourceEnablementService));
|
||||
services.set(IUserDataSyncService, new SyncDescriptor(UserDataSyncService));
|
||||
|
||||
// Terminal
|
||||
services.set(
|
||||
ILocalPtyService,
|
||||
this._register(
|
||||
new PtyHostService({
|
||||
graceTime: LocalReconnectConstants.GraceTime,
|
||||
shortGraceTime: LocalReconnectConstants.ShortGraceTime,
|
||||
scrollback: configurationService.getValue<number>(TerminalSettingId.PersistentSessionScrollback) ?? 100,
|
||||
useExperimentalSerialization: configurationService.getValue<boolean>(TerminalSettingId.PersistentSessionExperimentalSerializer) ?? true,
|
||||
},
|
||||
configurationService,
|
||||
logService,
|
||||
telemetryService
|
||||
)
|
||||
)
|
||||
const ptyHostService = new PtyHostService({
|
||||
graceTime: LocalReconnectConstants.GraceTime,
|
||||
shortGraceTime: LocalReconnectConstants.ShortGraceTime,
|
||||
scrollback: configurationService.getValue<number>(TerminalSettingId.PersistentSessionScrollback) ?? 100
|
||||
},
|
||||
configurationService,
|
||||
environmentService,
|
||||
logService,
|
||||
telemetryService
|
||||
);
|
||||
await ptyHostService.initialize();
|
||||
|
||||
// Terminal
|
||||
services.set(ILocalPtyService, this._register(ptyHostService));
|
||||
|
||||
// Extension Host
|
||||
services.set(IExtensionHostStarter, this._register(new ExtensionHostStarter(logService)));
|
||||
|
||||
// Signing
|
||||
services.set(ISignService, new SyncDescriptor(SignService));
|
||||
|
||||
// Tunnel
|
||||
services.set(ISharedTunnelsService, new SyncDescriptor(SharedTunnelsService));
|
||||
services.set(ISharedProcessTunnelService, new SyncDescriptor(SharedProcessTunnelService));
|
||||
|
||||
return new InstantiationService(services);
|
||||
}
|
||||
@@ -338,6 +379,18 @@ class SharedProcessMain extends Disposable {
|
||||
const localPtyService = accessor.get(ILocalPtyService);
|
||||
const localPtyChannel = ProxyChannel.fromService(localPtyService);
|
||||
this.server.registerChannel(TerminalIpcChannels.LocalPty, localPtyChannel);
|
||||
|
||||
// Extension Host
|
||||
const extensionHostStarterChannel = ProxyChannel.fromService(accessor.get(IExtensionHostStarter));
|
||||
this.server.registerChannel(ipcExtensionHostStarterChannelName, extensionHostStarterChannel);
|
||||
|
||||
// Tunnel
|
||||
const sharedProcessTunnelChannel = ProxyChannel.fromService(accessor.get(ISharedProcessTunnelService));
|
||||
this.server.registerChannel(ipcSharedProcessTunnelChannelName, sharedProcessTunnelChannel);
|
||||
|
||||
// Worker
|
||||
const sharedProcessWorkerChannel = ProxyChannel.fromService(accessor.get(ISharedProcessWorkerService));
|
||||
this.server.registerChannel(ipcSharedProcessWorkerChannelName, sharedProcessWorkerChannel);
|
||||
}
|
||||
|
||||
private registerErrorHandler(logService: ILogService): void {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { app, BrowserWindow, contentTracing, dialog, ipcMain, protocol, session,
|
||||
import { statSync } from 'fs';
|
||||
import { hostname, release } from 'os';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { isEqualOrParent } from 'vs/base/common/extpath';
|
||||
import { once } from 'vs/base/common/functional';
|
||||
@@ -17,7 +18,7 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { isAbsolute, join, posix } from 'vs/base/common/path';
|
||||
import { IProcessEnvironment, isLinux, isLinuxSnap, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { assertType, withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { getMachineId } from 'vs/base/node/id';
|
||||
@@ -46,6 +47,8 @@ import { ExtensionUrlTrustService } from 'vs/platform/extensionManagement/node/e
|
||||
import { IExternalTerminalMainService } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
import { LinuxExternalTerminalService, MacExternalTerminalService, WindowsExternalTerminalService } from 'vs/platform/externalTerminal/node/externalTerminalService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { DiskFileSystemProviderChannel } from 'vs/platform/files/electron-main/diskFileSystemProviderIpc';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
@@ -65,10 +68,10 @@ import { IStateMainService } from 'vs/platform/state/electron-main/state';
|
||||
import { StorageDatabaseChannel } from 'vs/platform/storage/electron-main/storageIpc';
|
||||
import { IStorageMainService, StorageMainService } from 'vs/platform/storage/electron-main/storageMainService';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
|
||||
import { ITelemetryService, machineIdKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ITelemetryService, machineIdKey, TelemetryLevel } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc';
|
||||
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { getTelemetryLevel, NullTelemetryService, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
import { UpdateChannel } from 'vs/platform/update/common/updateIpc';
|
||||
import { DarwinUpdateService } from 'vs/platform/update/electron-main/updateService.darwin';
|
||||
@@ -279,7 +282,7 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
|
||||
// Resolve shell env
|
||||
return resolveShellEnv(this.logService, args, env);
|
||||
return this.resolveShellEnvironment(args, env);
|
||||
});
|
||||
|
||||
ipcMain.handle('vscode:writeNlsFile', (event, path: unknown, data: unknown) => {
|
||||
@@ -531,12 +534,12 @@ export class CodeApplication extends Disposable {
|
||||
services.set(IURLService, new SyncDescriptor(NativeURLService));
|
||||
|
||||
// Telemetry
|
||||
if (!this.environmentMainService.isExtensionDevelopment && !this.environmentMainService.args['disable-telemetry'] && !!this.productService.enableTelemetry) {
|
||||
if (supportsTelemetry(this.productService, this.environmentMainService)) {
|
||||
const channel = getDelayedChannel(sharedProcessReady.then(client => client.getChannel('telemetryAppender')));
|
||||
const appender = new TelemetryAppenderClient(channel);
|
||||
const commonProperties = resolveCommonProperties(this.fileService, release(), hostname(), process.arch, this.productService.commit, this.productService.version, machineId, this.productService.msftInternalDomains, this.environmentMainService.installSourcePath);
|
||||
const piiPaths = [this.environmentMainService.appRoot, this.environmentMainService.extensionsPath];
|
||||
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, sendErrorTelemetry: true };
|
||||
const config: ITelemetryServiceConfig = { appenders: [appender], commonProperties, piiPaths, sendErrorTelemetry: true };
|
||||
|
||||
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, [config]));
|
||||
} else {
|
||||
@@ -558,8 +561,16 @@ export class CodeApplication extends Disposable {
|
||||
const launchChannel = ProxyChannel.fromService(accessor.get(ILaunchMainService), { disableMarshalling: true });
|
||||
this.mainProcessNodeIpcServer.registerChannel('launch', launchChannel);
|
||||
|
||||
// Configuration
|
||||
mainProcessElectronServer.registerChannel(UserConfigurationFileServiceId, ProxyChannel.fromService(new UserConfigurationFileService(this.environmentMainService, this.fileService, this.logService)));
|
||||
// Local Files
|
||||
const diskFileSystemProvider = this.fileService.getProvider(Schemas.file);
|
||||
assertType(diskFileSystemProvider instanceof DiskFileSystemProvider);
|
||||
const fileSystemProviderChannel = new DiskFileSystemProviderChannel(diskFileSystemProvider, this.logService);
|
||||
mainProcessElectronServer.registerChannel('localFilesystem', fileSystemProviderChannel);
|
||||
|
||||
// User Configuration File
|
||||
const userConfigurationFileService = new UserConfigurationFileService(this.environmentMainService, this.fileService, this.logService);
|
||||
mainProcessElectronServer.registerChannel(UserConfigurationFileServiceId, ProxyChannel.fromService(userConfigurationFileService));
|
||||
sharedProcessClient.then(client => client.registerChannel(UserConfigurationFileServiceId, ProxyChannel.fromService(userConfigurationFileService)));
|
||||
|
||||
// Update
|
||||
const updateChannel = new UpdateChannel(accessor.get(IUpdateService));
|
||||
@@ -846,9 +857,13 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
// File path
|
||||
if (uri.authority === Schemas.file) {
|
||||
// we configure as fileUri, but later validation will
|
||||
// make sure to open as folder or workspace if possible
|
||||
return { fileUri: URI.file(uri.fsPath) };
|
||||
const fileUri = URI.file(uri.fsPath);
|
||||
|
||||
if (hasWorkspaceFileExtension(fileUri)) {
|
||||
return { workspaceUri: fileUri };
|
||||
}
|
||||
|
||||
return { fileUri };
|
||||
}
|
||||
|
||||
// Remote path
|
||||
@@ -864,11 +879,14 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
if (hasWorkspaceFileExtension(path)) {
|
||||
return { workspaceUri: remoteUri };
|
||||
} else if (/:[\d]+$/.test(path)) { // path with :line:column syntax
|
||||
return { fileUri: remoteUri };
|
||||
} else {
|
||||
return { folderUri: remoteUri };
|
||||
}
|
||||
|
||||
if (/:[\d]+$/.test(path)) {
|
||||
// path with :line:column syntax
|
||||
return { fileUri: remoteUri };
|
||||
}
|
||||
|
||||
return { folderUri: remoteUri };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,7 +989,8 @@ export class CodeApplication extends Disposable {
|
||||
// Start to fetch shell environment (if needed) after window has opened
|
||||
// Since this operation can take a long time, we want to warm it up while
|
||||
// the window is opening.
|
||||
resolveShellEnv(this.logService, this.environmentMainService.args, process.env);
|
||||
// We also show an error to the user in case this fails.
|
||||
this.resolveShellEnvironment(this.environmentMainService.args, process.env);
|
||||
|
||||
// If enable-crash-reporter argv is undefined then this is a fresh start,
|
||||
// based on telemetry.enableCrashreporter settings, generate a UUID which
|
||||
@@ -981,8 +1000,8 @@ export class CodeApplication extends Disposable {
|
||||
const argvString = argvContent.value.toString();
|
||||
const argvJSON = JSON.parse(stripComments(argvString));
|
||||
if (argvJSON['enable-crash-reporter'] === undefined) {
|
||||
const enableCrashReporterSetting = this.configurationService.getValue('telemetry.enableCrashReporter');
|
||||
const enableCrashReporter = typeof enableCrashReporterSetting === 'boolean' ? enableCrashReporterSetting : true;
|
||||
const telemetryLevel = getTelemetryLevel(this.configurationService);
|
||||
const enableCrashReporter = telemetryLevel >= TelemetryLevel.CRASH;
|
||||
const additionalArgvContent = [
|
||||
'',
|
||||
' // Allows to disable crash reporting.',
|
||||
@@ -1003,6 +1022,16 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private async resolveShellEnvironment(args: NativeParsedArgs, env: IProcessEnvironment): Promise<typeof process.env> {
|
||||
try {
|
||||
return await resolveShellEnv(this.logService, args, env);
|
||||
} catch (error) {
|
||||
this.windowsMainService?.sendToFocused('vscode:showResolveShellEnvError', toErrorMessage(error));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
private stopTracingEventually(accessor: ServicesAccessor, windows: ICodeWindow[]): void {
|
||||
this.logService.info(`Tracing: waiting for windows to get ready...`);
|
||||
|
||||
@@ -1043,3 +1072,4 @@ export class CodeApplication extends Disposable {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview:; object-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https: ws:; font-src 'self' https: vscode-remote-resource:;">
|
||||
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types TrustedFunctionWorkaround ExtensionScripts amdLoader cellRendererEditorText defaultWorkerFactory diffEditorWidget editorGhostText domLineBreaksComputer editorViewLayer diffReview extensionHostWorker insane notebookRenderer safeInnerHtml standaloneColorizer tokenizeToString webNestedWorkerExtensionHost;">
|
||||
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types TrustedFunctionWorkaround ExtensionScripts amdLoader cellRendererEditorText defaultWorkerFactory diffEditorWidget editorGhostText domLineBreaksComputer editorViewLayer diffReview extensionHostWorker dompurify notebookRenderer safeInnerHtml standaloneColorizer tokenizeToString webNestedWorkerExtensionHost;">
|
||||
</head>
|
||||
<body aria-label="">
|
||||
</body>
|
||||
|
||||
@@ -5,20 +5,23 @@
|
||||
|
||||
import { ChildProcess, spawn, SpawnOptions } from 'child_process';
|
||||
import { chmodSync, existsSync, readFileSync, statSync, truncateSync, unlinkSync } from 'fs';
|
||||
import { homedir } from 'os';
|
||||
import { homedir, release, tmpdir } from 'os';
|
||||
import type { ProfilingSession, Target } from 'v8-inspect-profiler';
|
||||
import { isAbsolute, join } from 'vs/base/common/path';
|
||||
import { IProcessEnvironment, isWindows } from 'vs/base/common/platform';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { isAbsolute, join, resolve } from 'vs/base/common/path';
|
||||
import { IProcessEnvironment, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { randomPort } from 'vs/base/common/ports';
|
||||
import { isString } from 'vs/base/common/types';
|
||||
import { whenDeleted, writeFileSync } from 'vs/base/node/pfs';
|
||||
import { findFreePort } from 'vs/base/node/ports';
|
||||
import { watchFileContents } from 'vs/base/node/watcher';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { buildHelpMessage, buildVersionMessage, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { addArg, parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
|
||||
import { getStdinFilePath, hasStdinWithoutTty, readFromStdin, stdinDataListener } from 'vs/platform/environment/node/stdin';
|
||||
import { createWaitMarkerFile } from 'vs/platform/environment/node/wait';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
|
||||
function shouldSpawnCliProcess(argv: NativeParsedArgs): boolean {
|
||||
return !!argv['install-source']
|
||||
@@ -29,6 +32,10 @@ function shouldSpawnCliProcess(argv: NativeParsedArgs): boolean {
|
||||
|| !!argv['telemetry'];
|
||||
}
|
||||
|
||||
function createFileName(dir: string, prefix: string): string {
|
||||
return join(dir, `${prefix}-${Math.random().toString(16).slice(-4)}`);
|
||||
}
|
||||
|
||||
interface IMainCli {
|
||||
main: (argv: NativeParsedArgs) => Promise<void>;
|
||||
}
|
||||
@@ -134,7 +141,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
child.stdout!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
child.stderr!.on('data', (data: Buffer) => console.log(data.toString('utf8').trim()));
|
||||
|
||||
await new Promise<void>(resolve => child.once('exit', () => resolve()));
|
||||
await Event.toPromise(Event.fromNodeEventEmitter(child, 'exit'));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -188,6 +195,8 @@ export async function main(argv: string[]): Promise<any> {
|
||||
}
|
||||
}
|
||||
|
||||
const isMacOSBigSurOrNewer = isMacintosh && release() > '20.0.0';
|
||||
|
||||
// If we are started with --wait create a random temporary file
|
||||
// and pass it over to the starting instance. We can use this file
|
||||
// to wait for it to be deleted to monitor that the edited file
|
||||
@@ -198,6 +207,42 @@ export async function main(argv: string[]): Promise<any> {
|
||||
if (waitMarkerFilePath) {
|
||||
addArg(argv, '--waitMarkerFilePath', waitMarkerFilePath);
|
||||
}
|
||||
|
||||
// When running with --wait, we want to continue running CLI process
|
||||
// until either:
|
||||
// - the wait marker file has been deleted (e.g. when closing the editor)
|
||||
// - the launched process terminates (e.g. due to a crash)
|
||||
processCallbacks.push(async child => {
|
||||
let childExitPromise;
|
||||
if (isMacOSBigSurOrNewer) {
|
||||
// On Big Sur, we resolve the following promise only when the child,
|
||||
// i.e. the open command, exited with a signal or error. Otherwise, we
|
||||
// wait for the marker file to be deleted or for the child to error.
|
||||
childExitPromise = new Promise<void>(resolve => {
|
||||
// Only resolve this promise if the child (i.e. open) exited with an error
|
||||
child.on('exit', (code, signal) => {
|
||||
if (code !== 0 || signal) {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// On other platforms, we listen for exit in case the child exits before the
|
||||
// marker file is deleted.
|
||||
childExitPromise = Event.toPromise(Event.fromNodeEventEmitter(child, 'exit'));
|
||||
}
|
||||
try {
|
||||
await Promise.race([
|
||||
whenDeleted(waitMarkerFilePath!),
|
||||
Event.toPromise(Event.fromNodeEventEmitter(child, 'error')),
|
||||
childExitPromise
|
||||
]);
|
||||
} finally {
|
||||
if (stdinFilePath) {
|
||||
unlinkSync(stdinFilePath); // Make sure to delete the tmp stdin file if we have any
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// If we have been started with `--prof-startup` we need to find free ports to profile
|
||||
@@ -214,7 +259,7 @@ export async function main(argv: string[]): Promise<any> {
|
||||
throw new Error('Failed to find free ports for profiler. Make sure to shutdown all instances of the editor first.');
|
||||
}
|
||||
|
||||
const filenamePrefix = join(homedir(), 'prof-' + Math.random().toString(16).slice(-4));
|
||||
const filenamePrefix = createFileName(homedir(), 'prof');
|
||||
|
||||
addArg(argv, `--inspect-brk=${portMain}`);
|
||||
addArg(argv, `--remote-debugging-port=${portRenderer}`);
|
||||
@@ -319,23 +364,82 @@ export async function main(argv: string[]): Promise<any> {
|
||||
options['stdio'] = 'ignore';
|
||||
}
|
||||
|
||||
const child = spawn(process.execPath, argv.slice(2), options);
|
||||
let child: ChildProcess;
|
||||
if (!isMacOSBigSurOrNewer) {
|
||||
// We spawn process.execPath directly
|
||||
child = spawn(process.execPath, argv.slice(2), options);
|
||||
} else {
|
||||
// On Big Sur, we spawn using the open command to obtain behavior
|
||||
// similar to if the app was launched from the dock
|
||||
// https://github.com/microsoft/vscode/issues/102975
|
||||
|
||||
if (args.wait && waitMarkerFilePath) {
|
||||
return new Promise<void>(resolve => {
|
||||
// The following args are for the open command itself, rather than for VS Code:
|
||||
// -n creates a new instance.
|
||||
// Without -n, the open command re-opens the existing instance as-is.
|
||||
// -g starts the new instance in the background.
|
||||
// Later, Electron brings the instance to the foreground.
|
||||
// This way, Mac does not automatically try to foreground the new instance, which causes
|
||||
// focusing issues when the new instance only sends data to a previous instance and then closes.
|
||||
const spawnArgs = ['-n', '-g'];
|
||||
// -a opens the given application.
|
||||
spawnArgs.push('-a', process.execPath); // -a: opens a specific application
|
||||
|
||||
// Complete when process exits
|
||||
child.once('exit', () => resolve(undefined));
|
||||
if (verbose) {
|
||||
spawnArgs.push('--wait-apps'); // `open --wait-apps`: blocks until the launched app is closed (even if they were already running)
|
||||
|
||||
// Complete when wait marker file is deleted
|
||||
whenDeleted(waitMarkerFilePath!).then(resolve, resolve);
|
||||
}).then(() => {
|
||||
// The open command only allows for redirecting stderr and stdout to files,
|
||||
// so we make it redirect those to temp files, and then use a logger to
|
||||
// redirect the file output to the console
|
||||
for (const outputType of ['stdout', 'stderr']) {
|
||||
|
||||
// Make sure to delete the tmp stdin file if we have any
|
||||
if (stdinFilePath) {
|
||||
unlinkSync(stdinFilePath);
|
||||
// Tmp file to target output to
|
||||
const tmpName = createFileName(tmpdir(), `code-${outputType}`);
|
||||
writeFileSync(tmpName, '');
|
||||
spawnArgs.push(`--${outputType}`, tmpName);
|
||||
|
||||
// Listener to redirect content to stdout/stderr
|
||||
processCallbacks.push(async child => {
|
||||
try {
|
||||
const stream = outputType === 'stdout' ? process.stdout : process.stderr;
|
||||
|
||||
const cts = new CancellationTokenSource();
|
||||
child.on('close', () => cts.dispose(true));
|
||||
await watchFileContents(tmpName, chunk => stream.write(chunk), cts.token);
|
||||
} finally {
|
||||
unlinkSync(tmpName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const e in env) {
|
||||
// Ignore the _ env var, because the open command
|
||||
// ignores it anyway.
|
||||
// Pass the rest of the env vars in to fix
|
||||
// https://github.com/microsoft/vscode/issues/134696.
|
||||
if (e !== '_') {
|
||||
spawnArgs.push('--env');
|
||||
spawnArgs.push(`${e}=${env[e]}`);
|
||||
}
|
||||
}
|
||||
|
||||
spawnArgs.push('--args', ...argv.slice(2)); // pass on our arguments
|
||||
|
||||
if (env['VSCODE_DEV']) {
|
||||
// If we're in development mode, replace the . arg with the
|
||||
// vscode source arg. Because the OSS app isn't bundled,
|
||||
// it needs the full vscode source arg to launch properly.
|
||||
const curdir = '.';
|
||||
const launchDirIndex = spawnArgs.indexOf(curdir);
|
||||
if (launchDirIndex !== -1) {
|
||||
spawnArgs[launchDirIndex] = resolve(curdir);
|
||||
}
|
||||
}
|
||||
|
||||
// We already passed over the env variables
|
||||
// using the --env flags, so we can leave them out here.
|
||||
// Also, we don't need to pass env._, which is different from argv._
|
||||
child = spawn('open', spawnArgs, { ...options, env: {} });
|
||||
}
|
||||
|
||||
return Promise.all(processCallbacks.map(callback => callback(child)));
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { gracefulify } from 'graceful-fs';
|
||||
import { hostname, release } from 'os';
|
||||
import { raceTimeout } from 'vs/base/common/async';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
@@ -18,10 +16,12 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { Promises } from 'vs/base/node/pfs';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationService } from 'vs/platform/configuration/common/configurationService';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { DownloadService } from 'vs/platform/download/common/downloadService';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { ExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
import { ExtensionGalleryServiceWithNoStorageService } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
import { IExtensionGalleryService, IExtensionManagementCLIService, IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionManagementCLIService } from 'vs/platform/extensionManagement/common/extensionManagementCLIService';
|
||||
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
|
||||
@@ -43,7 +43,7 @@ import { RequestService } from 'vs/platform/request/node/requestService';
|
||||
import { resolveCommonProperties } from 'vs/platform/telemetry/common/commonProperties';
|
||||
import { ITelemetryService, machineIdKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ITelemetryServiceConfig, TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { supportsTelemetry, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { buildTelemetryMessage } from 'vs/platform/telemetry/node/telemetry';
|
||||
|
||||
@@ -54,9 +54,6 @@ class CliMain extends Disposable {
|
||||
) {
|
||||
super();
|
||||
|
||||
// Enable gracefulFs
|
||||
gracefulify(fs);
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
@@ -87,7 +84,10 @@ class CliMain extends Disposable {
|
||||
await this.doRun(environmentService, extensionManagementCLIService, fileService);
|
||||
|
||||
// Flush the remaining data in AI adapter (with 1s timeout)
|
||||
return raceTimeout(combinedAppender(...appenders).flush(), 1000);
|
||||
await Promise.all(appenders.map(a => {
|
||||
raceTimeout(a.flush(), 1000);
|
||||
}));
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -133,9 +133,12 @@ class CliMain extends Disposable {
|
||||
// Request
|
||||
services.set(IRequestService, new SyncDescriptor(RequestService));
|
||||
|
||||
// Download Service
|
||||
services.set(IDownloadService, new SyncDescriptor(DownloadService));
|
||||
|
||||
// Extensions
|
||||
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
|
||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
|
||||
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryServiceWithNoStorageService));
|
||||
services.set(IExtensionManagementCLIService, new SyncDescriptor(ExtensionManagementCLIService));
|
||||
|
||||
// Localizations
|
||||
@@ -143,7 +146,7 @@ class CliMain extends Disposable {
|
||||
|
||||
// Telemetry
|
||||
const appenders: AppInsightsAppender[] = [];
|
||||
if (environmentService.isBuilt && !environmentService.isExtensionDevelopment && !environmentService.disableTelemetry && productService.enableTelemetry) {
|
||||
if (supportsTelemetry(productService, environmentService)) {
|
||||
if (productService.aiConfig && productService.aiConfig.asimovKey) {
|
||||
appenders.push(new AppInsightsAppender('adsworkbench', null, productService.aiConfig.asimovKey)); // {{SQL CARBON EDIT}} Use our own event prefix
|
||||
}
|
||||
@@ -151,7 +154,7 @@ class CliMain extends Disposable {
|
||||
const { appRoot, extensionsPath, installSourcePath } = environmentService;
|
||||
|
||||
const config: ITelemetryServiceConfig = {
|
||||
appender: combinedAppender(...appenders),
|
||||
appenders,
|
||||
sendErrorTelemetry: false,
|
||||
commonProperties: (async () => {
|
||||
let machineId: string | undefined = undefined;
|
||||
|
||||
Reference in New Issue
Block a user