Merge branch 'master' into dbaeumer/TS2.0

This commit is contained in:
Dirk Baeumer
2016-09-23 11:52:24 +02:00
10 changed files with 269 additions and 52 deletions

View File

@@ -141,7 +141,7 @@ function openWorkbench(environment: IWindowConfiguration, workspace: IWorkspace,
shell.open();
shell.joinCreation().then(() => {
timer.start(timer.Topic.STARTUP, 'Open Shell, Viewconst & Editor', beforeOpen, 'Workbench has opened after this event with viewconst and editor restored').stop();
timer.start(timer.Topic.STARTUP, 'Open Shell, Viewlet & Editor', beforeOpen, 'Workbench has opened after this event with viewlet and editor restored').stop();
});
// Inform user about loading issues from the loader

View File

@@ -95,7 +95,7 @@ export class ExplorerViewlet extends Viewlet {
this.delayEditorOpeningInOpenedEditors = !!config.workbench.editor.enablePreview;
// Open editors view should always be visible in no folder workspace.
let openEditorsVisible = !this.contextService.getWorkspace() || config.explorer.openEditors.visible !== 0;
const openEditorsVisible = !this.contextService.getWorkspace() || config.explorer.openEditors.visible !== 0;
// Create views on startup and if open editors visibility has changed #6919
if (this.openEditorsVisible !== openEditorsVisible) {
@@ -178,7 +178,7 @@ export class ExplorerViewlet extends Viewlet {
const explorerInstantiator = this.instantiationService.createChild(new ServiceCollection([IWorkbenchEditorService, delegatingEditorService]));
const headerSize = this.openEditorsVisible ? undefined : 0; // If open editors are not visible set header size explicitly to 0, otherwise let it be computed by super class.
const headerSize = this.openEditorsVisible ? undefined : 0; // If open editors are not visible set header size explicitly to 0, otherwise const it be computed by super class.
this.explorerView = explorerView = explorerInstantiator.createInstance(ExplorerView, this.viewletState, this.getActionRunner(), this.viewletSettings, headerSize);
}
@@ -278,11 +278,12 @@ export class ExplorerViewlet extends Viewlet {
}
public getOptimalWidth(): number {
let additionalMargin = 16;
let openedEditorsViewWidth = this.openEditorsVisible ? this.openEditorsView.getOptimalWidth() : 0;
let explorerView = this.getExplorerView();
let explorerViewWidth = explorerView ? explorerView.getOptimalWidth() : 0;
let optimalWidth = Math.max(openedEditorsViewWidth, explorerViewWidth);
const additionalMargin = 16;
const openedEditorsViewWidth = this.openEditorsVisible ? this.openEditorsView.getOptimalWidth() : 0;
const explorerView = this.getExplorerView();
const explorerViewWidth = explorerView ? explorerView.getOptimalWidth() : 0;
const optimalWidth = Math.max(openedEditorsViewWidth, explorerViewWidth);
return optimalWidth + additionalMargin;
}

View File

@@ -31,16 +31,16 @@ class FilesViewerActionContributor extends ActionBarContributor {
}
public hasSecondaryActions(context: any): boolean {
let element = context.element;
const element = context.element;
// Contribute only on Stat Objects (File Explorer)
return element instanceof FileStat;
}
public getSecondaryActions(context: any): IAction[] {
let stat = (<FileStat>context.element);
let tree = context.viewer;
let actions: IAction[] = [];
const stat = (<FileStat>context.element);
const tree = context.viewer;
const actions: IAction[] = [];
let separateOpen = false;
// Open side by side
@@ -69,7 +69,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
else if (!stat.isDirectory) {
// Run Compare
let runCompareAction = this.instantiationService.createInstance(CompareResourcesAction, stat.resource, tree);
const runCompareAction = this.instantiationService.createInstance(CompareResourcesAction, stat.resource, tree);
if (runCompareAction._isEnabled()) {
actions.push(runCompareAction);
}
@@ -80,8 +80,8 @@ class FilesViewerActionContributor extends ActionBarContributor {
actions.push(new Separator(null, 100));
}
let workspace = this.contextService.getWorkspace();
let isRoot = workspace && stat.resource.toString() === workspace.resource.toString();
const workspace = this.contextService.getWorkspace();
const isRoot = workspace && stat.resource.toString() === workspace.resource.toString();
// Copy File/Folder
if (!isRoot) {
@@ -107,7 +107,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
// Set Order
let curOrder = 10;
for (let i = 0; i < actions.length; i++) {
let action = <any>actions[i];
const action = <any>actions[i];
if (!action.order) {
curOrder += 10;
action.order = curOrder;
@@ -123,7 +123,7 @@ class FilesViewerActionContributor extends ActionBarContributor {
if (context && context.element instanceof FileStat) {
// Any other item with keybinding
let keybinding = keybindingForAction(action.id);
const keybinding = keybindingForAction(action.id);
if (keybinding) {
return new ActionItem(context, action, { label: true, keybinding: this.keybindingService.getLabelFor(keybinding) });
}

View File

@@ -183,7 +183,7 @@ export class TriggerRenameFileAction extends BaseFileAction {
const viewletState = <IFileViewletState>context.viewletState;
if (!viewletState) {
return TPromise.wrapError('Invalid viewconst state provided to BaseEnableFileRenameAction.');
return TPromise.wrapError('Invalid viewlet state provided to BaseEnableFileRenameAction.');
}
const stat = <IFileStat>context.stat;
@@ -395,7 +395,7 @@ export class BaseNewAction extends BaseFileAction {
const viewletState = <IFileViewletState>context.viewletState;
if (!viewletState) {
return TPromise.wrapError('Invalid viewconst state provided to BaseNewAction.');
return TPromise.wrapError('Invalid viewlet state provided to BaseNewAction.');
}
let folder: FileStat = this.presetFolder;

View File

@@ -350,7 +350,7 @@ export class ExplorerView extends CollapsibleViewletView {
public getOptimalWidth(): number {
const parentNode = this.explorerViewer.getHTMLElement();
const childNodes = [].slice.call(parentNode.querySelectorAll('.explorer-item-label > a'));
const childNodes = [].slice.call(parentNode.querySelectorAll('.explorer-item > a'));
return DOM.getLargestChildWidth(parentNode, childNodes);
}

View File

@@ -265,7 +265,8 @@ export class OpenEditorsView extends AdaptiveCollapsibleViewletView {
public getOptimalWidth():number {
let parentNode = this.tree.getHTMLElement();
let childNodes = [].slice.call(parentNode.querySelectorAll('.monaco-file-label > .file-name'));
let childNodes = [].slice.call(parentNode.querySelectorAll('.open-editor > a'));
return dom.getLargestChildWidth(parentNode, childNodes);
}