Merge from vscode 12cb89c82e88e035f4ab630f1b9fcebac338dc03 (#5125)

This commit is contained in:
Alan Ren
2019-04-19 10:26:20 -07:00
committed by GitHub
parent f248260584
commit 0e168e36fc
17 changed files with 111 additions and 49 deletions

View File

@@ -34,6 +34,7 @@ import { IEditorInput, IEditor } from 'vs/workbench/common/editor';
import { ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { KeyChord, KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Registry } from 'vs/platform/registry/common/platform';
import { IProgressService2, ProgressLocation } from 'vs/platform/progress/common/progress';
export class ExplorerViewletViewsContribution extends Disposable implements IWorkbenchContribution {
@@ -42,18 +43,21 @@ export class ExplorerViewletViewsContribution extends Disposable implements IWor
constructor(
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IProgressService2 progressService: IProgressService2
) {
super();
this.registerViews();
progressService.withProgress({ location: ProgressLocation.Explorer }, () => workspaceContextService.getCompleteWorkspace()).finally(() => {
this.registerViews();
this.openEditorsVisibleContextKey = OpenEditorsVisibleContext.bindTo(contextKeyService);
this.updateOpenEditorsVisibility();
this.openEditorsVisibleContextKey = OpenEditorsVisibleContext.bindTo(contextKeyService);
this.updateOpenEditorsVisibility();
this._register(workspaceContextService.onDidChangeWorkbenchState(() => this.registerViews()));
this._register(workspaceContextService.onDidChangeWorkspaceFolders(() => this.registerViews()));
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
this._register(workspaceContextService.onDidChangeWorkbenchState(() => this.registerViews()));
this._register(workspaceContextService.onDidChangeWorkspaceFolders(() => this.registerViews()));
this._register(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(e)));
});
}
private registerViews(): void {

View File

@@ -137,12 +137,12 @@ export class SaveErrorHandler extends Disposable implements ISaveErrorHandler, I
const triedToMakeWriteable = isReadonly && fileOperationError.options && (fileOperationError.options as IWriteTextFileOptions).overwriteReadonly;
const isPermissionDenied = fileOperationError.fileOperationResult === FileOperationResult.FILE_PERMISSION_DENIED;
// Save Elevated (TODO@remote cannot write elevated https://github.com/Microsoft/vscode/issues/48659)
// Save Elevated (cannot write elevated https://github.com/Microsoft/vscode/issues/48659)
if (resource.scheme === Schemas.file && (isPermissionDenied || triedToMakeWriteable)) {
actions.primary!.push(this.instantiationService.createInstance(SaveElevatedAction, model, triedToMakeWriteable));
}
// Overwrite (TODO@remote cannot overwrite readonly https://github.com/Microsoft/vscode/issues/48659)
// Overwrite (cannot overwrite readonly https://github.com/Microsoft/vscode/issues/48659)
else if (resource.scheme === Schemas.file && isReadonly) {
actions.primary!.push(this.instantiationService.createInstance(OverwriteReadonlyAction, model));
}

View File

@@ -46,6 +46,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { findValidPasteFileTarget } from 'vs/workbench/contrib/files/browser/fileActions';
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
@@ -441,7 +442,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
@IInstantiationService private instantiationService: IInstantiationService,
@ITextFileService private textFileService: ITextFileService,
@IWindowService private windowService: IWindowService,
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
@IWorkbenchEnvironmentService private environmentService: IWorkbenchEnvironmentService
) {
this.toDispose = [];
@@ -472,6 +474,12 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
if (typesArray.indexOf(DataTransfers.FILES.toLowerCase()) === -1 && typesArray.indexOf(CodeDataTransfers.FILES.toLowerCase()) === -1) {
return false;
}
if (this.environmentService.configuration.remoteAuthority) {
const resources = extractResources(originalEvent, true);
if (resources.some(r => r.resource.authority !== this.environmentService.configuration.remoteAuthority)) {
return false;
}
}
}
// Other-Tree DND

View File

@@ -229,7 +229,7 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
public mergeDefaultShellPathAndArgs(shell: IShellLaunchConfig, platformOverride: platform.Platform = platform.platform): void {
const isWorkspaceShellAllowed = this.checkWorkspaceShellPermissions(platformOverride === platform.Platform.Windows ? platform.OperatingSystem.Windows : (platformOverride === platform.Platform.Mac ? platform.OperatingSystem.Macintosh : platform.OperatingSystem.Linux));
mergeDefaultShellPathAndArgs(shell, (key) => this._workspaceConfigurationService.inspect(key), isWorkspaceShellAllowed);
mergeDefaultShellPathAndArgs(shell, (key) => this._workspaceConfigurationService.inspect(key), isWorkspaceShellAllowed, platformOverride);
}
private _toInteger(source: any, minimum: number, maximum: number, fallback: number): number {