@@ -16,7 +16,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
1616import { Position as EditorPosition , IEditor } from 'vs/platform/editor/common/editor' ;
1717import { extHostCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers' ;
1818import { MainThreadDocuments } from 'vs/workbench/api/electron-browser/mainThreadDocuments' ;
19- import { MainThreadEditors } from 'vs/workbench/api/electron-browser/mainThreadEditors' ;
19+ import { MainThreadTextEditors } from 'vs/workbench/api/electron-browser/mainThreadEditors' ;
2020import { IModeService } from 'vs/editor/common/services/modeService' ;
2121import { IFileService } from 'vs/platform/files/common/files' ;
2222import { ITextModelService } from 'vs/editor/common/services/resolverService' ;
@@ -77,7 +77,7 @@ namespace delta {
7777 }
7878}
7979
80- class EditorSnapshot {
80+ class TextEditorSnapshot {
8181
8282 readonly id : string ;
8383
@@ -95,8 +95,8 @@ class DocumentAndEditorStateDelta {
9595 constructor (
9696 readonly removedDocuments : ITextModel [ ] ,
9797 readonly addedDocuments : ITextModel [ ] ,
98- readonly removedEditors : EditorSnapshot [ ] ,
99- readonly addedEditors : EditorSnapshot [ ] ,
98+ readonly removedEditors : TextEditorSnapshot [ ] ,
99+ readonly addedEditors : TextEditorSnapshot [ ] ,
100100 readonly oldActiveEditor : string ,
101101 readonly newActiveEditor : string ,
102102 ) {
@@ -124,12 +124,12 @@ class DocumentAndEditorState {
124124 if ( ! before ) {
125125 return new DocumentAndEditorStateDelta (
126126 [ ] , mapset . setValues ( after . documents ) ,
127- [ ] , mapset . mapValues ( after . editors ) ,
127+ [ ] , mapset . mapValues ( after . textEditors ) ,
128128 undefined , after . activeEditor
129129 ) ;
130130 }
131131 const documentDelta = delta . ofSets ( before . documents , after . documents ) ;
132- const editorDelta = delta . ofMaps ( before . editors , after . editors ) ;
132+ const editorDelta = delta . ofMaps ( before . textEditors , after . textEditors ) ;
133133 const oldActiveEditor = before . activeEditor !== after . activeEditor ? before . activeEditor : undefined ;
134134 const newActiveEditor = before . activeEditor !== after . activeEditor ? after . activeEditor : undefined ;
135135
@@ -142,7 +142,7 @@ class DocumentAndEditorState {
142142
143143 constructor (
144144 readonly documents : Set < ITextModel > ,
145- readonly editors : Map < string , EditorSnapshot > ,
145+ readonly textEditors : Map < string , TextEditorSnapshot > ,
146146 readonly activeEditor : string ,
147147 ) {
148148 //
@@ -206,7 +206,7 @@ class MainThreadDocumentAndEditorStateComputer {
206206 // small (fast) delta
207207 this . _currentState = new DocumentAndEditorState (
208208 this . _currentState . documents . add ( model ) ,
209- this . _currentState . editors ,
209+ this . _currentState . textEditors ,
210210 this . _currentState . activeEditor
211211 ) ;
212212
@@ -229,7 +229,7 @@ class MainThreadDocumentAndEditorStateComputer {
229229
230230
231231 // editor: only take those that have a not too large model
232- const editors = new Map < string , EditorSnapshot > ( ) ;
232+ const editors = new Map < string , TextEditorSnapshot > ( ) ;
233233 let activeEditor : string = null ;
234234
235235 for ( const editor of this . _codeEditorService . listCodeEditors ( ) ) {
@@ -238,7 +238,7 @@ class MainThreadDocumentAndEditorStateComputer {
238238 && ! model . isDisposed ( ) // model disposed
239239 && Boolean ( this . _modelService . getModel ( model . uri ) ) // model disposing, the flag didn't flip yet but the model service already removed it
240240 ) {
241- const apiEditor = new EditorSnapshot ( editor ) ;
241+ const apiEditor = new TextEditorSnapshot ( editor ) ;
242242 editors . set ( apiEditor . id , apiEditor ) ;
243243 if ( editor . isFocused ( ) ) {
244244 activeEditor = apiEditor . id ;
@@ -285,7 +285,7 @@ export class MainThreadDocumentsAndEditors {
285285 private _toDispose : IDisposable [ ] ;
286286 private _proxy : ExtHostDocumentsAndEditorsShape ;
287287 private _stateComputer : MainThreadDocumentAndEditorStateComputer ;
288- private _editors = < { [ id : string ] : MainThreadTextEditor } > Object . create ( null ) ;
288+ private _textEditors = < { [ id : string ] : MainThreadTextEditor } > Object . create ( null ) ;
289289
290290 private _onTextEditorAdd = new Emitter < MainThreadTextEditor [ ] > ( ) ;
291291 private _onTextEditorRemove = new Emitter < string [ ] > ( ) ;
@@ -314,15 +314,15 @@ export class MainThreadDocumentsAndEditors {
314314 const mainThreadDocuments = new MainThreadDocuments ( this , extHostContext , this . _modelService , modeService , this . _textFileService , fileService , textModelResolverService , untitledEditorService ) ;
315315 extHostContext . set ( MainContext . MainThreadDocuments , mainThreadDocuments ) ;
316316
317- const mainThreadEditors = new MainThreadEditors ( this , extHostContext , codeEditorService , this . _workbenchEditorService , editorGroupService , textModelResolverService , fileService , this . _modelService ) ;
318- extHostContext . set ( MainContext . MainThreadEditors , mainThreadEditors ) ;
317+ const mainThreadTextEditors = new MainThreadTextEditors ( this , extHostContext , codeEditorService , this . _workbenchEditorService , editorGroupService , textModelResolverService , fileService , this . _modelService ) ;
318+ extHostContext . set ( MainContext . MainThreadTextEditors , mainThreadTextEditors ) ;
319319
320320 // It is expected that the ctor of the state computer calls our `_onDelta`.
321321 this . _stateComputer = new MainThreadDocumentAndEditorStateComputer ( delta => this . _onDelta ( delta ) , _modelService , codeEditorService , _workbenchEditorService ) ;
322322
323323 this . _toDispose = [
324324 mainThreadDocuments ,
325- mainThreadEditors ,
325+ mainThreadTextEditors ,
326326 this . _stateComputer ,
327327 this . _onTextEditorAdd ,
328328 this . _onTextEditorRemove ,
@@ -349,16 +349,16 @@ export class MainThreadDocumentsAndEditors {
349349 const mainThreadEditor = new MainThreadTextEditor ( apiEditor . id , apiEditor . editor . getModel ( ) ,
350350 apiEditor . editor , { onGainedFocus ( ) { } , onLostFocus ( ) { } } , this . _modelService ) ;
351351
352- this . _editors [ apiEditor . id ] = mainThreadEditor ;
352+ this . _textEditors [ apiEditor . id ] = mainThreadEditor ;
353353 addedEditors . push ( mainThreadEditor ) ;
354354 }
355355
356356 // removed editors
357357 for ( const { id } of delta . removedEditors ) {
358- const mainThreadEditor = this . _editors [ id ] ;
358+ const mainThreadEditor = this . _textEditors [ id ] ;
359359 if ( mainThreadEditor ) {
360360 mainThreadEditor . dispose ( ) ;
361- delete this . _editors [ id ] ;
361+ delete this . _textEditors [ id ] ;
362362 removedEditors . push ( id ) ;
363363 }
364364 }
@@ -428,15 +428,15 @@ export class MainThreadDocumentsAndEditors {
428428 }
429429
430430 findTextEditorIdFor ( editor : IEditor ) : string {
431- for ( let id in this . _editors ) {
432- if ( this . _editors [ id ] . matches ( editor ) ) {
431+ for ( let id in this . _textEditors ) {
432+ if ( this . _textEditors [ id ] . matches ( editor ) ) {
433433 return id ;
434434 }
435435 }
436436 return undefined ;
437437 }
438438
439439 getEditor ( id : string ) : MainThreadTextEditor {
440- return this . _editors [ id ] ;
440+ return this . _textEditors [ id ] ;
441441 }
442442}
0 commit comments