44 *--------------------------------------------------------------------------------------------*/
55'use strict' ;
66
7- import { Emitter , Event } from 'vs/base/common/event' ;
8- import { dispose , IDisposable } from 'vs/base/common/lifecycle' ;
9- import URI from 'vs/base/common/uri' ;
10- import { ICodeEditor , isCodeEditor , isDiffEditor } from 'vs/editor/browser/editorBrowser' ;
11- import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService' ;
12- import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService' ;
13- import { IEditor } from 'vs/editor/common/editorCommon' ;
14- import { ITextModel } from 'vs/editor/common/model' ;
157import { IModelService , shouldSynchronizeModel } from 'vs/editor/common/services/modelService' ;
16- import { IModeService } from 'vs/editor/common/services/modeService' ;
17- import { ITextModelService } from 'vs/editor/common/services/resolverService' ;
18- import { IFileService } from 'vs/platform/files/common/files' ;
8+ import { ITextModel } from 'vs/editor/common/model' ;
9+ import { IDisposable , dispose } from 'vs/base/common/lifecycle' ;
10+ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService' ;
11+ import { Event , Emitter } from 'vs/base/common/event' ;
12+ import { ExtHostContext , ExtHostDocumentsAndEditorsShape , IModelAddedData , ITextEditorAddData , IDocumentsAndEditorsDelta , IExtHostContext , MainContext } from '../node/extHost.protocol' ;
13+ import { MainThreadTextEditor } from './mainThreadEditor' ;
14+ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles' ;
15+ import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService' ;
16+ import { EditorViewColumn , editorGroupToViewColumn } from 'vs/workbench/api/shared/editor' ;
17+ import { IEditor } from 'vs/workbench/common/editor' ;
1918import { extHostCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers' ;
2019import { MainThreadDocuments } from 'vs/workbench/api/electron-browser/mainThreadDocuments' ;
2120import { MainThreadTextEditors } from 'vs/workbench/api/electron-browser/mainThreadEditors' ;
22- import { editorGroupToViewColumn , EditorViewColumn } from 'vs/workbench/api/shared/editor' ;
23- import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor' ;
24- import { IEditor as IWorkbenchEditor } from 'vs/workbench/common/editor' ;
25- import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
26- import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService' ;
27- import { IPanelService } from 'vs/workbench/services/panel/common/panelService' ;
28- import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles' ;
21+ import { IModeService } from 'vs/editor/common/services/modeService' ;
22+ import { IFileService } from 'vs/platform/files/common/files' ;
23+ import { ITextModelService } from 'vs/editor/common/services/resolverService' ;
2924import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService' ;
30- import { ExtHostContext , ExtHostDocumentsAndEditorsShape , IDocumentsAndEditorsDelta , IExtHostContext , IModelAddedData , ITextEditorAddData , MainContext } from '../node/extHost.protocol' ;
31- import { MainThreadTextEditor } from './mainThreadEditor' ;
25+ import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
26+ import { isDiffEditor , ICodeEditor } from 'vs/editor/browser/editorBrowser' ;
27+ import URI from 'vs/base/common/uri' ;
28+ import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService' ;
3229
3330namespace mapset {
3431
@@ -164,8 +161,7 @@ class MainThreadDocumentAndEditorStateComputer {
164161 private readonly _onDidChangeState : ( delta : DocumentAndEditorStateDelta ) => void ,
165162 @IModelService private readonly _modelService : IModelService ,
166163 @ICodeEditorService private readonly _codeEditorService : ICodeEditorService ,
167- @IEditorService private readonly _editorService : IEditorService ,
168- @IPanelService private readonly _panelService : IPanelService ,
164+ @IEditorService private readonly _editorService : IEditorService
169165 ) {
170166 this . _modelService . onModelAdded ( this . _updateStateOnModelAdd , this , this . _toDispose ) ;
171167 this . _modelService . onModelRemoved ( this . _updateState , this , this . _toDispose ) ;
@@ -256,21 +252,13 @@ class MainThreadDocumentAndEditorStateComputer {
256252 }
257253
258254 // active editor: if none of the previous editors had focus we try
259- // to match output panels or the the active workbench editor with
260- // one of editor we have just computed
255+ // to match the active workbench editor with one of editor we have
256+ // just computed
261257 if ( ! activeEditor ) {
262-
263- let candidate : IEditor ;
264- let panel = this . _panelService . getActivePanel ( ) ;
265- if ( panel instanceof BaseTextEditor && isCodeEditor ( panel . getControl ( ) ) ) {
266- candidate = panel . getControl ( ) ;
267- } else {
268- candidate = this . _editorService . activeTextEditorWidget ;
269- if ( isDiffEditor ( candidate ) ) {
270- candidate = candidate . getModifiedEditor ( ) ;
271- }
258+ let candidate = this . _editorService . activeTextEditorWidget ;
259+ if ( isDiffEditor ( candidate ) ) {
260+ candidate = candidate . getModifiedEditor ( ) ;
272261 }
273-
274262 if ( candidate ) {
275263 editors . forEach ( snapshot => {
276264 if ( candidate === snapshot . editor ) {
@@ -319,8 +307,7 @@ export class MainThreadDocumentsAndEditors {
319307 @ITextModelService textModelResolverService : ITextModelService ,
320308 @IUntitledEditorService untitledEditorService : IUntitledEditorService ,
321309 @IEditorGroupsService private readonly _editorGroupService : IEditorGroupsService ,
322- @IBulkEditService bulkEditService : IBulkEditService ,
323- @IPanelService panelService : IPanelService
310+ @IBulkEditService bulkEditService : IBulkEditService
324311
325312 ) {
326313 this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostDocumentsAndEditors ) ;
@@ -332,7 +319,7 @@ export class MainThreadDocumentsAndEditors {
332319 extHostContext . set ( MainContext . MainThreadTextEditors , mainThreadTextEditors ) ;
333320
334321 // It is expected that the ctor of the state computer calls our `_onDelta`.
335- this . _stateComputer = new MainThreadDocumentAndEditorStateComputer ( delta => this . _onDelta ( delta ) , _modelService , codeEditorService , this . _editorService , panelService ) ;
322+ this . _stateComputer = new MainThreadDocumentAndEditorStateComputer ( delta => this . _onDelta ( delta ) , _modelService , codeEditorService , this . _editorService ) ;
336323
337324 this . _toDispose = [
338325 mainThreadDocuments ,
@@ -443,7 +430,7 @@ export class MainThreadDocumentsAndEditors {
443430 return undefined ;
444431 }
445432
446- findTextEditorIdFor ( editor : IWorkbenchEditor ) : string {
433+ findTextEditorIdFor ( editor : IEditor ) : string {
447434 for ( let id in this . _textEditors ) {
448435 if ( this . _textEditors [ id ] . matches ( editor ) ) {
449436 return id ;
0 commit comments