mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Merge from vscode 05fc61ffb1aee9fd19173c32113daed079f9b7bd (#5074)
* Merge from vscode 05fc61ffb1aee9fd19173c32113daed079f9b7bd * fix tests
This commit is contained in:
@@ -814,6 +814,7 @@ export function createApiFactory(
|
||||
Range: extHostTypes.Range,
|
||||
RelativePattern: extHostTypes.RelativePattern,
|
||||
ResolvedAuthority: extHostTypes.ResolvedAuthority,
|
||||
RemoteAuthorityResolverError: extHostTypes.RemoteAuthorityResolverError,
|
||||
Selection: extHostTypes.Selection,
|
||||
SelectionRange: extHostTypes.SelectionRange,
|
||||
ShellExecution: extHostTypes.ShellExecution,
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface StatusPipeArgs {
|
||||
export interface RunCommandPipeArgs {
|
||||
type: 'command';
|
||||
command: string;
|
||||
args: string[];
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export class CLIServer {
|
||||
@@ -99,7 +99,9 @@ export class CLIServer {
|
||||
for (const s of folderURIs) {
|
||||
try {
|
||||
urisToOpen.push({ folderUri: URI.parse(s) });
|
||||
forceNewWindow = true;
|
||||
if (!addMode && !forceReuseWindow) {
|
||||
forceNewWindow = true;
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
@@ -110,7 +112,9 @@ export class CLIServer {
|
||||
try {
|
||||
if (hasWorkspaceFileExtension(s)) {
|
||||
urisToOpen.push({ workspaceUri: URI.parse(s) });
|
||||
forceNewWindow = true;
|
||||
if (!forceReuseWindow) {
|
||||
forceNewWindow = true;
|
||||
}
|
||||
} else {
|
||||
urisToOpen.push({ fileUri: URI.parse(s) });
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
// {{SQL CARBON EDIT}} - Remove createApiFactory initializeExtensionApi, and IExtensionApiFactory imports
|
||||
// import { createApiFactory, IExtensionApiFactory } from 'vs/workbench/api/node/extHost.api.impl';
|
||||
import { NodeModuleRequireInterceptor, VSCodeNodeModuleFactory, KeytarNodeModuleFactory, OpenNodeModuleFactory } from 'vs/workbench/api/node/extHostRequireInterceptor';
|
||||
import { ExtHostExtensionServiceShape, IEnvironment, IInitData, IMainContext, MainContext, MainThreadExtensionServiceShape, MainThreadTelemetryShape, MainThreadWorkspaceShape } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostExtensionServiceShape, IEnvironment, IInitData, IMainContext, MainContext, MainThreadExtensionServiceShape, MainThreadTelemetryShape, MainThreadWorkspaceShape, IResolveAuthorityResult } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { ExtHostConfiguration } from 'vs/workbench/api/common/extHostConfiguration';
|
||||
import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionContext, IExtensionModule, HostExtension } from 'vs/workbench/api/common/extHostExtensionActivator';
|
||||
import { ExtHostLogService } from 'vs/workbench/api/common/extHostLogService';
|
||||
@@ -27,7 +27,6 @@ import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/c
|
||||
import { connectProxyResolver } from 'vs/workbench/services/extensions/node/proxyResolver';
|
||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import * as vscode from 'vscode';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
@@ -37,6 +36,7 @@ import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
|
||||
import { ExtensionMemento } from 'vs/workbench/api/common/extHostMemento';
|
||||
import { ExtensionStoragePaths } from 'vs/workbench/api/node/extHostStoragePaths';
|
||||
import { RemoteAuthorityResolverError } from 'vs/workbench/api/common/extHostTypes';
|
||||
|
||||
interface ITestRunner {
|
||||
run(testsRoot: string, clb: (error: Error, failures?: number) => void): void;
|
||||
@@ -600,7 +600,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
|
||||
// -- called by main thread
|
||||
|
||||
public async $resolveAuthority(remoteAuthority: string): Promise<ResolvedAuthority> {
|
||||
public async $resolveAuthority(remoteAuthority: string, resolveAttempt: number): Promise<IResolveAuthorityResult> {
|
||||
const authorityPlusIndex = remoteAuthority.indexOf('+');
|
||||
if (authorityPlusIndex === -1) {
|
||||
throw new Error(`Not an authority that can be resolved!`);
|
||||
@@ -615,12 +615,29 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
throw new Error(`No resolver available for ${authorityPrefix}`);
|
||||
}
|
||||
|
||||
const result = await resolver.resolve(remoteAuthority);
|
||||
return {
|
||||
authority: remoteAuthority,
|
||||
host: result.host,
|
||||
port: result.port,
|
||||
};
|
||||
try {
|
||||
const result = await resolver.resolve(remoteAuthority, { resolveAttempt });
|
||||
return {
|
||||
type: 'ok',
|
||||
value: {
|
||||
authority: remoteAuthority,
|
||||
host: result.host,
|
||||
port: result.port,
|
||||
}
|
||||
};
|
||||
} catch (err) {
|
||||
if (err instanceof RemoteAuthorityResolverError) {
|
||||
return {
|
||||
type: 'error',
|
||||
error: {
|
||||
code: err._code,
|
||||
message: err._message,
|
||||
detail: err._detail
|
||||
}
|
||||
};
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
public $startExtensionHost(enabledExtensionIds: ExtensionIdentifier[]): Promise<void> {
|
||||
@@ -680,7 +697,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
let buff = VSBuffer.alloc(size);
|
||||
let value = Math.random() % 256;
|
||||
for (let i = 0; i < size; i++) {
|
||||
buff.writeUint8(value, i);
|
||||
buff.writeUInt8(value, i);
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
}
|
||||
}
|
||||
|
||||
public async $createProcess(id: number, shellLaunchConfigDto: ShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number): Promise<void> {
|
||||
public async $createProcess(id: number, shellLaunchConfigDto: ShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise<void> {
|
||||
const shellLaunchConfig: IShellLaunchConfig = {
|
||||
name: shellLaunchConfigDto.name,
|
||||
executable: shellLaunchConfigDto.executable,
|
||||
@@ -445,31 +445,31 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
env: shellLaunchConfigDto.env
|
||||
};
|
||||
|
||||
// TODO: This function duplicates a lot of TerminalProcessManager.createProcess, ideally
|
||||
// they would be merged into a single implementation.
|
||||
const configProvider = await this._extHostConfiguration.getConfigProvider();
|
||||
const terminalConfig = configProvider.getConfiguration('terminal.integrated');
|
||||
|
||||
// Merge in shell and args from settings
|
||||
const platformKey = platform.isWindows ? 'windows' : (platform.isMacintosh ? 'osx' : 'linux');
|
||||
if (!shellLaunchConfig.executable) {
|
||||
// TODO: This duplicates some of TerminalConfigHelper.mergeDefaultShellPathAndArgs and should be merged
|
||||
// this._configHelper.mergeDefaultShellPathAndArgs(shellLaunchConfig);
|
||||
|
||||
const platformKey = platform.isWindows ? 'windows' : platform.isMacintosh ? 'osx' : 'linux';
|
||||
const shellConfigValue: string | undefined = terminalConfig.get(`shell.${platformKey}`);
|
||||
const shellArgsConfigValue: string | undefined = terminalConfig.get(`shellArgs.${platformKey}`);
|
||||
|
||||
shellLaunchConfig.executable = shellConfigValue;
|
||||
shellLaunchConfig.args = shellArgsConfigValue;
|
||||
const fetchSetting = (key: string) => {
|
||||
const setting = configProvider
|
||||
.getConfiguration(key.substr(0, key.lastIndexOf('.')))
|
||||
.inspect<string | string[]>(key.substr(key.lastIndexOf('.') + 1));
|
||||
return {
|
||||
user: setting ? setting.globalValue : undefined,
|
||||
value: setting ? setting.workspaceValue : undefined,
|
||||
default: setting ? setting.defaultValue : undefined,
|
||||
};
|
||||
};
|
||||
terminalEnvironment.mergeDefaultShellPathAndArgs(shellLaunchConfig, fetchSetting, isWorkspaceShellAllowed || false);
|
||||
}
|
||||
|
||||
// TODO: @daniel
|
||||
// Get the initial cwd
|
||||
const configProvider = await this._extHostConfiguration.getConfigProvider();
|
||||
const terminalConfig = configProvider.getConfiguration('terminal.integrated');
|
||||
const activeWorkspaceRootUri = URI.revive(activeWorkspaceRootUriComponents);
|
||||
const initialCwd = terminalEnvironment.getCwd(shellLaunchConfig, os.homedir(), activeWorkspaceRootUri, terminalConfig.cwd);
|
||||
|
||||
// TODO: Pull in and resolve config settings
|
||||
// // Resolve env vars from config and shell
|
||||
// const lastActiveWorkspaceRoot = this._workspaceContextService.getWorkspaceFolder(lastActiveWorkspaceRootUri);
|
||||
const platformKey = platform.isWindows ? 'windows' : (platform.isMacintosh ? 'osx' : 'linux');
|
||||
// const envFromConfig = terminalEnvironment.resolveConfigurationVariables(this._configurationResolverService, { ...terminalConfig.env[platformKey] }, lastActiveWorkspaceRoot);
|
||||
const envFromConfig = { ...terminalConfig.env[platformKey] };
|
||||
// const envFromShell = terminalEnvironment.resolveConfigurationVariables(this._configurationResolverService, { ...shellLaunchConfig.env }, lastActiveWorkspaceRoot);
|
||||
@@ -501,7 +501,6 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
|
||||
this._terminalProcesses[id] = p;
|
||||
}
|
||||
|
||||
|
||||
public $acceptProcessInput(id: number, data: string): void {
|
||||
this._terminalProcesses[id].input(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user