Merge remote-tracking branch 'origin/main' into tyriar/shell_resolve_refactor
This commit is contained in:
commit
a76a1efe04
9 changed files with 75 additions and 17 deletions
|
@ -15,6 +15,13 @@ export interface ResolvedAuthority {
|
|||
readonly connectionToken: string | undefined;
|
||||
}
|
||||
|
||||
export enum RemoteTrustOption {
|
||||
Unknown = 0,
|
||||
DisableTrust = 1,
|
||||
MachineTrusted = 2,
|
||||
MachineUntrusted = 3
|
||||
}
|
||||
|
||||
export interface ResolvedOptions {
|
||||
readonly extensionHostEnv?: { [key: string]: string | null };
|
||||
}
|
||||
|
|
9
src/vs/vscode.proposed.d.ts
vendored
9
src/vs/vscode.proposed.d.ts
vendored
|
@ -80,8 +80,17 @@ declare module 'vscode' {
|
|||
constructor(host: string, port: number, connectionToken?: string);
|
||||
}
|
||||
|
||||
export enum RemoteTrustOption {
|
||||
Unknown = 0,
|
||||
DisableTrust = 1,
|
||||
MachineTrusted = 2,
|
||||
MachineUntrusted = 3
|
||||
}
|
||||
|
||||
export interface ResolvedOptions {
|
||||
extensionHostEnv?: { [key: string]: string | null; };
|
||||
|
||||
trust?: RemoteTrustOption;
|
||||
}
|
||||
|
||||
export interface TunnelOptions {
|
||||
|
|
|
@ -85,6 +85,7 @@ import { IExtHostSecretState } from 'vs/workbench/api/common/exHostSecretState';
|
|||
import { ExtHostEditorTabs } from 'vs/workbench/api/common/extHostEditorTabs';
|
||||
import { IExtHostTelemetry } from 'vs/workbench/api/common/extHostTelemetry';
|
||||
import { ExtHostNotebookKernels } from 'vs/workbench/api/common/extHostNotebookKernels';
|
||||
import { RemoteTrustOption } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
|
||||
|
@ -1240,6 +1241,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
InlineHint: extHostTypes.InlineHint,
|
||||
InlineHintKind: extHostTypes.InlineHintKind,
|
||||
RemoteAuthorityResolverError: extHostTypes.RemoteAuthorityResolverError,
|
||||
RemoteTrustOption: RemoteTrustOption,
|
||||
ResolvedAuthority: extHostTypes.ResolvedAuthority,
|
||||
SourceControlInputBoxValidationType: extHostTypes.SourceControlInputBoxValidationType,
|
||||
ExtensionRuntime: extHostTypes.ExtensionRuntime,
|
||||
|
|
|
@ -270,7 +270,7 @@ export class ActivityActionViewItem extends BaseActionViewItem {
|
|||
this.container.removeAttribute('title');
|
||||
this._register(domEvent(container, EventType.MOUSE_OVER, true)(() => {
|
||||
if (!this.showHoverScheduler.isScheduled()) {
|
||||
this.showHoverScheduler.schedule(this.options.hoverOptions!.delay());
|
||||
this.showHoverScheduler.schedule(this.options.hoverOptions!.delay() || 150);
|
||||
}
|
||||
}));
|
||||
this._register(domEvent(container, EventType.MOUSE_LEAVE, true)(() => {
|
||||
|
|
|
@ -922,6 +922,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
});
|
||||
}
|
||||
|
||||
// runTaskPromise is used for queueing calls to run so that we don't end up with the same task runnin
|
||||
private runTaskPromise: Promise<ITaskSummary | undefined> = Promise.resolve(undefined);
|
||||
public async run(task: Task | undefined, options?: ProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
|
||||
if (!(await this.trust())) {
|
||||
return;
|
||||
|
@ -931,7 +933,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
throw new TaskError(Severity.Info, nls.localize('TaskServer.noTask', 'Task to execute is undefined'), TaskErrors.TaskNotFound);
|
||||
}
|
||||
|
||||
return new Promise<ITaskSummary | undefined>(async (resolve) => {
|
||||
return this.runTaskPromise = this.runTaskPromise.then(() => new Promise<ITaskSummary | undefined>(async (resolve) => {
|
||||
let resolver = this.createResolver();
|
||||
if (options && options.attachProblemMatcher && this.shouldAttachProblemMatcher(task) && !InMemoryTask.is(task)) {
|
||||
const toExecute = await this.attachProblemMatcher(task);
|
||||
|
@ -953,7 +955,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
}, (error) => {
|
||||
this.handleError(error);
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private isProvideTasksEnabled(): boolean {
|
||||
|
|
|
@ -15,7 +15,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
|||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { GettingStartedService, IGettingStartedService } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedService';
|
||||
import { IGettingStartedService } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedService';
|
||||
import { GettingStartedInput } from 'vs/workbench/contrib/welcome/gettingStarted/browser/gettingStartedInput';
|
||||
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
|
@ -167,9 +167,9 @@ registerAction2(class extends Action2 {
|
|||
|
||||
class WorkbenchConfigurationContribution {
|
||||
constructor(
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IInstantiationService _instantiationService: IInstantiationService,
|
||||
@IGettingStartedService _gettingStartedService: IGettingStartedService,
|
||||
) {
|
||||
instantiationService.createInstance(GettingStartedService);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -800,13 +800,25 @@ export class SimpleFileDialog {
|
|||
|
||||
private async updateItems(newFolder: URI, force: boolean = false, trailing?: string) {
|
||||
this.busy = true;
|
||||
this.userEnteredPathSegment = trailing ? trailing : '';
|
||||
this.autoCompletePathSegment = '';
|
||||
const newValue = trailing ? this.pathAppend(newFolder, trailing) : this.pathFromUri(newFolder, true);
|
||||
this.currentFolder = resources.addTrailingPathSeparator(newFolder, this.separator);
|
||||
|
||||
const updatingPromise = createCancelablePromise(async token => {
|
||||
return this.createItems(this.currentFolder, token).then(items => {
|
||||
let folderStat: IFileStat | undefined;
|
||||
try {
|
||||
folderStat = await this.fileService.resolve(newFolder);
|
||||
if (!folderStat.isDirectory) {
|
||||
trailing = resources.basename(newFolder);
|
||||
newFolder = resources.dirname(newFolder);
|
||||
folderStat = undefined;
|
||||
}
|
||||
} catch (e) {
|
||||
// The file/directory doesn't exist
|
||||
}
|
||||
const newValue = trailing ? this.pathAppend(newFolder, trailing) : this.pathFromUri(newFolder, true);
|
||||
this.currentFolder = resources.addTrailingPathSeparator(newFolder, this.separator);
|
||||
this.userEnteredPathSegment = trailing ? trailing : '';
|
||||
|
||||
return this.createItems(folderStat, this.currentFolder, token).then(items => {
|
||||
if (token.isCancellationRequested) {
|
||||
this.busy = false;
|
||||
return;
|
||||
|
@ -814,10 +826,9 @@ export class SimpleFileDialog {
|
|||
|
||||
this.filePickBox.items = items;
|
||||
this.filePickBox.activeItems = [<FileQuickPickItem>this.filePickBox.items[0]];
|
||||
if (this.allowFolderSelection) {
|
||||
this.filePickBox.activeItems = [];
|
||||
}
|
||||
// the user might have continued typing while we were updating. Only update the input box if it doesn't matche directory.
|
||||
this.filePickBox.activeItems = [];
|
||||
|
||||
// the user might have continued typing while we were updating. Only update the input box if it doesn't match the directory.
|
||||
if (!equalsIgnoreCase(this.filePickBox.value, newValue) && force) {
|
||||
this.filePickBox.valueSelection = [0, this.filePickBox.value.length];
|
||||
this.insertText(newValue, newValue);
|
||||
|
@ -893,12 +904,14 @@ export class SimpleFileDialog {
|
|||
return null;
|
||||
}
|
||||
|
||||
private async createItems(currentFolder: URI, token: CancellationToken): Promise<FileQuickPickItem[]> {
|
||||
private async createItems(folder: IFileStat | undefined, currentFolder: URI, token: CancellationToken): Promise<FileQuickPickItem[]> {
|
||||
const result: FileQuickPickItem[] = [];
|
||||
|
||||
const backDir = this.createBackItem(currentFolder);
|
||||
try {
|
||||
const folder = await this.fileService.resolve(currentFolder);
|
||||
if (!folder) {
|
||||
folder = await this.fileService.resolve(currentFolder);
|
||||
}
|
||||
const items = folder.children ? await Promise.all(folder.children.map(child => this.createItem(child, currentFolder, token))) : [];
|
||||
for (let item of items) {
|
||||
if (item) {
|
||||
|
|
|
@ -71,7 +71,7 @@ export class ExtensionHostManager extends Disposable {
|
|||
return { value: this._createExtensionHostCustomers(protocol) };
|
||||
},
|
||||
(err) => {
|
||||
console.error('Error received from starting extension host');
|
||||
console.error(`Error received from starting extension host (kind: ${this.kind})`);
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@ import { Schemas } from 'vs/base/common/network';
|
|||
import { ExtensionHostExitCode } from 'vs/workbench/services/extensions/common/extensionHostProtocol';
|
||||
import { updateProxyConfigurationsScope } from 'vs/platform/request/common/request';
|
||||
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
|
||||
const MACHINE_PROMPT = false;
|
||||
|
||||
export class ExtensionService extends AbstractExtensionService implements IExtensionService {
|
||||
|
||||
|
@ -69,6 +72,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
|||
@IRemoteExplorerService private readonly _remoteExplorerService: IRemoteExplorerService,
|
||||
@IExtensionGalleryService private readonly _extensionGalleryService: IExtensionGalleryService,
|
||||
@ILogService private readonly _logService: ILogService,
|
||||
@IDialogService private readonly _dialogService: IDialogService,
|
||||
) {
|
||||
super(
|
||||
new ExtensionRunningLocationClassifier(
|
||||
|
@ -358,6 +362,27 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
|||
return;
|
||||
}
|
||||
|
||||
if (MACHINE_PROMPT) {
|
||||
const dialogResult = await this._dialogService.show(
|
||||
Severity.Warning,
|
||||
nls.localize('machineTrustQuestion', "Do you trust the machine you're connecting to?"),
|
||||
[nls.localize('yes', "Yes, connect."), nls.localize('no', "No, disconnect.")],
|
||||
{
|
||||
cancelId: 1,
|
||||
useCustom: true,
|
||||
// checkbox: { label: nls.localize('remember', "Remember my choice"), checked: true }
|
||||
}
|
||||
);
|
||||
|
||||
if (dialogResult.choice !== 0) {
|
||||
// Did not confirm trust
|
||||
this._notificationService.notify({ severity: Severity.Warning, message: nls.localize('trustFailure', "Refused to connect to untrusted machine.") });
|
||||
// Proceed with the local extension host
|
||||
await this._startLocalExtensionHost(localExtensions);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set the resolved authority
|
||||
this._remoteAuthorityResolverService._setResolvedAuthority(resolverResult.authority, resolverResult.options);
|
||||
this._remoteExplorerService.setTunnelInformation(resolverResult.tunnelInformation);
|
||||
|
|
Loading…
Reference in a new issue