mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -43,8 +43,6 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'goto': { type: 'boolean', cat: 'o', alias: 'g', args: 'file:line[:character]', description: localize('goto', "Open a file at the path on the specified line and character position.") },
|
||||
'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindow', "Force to open a new window.") },
|
||||
'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindow', "Force to open a file or folder in an already opened window.") },
|
||||
'folder-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") },
|
||||
'file-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") },
|
||||
'wait': { type: 'boolean', cat: 'o', alias: 'w', description: localize('wait', "Wait for the files to be closed before returning.") },
|
||||
'waitMarkerFilePath': { type: 'string' },
|
||||
'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") },
|
||||
@@ -57,7 +55,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },
|
||||
'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") },
|
||||
'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") },
|
||||
'install-extension': { type: 'string[]', cat: 'e', args: 'extension-id[@version] | path-to-vsix', description: localize('installExtension', "Installs or updates the extension. Use `--force` argument to avoid prompts. The identifier of an extension is always `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.") },
|
||||
'install-extension': { type: 'string[]', cat: 'e', args: 'extension-id[@version] | path-to-vsix', description: localize('installExtension', "Installs or updates the extension. The identifier of an extension is always `${publisher}.${name}`. Use `--force` argument to update to latest version. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.") },
|
||||
'uninstall-extension': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('uninstallExtension', "Uninstalls an extension.") },
|
||||
'enable-proposed-api': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('experimentalApis', "Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.") },
|
||||
|
||||
@@ -79,10 +77,14 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },
|
||||
|
||||
'remote': { type: 'string' },
|
||||
'folder-uri': { type: 'string[]', cat: 'o', args: 'uri' },
|
||||
'file-uri': { type: 'string[]', cat: 'o', args: 'uri' },
|
||||
|
||||
'locate-extension': { type: 'string[]' },
|
||||
'extensionDevelopmentPath': { type: 'string[]' },
|
||||
'extensionTestsPath': { type: 'string' },
|
||||
'debugId': { type: 'string' },
|
||||
'debugRenderer': { type: 'boolean' },
|
||||
'inspect-search': { type: 'string', deprecates: 'debugSearch' },
|
||||
'inspect-brk-search': { type: 'string', deprecates: 'debugBrkSearch' },
|
||||
'export-default-configuration': { type: 'string' },
|
||||
@@ -90,27 +92,28 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'driver': { type: 'string' },
|
||||
'logExtensionHostCommunication': { type: 'boolean' },
|
||||
'skip-release-notes': { type: 'boolean' },
|
||||
'disable-restore-windows': { type: 'boolean' },
|
||||
'disable-telemetry': { type: 'boolean' },
|
||||
'disable-updates': { type: 'boolean' },
|
||||
'disable-crash-reporter': { type: 'boolean' },
|
||||
'crash-reporter-directory': { type: 'string' },
|
||||
'crash-reporter-id': { type: 'string' },
|
||||
'disable-user-env-probe': { type: 'boolean' },
|
||||
'skip-add-to-recently-opened': { type: 'boolean' },
|
||||
'unity-launch': { type: 'boolean' },
|
||||
'open-url': { type: 'boolean' },
|
||||
'file-write': { type: 'boolean' },
|
||||
'file-chmod': { type: 'boolean' },
|
||||
'driver-verbose': { type: 'boolean' },
|
||||
'install-builtin-extension': { type: 'string[]' },
|
||||
'force': { type: 'boolean' },
|
||||
'do-not-sync': { type: 'boolean' },
|
||||
'trace': { type: 'boolean' },
|
||||
'trace-category-filter': { type: 'string' },
|
||||
'trace-options': { type: 'string' },
|
||||
'force-user-env': { type: 'boolean' },
|
||||
'force-disable-user-env': { type: 'boolean' },
|
||||
'open-devtools': { type: 'boolean' },
|
||||
'__sandbox': { type: 'boolean' },
|
||||
'logsPath': { type: 'string' },
|
||||
|
||||
// {{SQL CARBON EDIT}} Start
|
||||
'command': { type: 'string', alias: 'c', cat: 'o', args: 'command-name', description: localize('commandParameter', 'Name of command to run') },
|
||||
@@ -182,8 +185,8 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
|
||||
const cleanedArgs: any = {};
|
||||
const remainingArgs: any = parsedArgs;
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/58177
|
||||
cleanedArgs._ = parsedArgs._.filter(arg => String(arg).length > 0);
|
||||
// https://github.com/microsoft/vscode/issues/58177, https://github.com/microsoft/vscode/issues/106617
|
||||
cleanedArgs._ = parsedArgs._.map(arg => String(arg)).filter(arg => arg.length > 0);
|
||||
|
||||
delete remainingArgs._;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
}
|
||||
|
||||
// If called from CLI, don't report warnings as they are already reported.
|
||||
let reportWarnings = !process.env['VSCODE_CLI'];
|
||||
const reportWarnings = !isLaunchedFromCli(process.env);
|
||||
return parseAndValidate(args, reportWarnings);
|
||||
}
|
||||
|
||||
@@ -60,11 +60,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
* Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait`
|
||||
*/
|
||||
export function parseCLIProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
let [, , ...args] = processArgv;
|
||||
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
args = stripAppPath(args) || [];
|
||||
}
|
||||
const [, , ...args] = processArgv; // remove the first non-option argument: it's always the app location
|
||||
|
||||
return parseAndValidate(args, true);
|
||||
}
|
||||
@@ -82,3 +78,7 @@ export function addArg(argv: string[], ...args: string[]): string[] {
|
||||
|
||||
return argv;
|
||||
}
|
||||
|
||||
export function isLaunchedFromCli(env: NodeJS.ProcessEnv): boolean {
|
||||
return env['VSCODE_CLI'] === '1';
|
||||
}
|
||||
|
||||
@@ -3,28 +3,27 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as os from 'os';
|
||||
import { IDebugParams, IExtensionHostDebugParams, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import * as crypto from 'crypto';
|
||||
import * as paths from 'vs/base/node/paths';
|
||||
import * as os from 'os';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { isWindows, Platform, platform } from 'vs/base/common/platform';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createStaticIPCHandle } from 'vs/base/parts/ipc/node/ipc.net';
|
||||
|
||||
export class EnvironmentService implements INativeEnvironmentService {
|
||||
export class NativeEnvironmentService implements INativeEnvironmentService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
get args(): NativeParsedArgs { return this._args; }
|
||||
|
||||
@memoize
|
||||
get appRoot(): string { return path.dirname(getPathFromAmdModule(require, '')); }
|
||||
get appRoot(): string { return path.dirname(FileAccess.asFileUri('', require).fsPath); }
|
||||
|
||||
readonly logsPath: string;
|
||||
|
||||
@@ -44,6 +43,9 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
@memoize
|
||||
get appSettingsHome(): URI { return URI.file(path.join(this.userDataPath, 'User')); }
|
||||
|
||||
@memoize
|
||||
get tmpDir(): URI { return URI.file(os.tmpdir()); }
|
||||
|
||||
@memoize
|
||||
get userRoamingDataHome(): URI { return this.appSettingsHome; }
|
||||
|
||||
@@ -59,9 +61,6 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
@memoize
|
||||
get sync(): 'on' | 'off' | undefined { return this.args.sync; }
|
||||
|
||||
@memoize
|
||||
get enableSyncByDefault(): boolean { return false; }
|
||||
|
||||
@memoize
|
||||
get machineSettingsResource(): URI { return resources.joinPath(URI.file(path.join(this.userDataPath, 'Machine')), 'settings.json'); }
|
||||
|
||||
@@ -93,12 +92,6 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
@memoize
|
||||
get isExtensionDevelopment(): boolean { return !!this._args.extensionDevelopmentPath; }
|
||||
|
||||
@memoize
|
||||
get backupHome(): string { return path.join(this.userDataPath, 'Backups'); }
|
||||
|
||||
@memoize
|
||||
get backupWorkspacesPath(): string { return path.join(this.backupHome, 'workspaces.json'); }
|
||||
|
||||
@memoize
|
||||
get untitledWorkspacesHome(): URI { return URI.file(path.join(this.userDataPath, 'Workspaces')); }
|
||||
|
||||
@@ -111,7 +104,7 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
if (fromArgs) {
|
||||
return fromArgs;
|
||||
} else {
|
||||
return path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions'));
|
||||
return path.normalize(path.join(FileAccess.asFileUri('', require).fsPath, '..', 'extensions'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,38 +182,31 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
|
||||
@memoize
|
||||
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
|
||||
get debugRenderer(): boolean { return !!this._args.debugRenderer; }
|
||||
|
||||
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
||||
get verbose(): boolean { return !!this._args.verbose; }
|
||||
get logLevel(): string | undefined { return this._args.log; }
|
||||
|
||||
@memoize
|
||||
get mainIPCHandle(): string { return getIPCHandle(this.userDataPath, 'main'); }
|
||||
|
||||
@memoize
|
||||
get sharedIPCHandle(): string { return getIPCHandle(this.userDataPath, 'shared'); }
|
||||
|
||||
@memoize
|
||||
get nodeCachedDataDir(): string | undefined { return process.env['VSCODE_NODE_CACHED_DATA_DIR'] || undefined; }
|
||||
get sharedIPCHandle(): string { return createStaticIPCHandle(this.userDataPath, 'shared', product.version); }
|
||||
|
||||
@memoize
|
||||
get serviceMachineIdResource(): URI { return resources.joinPath(URI.file(this.userDataPath), 'machineid'); }
|
||||
|
||||
get disableUpdates(): boolean { return !!this._args['disable-updates']; }
|
||||
get crashReporterId(): string | undefined { return this._args['crash-reporter-id']; }
|
||||
get crashReporterDirectory(): string | undefined { return this._args['crash-reporter-directory']; }
|
||||
|
||||
get driverHandle(): string | undefined { return this._args['driver']; }
|
||||
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
|
||||
|
||||
@memoize
|
||||
get telemetryLogResource(): URI { return URI.file(path.join(this.logsPath, 'telemetry.log')); }
|
||||
get disableTelemetry(): boolean { return !!this._args['disable-telemetry']; }
|
||||
|
||||
get sandbox(): boolean { return !!this._args['__sandbox']; }
|
||||
|
||||
constructor(private _args: NativeParsedArgs) {
|
||||
if (!process.env['VSCODE_LOGS']) {
|
||||
constructor(protected _args: NativeParsedArgs) {
|
||||
if (!_args.logsPath) {
|
||||
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
|
||||
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
|
||||
_args.logsPath = path.join(this.userDataPath, 'logs', key);
|
||||
}
|
||||
// {{SQL CARBON EDIT}} Note we keep the VSCODE_LOGS var above in case merges come in that use that so we don't
|
||||
// break functionality. ADS code should always use ADS_LOGS when referring to the log path
|
||||
@@ -233,51 +219,6 @@ export class EnvironmentService implements INativeEnvironmentService {
|
||||
}
|
||||
}
|
||||
|
||||
// Read this before there's any chance it is overwritten
|
||||
// Related to https://github.com/Microsoft/vscode/issues/30624
|
||||
export const xdgRuntimeDir = process.env['XDG_RUNTIME_DIR'];
|
||||
|
||||
const safeIpcPathLengths: { [platform: number]: number } = {
|
||||
[Platform.Linux]: 107,
|
||||
[Platform.Mac]: 103
|
||||
};
|
||||
|
||||
function getNixIPCHandle(userDataPath: string, type: string): string {
|
||||
const vscodePortable = process.env['VSCODE_PORTABLE'];
|
||||
|
||||
let result: string;
|
||||
if (xdgRuntimeDir && !vscodePortable) {
|
||||
const scope = crypto.createHash('md5').update(userDataPath).digest('hex').substr(0, 8);
|
||||
result = path.join(xdgRuntimeDir, `vscode-${scope}-${product.version}-${type}.sock`);
|
||||
} else {
|
||||
result = path.join(userDataPath, `${product.version}-${type}.sock`);
|
||||
}
|
||||
|
||||
const limit = safeIpcPathLengths[platform];
|
||||
if (typeof limit === 'number') {
|
||||
if (result.length >= limit) {
|
||||
// https://nodejs.org/api/net.html#net_identifying_paths_for_ipc_connections
|
||||
console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} chars, try a shorter --user-data-dir`);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getWin32IPCHandle(userDataPath: string, type: string): string {
|
||||
const scope = crypto.createHash('md5').update(userDataPath).digest('hex');
|
||||
|
||||
return `\\\\.\\pipe\\${scope}-${product.version}-${type}-sock`;
|
||||
}
|
||||
|
||||
function getIPCHandle(userDataPath: string, type: string): string {
|
||||
if (isWindows) {
|
||||
return getWin32IPCHandle(userDataPath, type);
|
||||
}
|
||||
|
||||
return getNixIPCHandle(userDataPath, type);
|
||||
}
|
||||
|
||||
export function parseExtensionHostPort(args: NativeParsedArgs, isBuild: boolean): IExtensionHostDebugParams {
|
||||
return parseDebugPort(args['inspect-extensions'], args['inspect-brk-extensions'], 5870, isBuild, args.debugId);
|
||||
}
|
||||
@@ -311,5 +252,5 @@ export function parsePathArg(arg: string | undefined, process: NodeJS.Process):
|
||||
}
|
||||
|
||||
export function parseUserDataDir(args: NativeParsedArgs, process: NodeJS.Process): string {
|
||||
return parsePathArg(args['user-data-dir'], process) || path.resolve(paths.getDefaultUserDataPath(process.platform));
|
||||
return parsePathArg(args['user-data-dir'], process) || path.resolve(paths.getDefaultUserDataPath());
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ export function hasStdinWithoutTty() {
|
||||
}
|
||||
|
||||
export function stdinDataListener(durationinMs: number): Promise<boolean> {
|
||||
return new Promise(c => {
|
||||
const dataListener = () => c(true);
|
||||
return new Promise(resolve => {
|
||||
const dataListener = () => resolve(true);
|
||||
|
||||
// wait for 1s maximum...
|
||||
setTimeout(() => {
|
||||
process.stdin.removeListener('data', dataListener);
|
||||
|
||||
c(false);
|
||||
resolve(false);
|
||||
}, durationinMs);
|
||||
|
||||
// ...but finish early if we detect data
|
||||
|
||||
Reference in New Issue
Block a user