diff --git a/src/vs/workbench/browser/parts/editor/stringEditor.ts b/src/vs/workbench/browser/parts/editor/stringEditor.ts index e4f58b14caa6570b01df8b1a45e850edff5ab0f5..8d1d7c0edd56d959c4973c6b46332e8a1fc28d93 100644 --- a/src/vs/workbench/browser/parts/editor/stringEditor.ts +++ b/src/vs/workbench/browser/parts/editor/stringEditor.ts @@ -13,7 +13,7 @@ import {DefaultConfig} from 'vs/editor/common/config/defaultConfig'; import {EditorConfiguration} from 'vs/editor/common/config/commonEditorConfig'; import {TextEditorOptions, EditorModel, EditorInput, EditorOptions} from 'vs/workbench/common/editor'; import {BaseTextEditorModel} from 'vs/workbench/common/editor/textEditorModel'; -import {LogEditorInput} from 'vs/workbench/browser/parts/editor/logEditorInput'; +import {LogEditorInput} from 'vs/workbench/common/editor/logEditorInput'; import {UntitledEditorInput} from 'vs/workbench/common/editor/untitledEditorInput'; import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor'; import {UntitledEditorEvent, EventType} from 'vs/workbench/common/events'; diff --git a/src/vs/workbench/browser/parts/editor/logEditorInput.ts b/src/vs/workbench/common/editor/logEditorInput.ts similarity index 85% rename from src/vs/workbench/browser/parts/editor/logEditorInput.ts rename to src/vs/workbench/common/editor/logEditorInput.ts index 5368b3d0eee2deb1d4031102ffc3c422aeea9c83..ca28644ae634a7cfe3055ee87fef3b4c23aa709b 100644 --- a/src/vs/workbench/browser/parts/editor/logEditorInput.ts +++ b/src/vs/workbench/common/editor/logEditorInput.ts @@ -4,9 +4,8 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import {ICodeEditor} from 'vs/editor/browser/editorBrowser'; +import {IEditor, ITextModel} from 'vs/editor/common/editorCommon'; import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput'; -import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; @@ -58,15 +57,17 @@ export class LogEditorInput extends StringEditorInput { return newValue; } - private revealLastLine(): void { + /** + * Reveals the last line on any editor that has this output set. + */ + public revealLastLine(): void { let editors = this.editorService.getVisibleEditors(); for (let i = 0; i < editors.length; i++) { let editor = editors[i]; - if (editor.input === this && editor instanceof BaseTextEditor) { - let textEditor = editor; - let editorControl = textEditor.getControl(); + if (editor.input === this) { + let editorControl = editor.getControl(); if (editorControl) { - let model = editorControl.getModel(); + let model = editorControl.getModel(); if (model) { let lastLine = model.getLineCount(); editorControl.revealLine(lastLine); diff --git a/src/vs/workbench/parts/output/browser/output.contribution.ts b/src/vs/workbench/parts/output/browser/output.contribution.ts index a092022b05213b789e578b12f025f6e73acbb383..b1e8d2fa53dda3cc1de3a8b1348866a448473df1 100644 --- a/src/vs/workbench/parts/output/browser/output.contribution.ts +++ b/src/vs/workbench/parts/output/browser/output.contribution.ts @@ -6,9 +6,9 @@ import {Registry} from 'vs/platform/platform'; import {registerMode} from 'vs/editor/common/modes/modesRegistry'; -import {OutputService} from 'vs/workbench/parts/output/browser/outputServices'; +import {OutputService} from 'vs/workbench/parts/output/common/outputServices'; import {OUTPUT_MIME, OUTPUT_MODE_ID, OUTPUT_EDITOR_INPUT_ID, IOutputService} from 'vs/workbench/parts/output/common/output'; -import {OutputEditorInput} from 'vs/workbench/parts/output/browser/outputEditorInput'; +import {OutputEditorInput} from 'vs/workbench/parts/output/common/outputEditorInput'; import {IEditorRegistry, Extensions, IEditorInputFactory} from 'vs/workbench/browser/parts/editor/baseEditor'; import {EditorInput} from 'vs/workbench/common/editor'; import {IInstantiationService, INullService} from 'vs/platform/instantiation/common/instantiation'; diff --git a/src/vs/workbench/parts/output/browser/outputActions.contribution.ts b/src/vs/workbench/parts/output/browser/outputActions.contribution.ts index 0094be3da90160193a041840e6d8d3a7608e47ae..1dc78de1dbbfa9d92fee40ab6d91f0c57e0b16b4 100644 --- a/src/vs/workbench/parts/output/browser/outputActions.contribution.ts +++ b/src/vs/workbench/parts/output/browser/outputActions.contribution.ts @@ -15,7 +15,7 @@ import {CommonEditorRegistry, EditorActionDescriptor} from 'vs/editor/common/edi import {Scope, IActionBarRegistry, Extensions as ActionBarExtensions} from 'vs/workbench/browser/actionBarRegistry'; import {Action} from 'vs/base/common/actions'; import {IEditorInputAction, IEditorInputActionContext, EditorInputActionContributor} from 'vs/workbench/browser/parts/editor/baseEditor'; -import {OutputEditorInput} from 'vs/workbench/parts/output/browser/outputEditorInput'; +import {OutputEditorInput} from 'vs/workbench/parts/output/common/outputEditorInput'; import {ClearOutputEditorAction, ToggleOutputAction, GlobalShowOutputAction, SwitchOutputActionItem, SwitchOutputAction, ClearOutputAction} from 'vs/workbench/parts/output/browser/outputActions'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; diff --git a/src/vs/workbench/parts/output/browser/outputActions.ts b/src/vs/workbench/parts/output/browser/outputActions.ts index fbffc2ad4824a9d9104b0cc23183c5bd674bf5a5..74025236792c91aaadc45c77410b424f1b3c3380 100644 --- a/src/vs/workbench/parts/output/browser/outputActions.ts +++ b/src/vs/workbench/parts/output/browser/outputActions.ts @@ -15,7 +15,7 @@ import {EditorAction, Behaviour} from 'vs/editor/common/editorAction'; import {ICommonCodeEditor, IEditorActionDescriptorData} from 'vs/editor/common/editorCommon'; import {EditorInputAction} from 'vs/workbench/browser/parts/editor/baseEditor'; import {IOutputChannelRegistry, Extensions, IOutputService, OUTPUT_EDITOR_INPUT_ID, OUTPUT_MODE_ID} from 'vs/workbench/parts/output/common/output'; -import {OutputEditorInput} from 'vs/workbench/parts/output/browser/outputEditorInput'; +import {OutputEditorInput} from 'vs/workbench/parts/output/common/outputEditorInput'; import {SelectActionItem} from 'vs/base/browser/ui/actionbar/actionbar'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {IQuickOpenService} from 'vs/workbench/services/quickopen/common/quickOpenService'; diff --git a/src/vs/workbench/parts/output/browser/outputEditorInput.ts b/src/vs/workbench/parts/output/common/outputEditorInput.ts similarity index 97% rename from src/vs/workbench/parts/output/browser/outputEditorInput.ts rename to src/vs/workbench/parts/output/common/outputEditorInput.ts index 0a3879a92a1caae857b0c81f89f04c6e380cadf0..6f1e2db4f52c1f764e6f925a4baa24523234c6cb 100644 --- a/src/vs/workbench/parts/output/browser/outputEditorInput.ts +++ b/src/vs/workbench/parts/output/common/outputEditorInput.ts @@ -7,7 +7,7 @@ import {TPromise} from 'vs/base/common/winjs.base'; import nls = require('vs/nls'); import {EditorModel} from 'vs/workbench/common/editor'; -import {LogEditorInput} from 'vs/workbench/browser/parts/editor/logEditorInput'; +import {LogEditorInput} from 'vs/workbench/common/editor/logEditorInput'; import {OUTPUT_EDITOR_INPUT_ID, IOutputEvent, OUTPUT_MIME, IOutputService} from 'vs/workbench/parts/output/common/output'; import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; diff --git a/src/vs/workbench/parts/output/browser/outputServices.ts b/src/vs/workbench/parts/output/common/outputServices.ts similarity index 94% rename from src/vs/workbench/parts/output/browser/outputServices.ts rename to src/vs/workbench/parts/output/common/outputServices.ts index acb2c8aa7505e2dd69671c9cd3f3187c10d18f5a..558ecb8b98a679b3007675ab5b30f7450af3c339 100644 --- a/src/vs/workbench/parts/output/browser/outputServices.ts +++ b/src/vs/workbench/parts/output/common/outputServices.ts @@ -8,9 +8,8 @@ import {Promise, TPromise} from 'vs/base/common/winjs.base'; import strings = require('vs/base/common/strings'); import Event, {Emitter} from 'vs/base/common/event'; import {EditorOptions} from 'vs/workbench/common/editor'; -import {StringEditor} from 'vs/workbench/browser/parts/editor/stringEditor'; import {OUTPUT_MIME, DEFAULT_OUTPUT_CHANNEL, IOutputEvent, IOutputService} from 'vs/workbench/parts/output/common/output'; -import {OutputEditorInput} from 'vs/workbench/parts/output/browser/outputEditorInput'; +import {OutputEditorInput} from 'vs/workbench/parts/output/common/outputEditorInput'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {IEditor, Position} from 'vs/platform/editor/common/editor'; import {IEventService} from 'vs/platform/event/common/event'; @@ -172,21 +171,21 @@ export class OutputService implements IOutputService { } // Still reveal last line - existingOutputEditor.revealLastLine(); + (existingOutputEditor.input).revealLastLine(); return Promise.as(existingOutputEditor); } // Otherwise open new - return this.editorService.openEditor(OutputEditorInput.getInstance(this.instantiationService, channel), preserveFocus ? EditorOptions.create({ preserveFocus: true }) : null, sideBySide); + return this.editorService.openEditor(OutputEditorInput.getInstance(this.instantiationService, channel), preserveFocus ? EditorOptions.create({ preserveFocus: true }) : null, sideBySide); } - private findOutputEditor(channel: string): StringEditor { + private findOutputEditor(channel: string): IEditor { let editors = this.editorService.getVisibleEditors(); for (let i = 0; i < editors.length; i++) { let editor = editors[i]; if (editor.input instanceof OutputEditorInput && (editor.input).getChannel() === channel && (editor.input).getMime() === OUTPUT_MIME) { - return editor; + return editor; } } diff --git a/src/vs/workbench/test/browser/parts/editor/stringEditorInput.test.ts b/src/vs/workbench/test/browser/parts/editor/stringEditorInput.test.ts index 5355385237560375ff6551c02da294ce43bff7c5..141710061eb02a6d39a5264ab52d2c70b632cac1 100644 --- a/src/vs/workbench/test/browser/parts/editor/stringEditorInput.test.ts +++ b/src/vs/workbench/test/browser/parts/editor/stringEditorInput.test.ts @@ -10,7 +10,7 @@ import {Promise } from 'vs/base/common/winjs.base'; import * as Strings from 'vs/base/common/strings'; import URI from 'vs/base/common/uri'; import {StringEditorInput} from 'vs/workbench/common/editor/stringEditorInput'; -import {LogEditorInput} from 'vs/workbench/browser/parts/editor/logEditorInput'; +import {LogEditorInput} from 'vs/workbench/common/editor/logEditorInput'; import {ResourceEditorInput} from 'vs/workbench/common/editor/resourceEditorInput'; import {ResourceEditorModel} from 'vs/workbench/common/editor/resourceEditorModel'; import {TestWorkspace, TestEditorService, MockRequestService} from 'vs/workbench/test/browser/servicesTestUtils';