提交 e8bdc1be 编写于 作者: I isidor

repl: destructure imports

上级 ac17ca87
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import 'vs/css!./../browser/media/repl'; import 'vs/css!./../browser/media/repl';
import nls = require('vs/nls'); import * as nls from 'vs/nls';
import uri from 'vs/base/common/uri'; import uri from 'vs/base/common/uri';
import { wireCancellationToken } from 'vs/base/common/async'; import { wireCancellationToken } from 'vs/base/common/async';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import errors = require('vs/base/common/errors'); import * as errors from 'vs/base/common/errors';
import lifecycle = require('vs/base/common/lifecycle'); import * as lifecycle from 'vs/base/common/lifecycle';
import actions = require('vs/base/common/actions'); import { IAction } from 'vs/base/common/actions';
import builder = require('vs/base/browser/builder'); import { Dimension, Builder } from 'vs/base/browser/builder';
import dom = require('vs/base/browser/dom'); import * as dom from 'vs/base/browser/dom';
import platform = require('vs/base/common/platform'); import { isMacintosh } from 'vs/base/common/platform';
import { CancellationToken } from 'vs/base/common/cancellation'; import { CancellationToken } from 'vs/base/common/cancellation';
import { KeyCode } from 'vs/base/common/keyCodes'; import { KeyCode } from 'vs/base/common/keyCodes';
import tree = require('vs/base/parts/tree/browser/tree'); import { ITree, ITreeOptions } from 'vs/base/parts/tree/browser/tree';
import treeimpl = require('vs/base/parts/tree/browser/treeImpl'); import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { Context as SuggestContext } from 'vs/editor/contrib/suggest/common/suggest'; import { Context as SuggestContext } from 'vs/editor/contrib/suggest/common/suggest';
import { SuggestController } from 'vs/editor/contrib/suggest/browser/suggestController'; import { SuggestController } from 'vs/editor/contrib/suggest/browser/suggestController';
import { IEditorOptions, IReadOnlyModel, EditorContextKeys, ICommonCodeEditor } from 'vs/editor/common/editorCommon'; import { IEditorOptions, IReadOnlyModel, EditorContextKeys, ICommonCodeEditor } from 'vs/editor/common/editorCommon';
...@@ -31,18 +31,18 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; ...@@ -31,18 +31,18 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import viewer = require('vs/workbench/parts/debug/electron-browser/replViewer'); import { ReplExpressionsRenderer, ReplExpressionsController, ReplExpressionsDataSource, ReplExpressionsActionProvider, ReplExpressionsAccessibilityProvider } from 'vs/workbench/parts/debug/electron-browser/replViewer';
import { ReplEditor } from 'vs/workbench/parts/debug/electron-browser/replEditor'; import { ReplEditor } from 'vs/workbench/parts/debug/electron-browser/replEditor';
import debug = require('vs/workbench/parts/debug/common/debug'); import * as debug from 'vs/workbench/parts/debug/common/debug';
import debugactions = require('vs/workbench/parts/debug/browser/debugActions'); import { ClearReplAction } from 'vs/workbench/parts/debug/browser/debugActions';
import replhistory = require('vs/workbench/parts/debug/common/replHistory'); import { ReplHistory } from 'vs/workbench/parts/debug/common/replHistory';
import { Panel } from 'vs/workbench/browser/panel'; import { Panel } from 'vs/workbench/browser/panel';
import { IThemeService } from 'vs/workbench/services/themes/common/themeService'; import { IThemeService } from 'vs/workbench/services/themes/common/themeService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
const $ = dom.$; const $ = dom.$;
const replTreeOptions: tree.ITreeOptions = { const replTreeOptions: ITreeOptions = {
twistiePixels: 20, twistiePixels: 20,
ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel") ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel")
}; };
...@@ -61,21 +61,21 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -61,21 +61,21 @@ export class Repl extends Panel implements IPrivateReplService {
private static HALF_WIDTH_TYPICAL = 'n'; private static HALF_WIDTH_TYPICAL = 'n';
private static HISTORY: replhistory.ReplHistory; private static HISTORY: ReplHistory;
private static REFRESH_DELAY = 500; // delay in ms to refresh the repl for new elements to show private static REFRESH_DELAY = 500; // delay in ms to refresh the repl for new elements to show
private static REPL_INPUT_INITIAL_HEIGHT = 19; private static REPL_INPUT_INITIAL_HEIGHT = 19;
private static REPL_INPUT_MAX_HEIGHT = 170; private static REPL_INPUT_MAX_HEIGHT = 170;
private toDispose: lifecycle.IDisposable[]; private toDispose: lifecycle.IDisposable[];
private tree: tree.ITree; private tree: ITree;
private renderer: viewer.ReplExpressionsRenderer; private renderer: ReplExpressionsRenderer;
private characterWidthSurveyor: HTMLElement; private characterWidthSurveyor: HTMLElement;
private treeContainer: HTMLElement; private treeContainer: HTMLElement;
private replInput: ReplEditor; private replInput: ReplEditor;
private replInputContainer: HTMLElement; private replInputContainer: HTMLElement;
private refreshTimeoutHandle: number; private refreshTimeoutHandle: number;
private actions: actions.IAction[]; private actions: IAction[];
private dimension: builder.Dimension; private dimension: Dimension;
private replInputHeight: number; private replInputHeight: number;
constructor( constructor(
...@@ -125,7 +125,7 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -125,7 +125,7 @@ export class Repl extends Panel implements IPrivateReplService {
} }
} }
public create(parent: builder.Builder): TPromise<void> { public create(parent: Builder): TPromise<void> {
super.create(parent); super.create(parent);
const container = dom.append(parent.getHTMLElement(), $('.repl')); const container = dom.append(parent.getHTMLElement(), $('.repl'));
this.treeContainer = dom.append(container, $('.repl-tree')); this.treeContainer = dom.append(container, $('.repl-tree'));
...@@ -136,18 +136,18 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -136,18 +136,18 @@ export class Repl extends Panel implements IPrivateReplService {
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
this.characterWidthSurveyor.textContent += this.characterWidthSurveyor.textContent; this.characterWidthSurveyor.textContent += this.characterWidthSurveyor.textContent;
} }
this.characterWidthSurveyor.style.fontSize = platform.isMacintosh ? '12px' : '14px'; this.characterWidthSurveyor.style.fontSize = isMacintosh ? '12px' : '14px';
this.renderer = this.instantiationService.createInstance(viewer.ReplExpressionsRenderer); this.renderer = this.instantiationService.createInstance(ReplExpressionsRenderer);
this.tree = new treeimpl.Tree(this.treeContainer, { this.tree = new Tree(this.treeContainer, {
dataSource: new viewer.ReplExpressionsDataSource(this.debugService), dataSource: new ReplExpressionsDataSource(this.debugService),
renderer: this.renderer, renderer: this.renderer,
accessibilityProvider: new viewer.ReplExpressionsAccessibilityProvider(), accessibilityProvider: new ReplExpressionsAccessibilityProvider(),
controller: new viewer.ReplExpressionsController(this.debugService, this.contextMenuService, new viewer.ReplExpressionsActionProvider(this.instantiationService), this.replInput, false) controller: new ReplExpressionsController(this.debugService, this.contextMenuService, new ReplExpressionsActionProvider(this.instantiationService), this.replInput, false)
}, replTreeOptions); }, replTreeOptions);
if (!Repl.HISTORY) { if (!Repl.HISTORY) {
Repl.HISTORY = new replhistory.ReplHistory(JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE, '[]'))); Repl.HISTORY = new ReplHistory(JSON.parse(this.storageService.get(HISTORY_STORAGE_KEY, StorageScope.WORKSPACE, '[]')));
} }
return this.tree.setInput(this.debugService.getModel()); return this.tree.setInput(this.debugService.getModel());
...@@ -221,7 +221,7 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -221,7 +221,7 @@ export class Repl extends Panel implements IPrivateReplService {
this.layout(this.dimension); this.layout(this.dimension);
} }
public layout(dimension: builder.Dimension): void { public layout(dimension: Dimension): void {
this.dimension = dimension; this.dimension = dimension;
if (this.tree) { if (this.tree) {
this.renderer.setWidth(dimension.width - 25, this.characterWidthSurveyor.clientWidth / this.characterWidthSurveyor.textContent.length); this.renderer.setWidth(dimension.width - 25, this.characterWidthSurveyor.clientWidth / this.characterWidthSurveyor.textContent.length);
...@@ -238,10 +238,10 @@ export class Repl extends Panel implements IPrivateReplService { ...@@ -238,10 +238,10 @@ export class Repl extends Panel implements IPrivateReplService {
this.replInput.focus(); this.replInput.focus();
} }
public getActions(): actions.IAction[] { public getActions(): IAction[] {
if (!this.actions) { if (!this.actions) {
this.actions = [ this.actions = [
this.instantiationService.createInstance(debugactions.ClearReplAction, debugactions.ClearReplAction.ID, debugactions.ClearReplAction.LABEL) this.instantiationService.createInstance(ClearReplAction, ClearReplAction.ID, ClearReplAction.LABEL)
]; ];
this.actions.forEach(a => { this.actions.forEach(a => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册