Skip to content

Commit

Permalink
debug repl uses ReplEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Sep 1, 2016
1 parent ff89cc1 commit 49ab742
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
33 changes: 29 additions & 4 deletions src/vs/workbench/parts/debug/electron-browser/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ import treeimpl = require('vs/base/parts/tree/browser/treeImpl');
import {IEditorOptions, IReadOnlyModel, EditorContextKeys, ICommonCodeEditor} from 'vs/editor/common/editorCommon';
import {Position} from 'vs/editor/common/core/position';
import * as modes from 'vs/editor/common/modes';
import {editorAction, ServicesAccessor, EditorAction} from 'vs/editor/common/editorCommonExtensions';
import {editorAction, ServicesAccessor, EditorAction, CommonEditorRegistry} from 'vs/editor/common/editorCommonExtensions';
import {IModelService} from 'vs/editor/common/services/modelService';
import {CodeEditor} from 'vs/editor/browser/codeEditor';
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
import {IEditorContributionDescriptor} from 'vs/editor/browser/editorBrowser';
import {CodeEditorWidget} from 'vs/editor/browser/widget/codeEditorWidget';
import {EditorBrowserRegistry} from 'vs/editor/browser/editorBrowserExtensions';
import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection';
import {IContextKeyService} from 'vs/platform/contextkey/common/contextkey';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IContextViewService, IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService, createDecorator} from 'vs/platform/instantiation/common/instantiation';
import {ICommandService} from 'vs/platform/commands/common/commands';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IStorageService, StorageScope} from 'vs/platform/storage/common/storage';
import viewer = require('vs/workbench/parts/debug/electron-browser/replViewer');
Expand Down Expand Up @@ -58,6 +62,27 @@ export interface IPrivateReplService {
acceptReplInput(): void;
}

class ReplEditor extends CodeEditorWidget {
constructor(
domElement:HTMLElement,
options:IEditorOptions,
@IInstantiationService instantiationService: IInstantiationService,
@ICodeEditorService codeEditorService: ICodeEditorService,
@ICommandService commandService: ICommandService,
@IContextKeyService contextKeyService: IContextKeyService
) {
super(domElement, options, instantiationService, codeEditorService, commandService, contextKeyService);
}

protected _getContributions(): IEditorContributionDescriptor[] {
return [].concat(EditorBrowserRegistry.getEditorContributions()).concat(CommonEditorRegistry.getEditorContributions());
}

protected _getActions(): EditorAction[] {
return CommonEditorRegistry.getEditorActions();
}
}

export class Repl extends Panel implements IPrivateReplService {
public _serviceBrand: any;

Expand All @@ -71,7 +96,7 @@ export class Repl extends Panel implements IPrivateReplService {
private renderer: viewer.ReplExpressionsRenderer;
private characterWidthSurveyor: HTMLElement;
private treeContainer: HTMLElement;
private replInput: CodeEditor;
private replInput: ReplEditor;
private replInputContainer: HTMLElement;
private refreshTimeoutHandle: number;
private actions: actions.IAction[];
Expand Down Expand Up @@ -154,7 +179,7 @@ export class Repl extends Panel implements IPrivateReplService {

const scopedInstantiationService = this.instantiationService.createChild(new ServiceCollection(
[IContextKeyService, scopedContextKeyService], [IPrivateReplService, this]));
this.replInput = scopedInstantiationService.createInstance(CodeEditor, this.replInputContainer, this.getReplInputOptions());
this.replInput = scopedInstantiationService.createInstance(ReplEditor, this.replInputContainer, this.getReplInputOptions());
const model = this.modelService.createModel('', null, uri.parse(`${debug.DEBUG_SCHEME}:input`));
this.replInput.setModel(model);

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/debug/electron-browser/replViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import mouse = require('vs/base/browser/mouseEvent');
import tree = require('vs/base/parts/tree/browser/tree');
import renderer = require('vs/base/parts/tree/browser/actionsRenderer');
import treedefaults = require('vs/base/parts/tree/browser/treeDefaults');
import {CodeEditor} from 'vs/editor/browser/codeEditor';
import {ICodeEditor} from 'vs/editor/browser/editorBrowser';
import debug = require('vs/workbench/parts/debug/common/debug');
import model = require('vs/workbench/parts/debug/common/debugModel');
import debugviewer = require('vs/workbench/parts/debug/electron-browser/debugViewer');
Expand Down Expand Up @@ -487,7 +487,7 @@ export class ReplExpressionsController extends debugviewer.BaseDebugController {
debugService: debug.IDebugService,
contextMenuService: IContextMenuService,
actionProvider: renderer.IActionProvider,
private replInput: CodeEditor,
private replInput: ICodeEditor,
focusOnContextMenu = true
) {
super(debugService, contextMenuService, actionProvider, focusOnContextMenu);
Expand Down

0 comments on commit 49ab742

Please sign in to comment.