@@ -201,28 +201,27 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
201201 public readonly isSimpleWidget : boolean ;
202202 private readonly _telemetryData : object | null ;
203203
204- private readonly domElement : HTMLElement ;
205- private readonly id : number ;
204+ private readonly _domElement : HTMLElement ;
205+ private readonly _id : number ;
206206 private readonly _configuration : editorCommon . IConfiguration ;
207207
208- protected _contributions : { [ key : string ] : editorCommon . IEditorContribution ; } ;
209- protected _actions : { [ key : string ] : editorCommon . IEditorAction ; } ;
208+ protected readonly _contributions : { [ key : string ] : editorCommon . IEditorContribution ; } ;
209+ protected readonly _actions : { [ key : string ] : editorCommon . IEditorAction ; } ;
210210
211211 // --- Members logically associated to a model
212212 protected _modelData : ModelData | null ;
213213
214-
215214 protected readonly _instantiationService : IInstantiationService ;
216215 protected readonly _contextKeyService : IContextKeyService ;
217216 private readonly _notificationService : INotificationService ;
218217 private readonly _codeEditorService : ICodeEditorService ;
219218 private readonly _commandService : ICommandService ;
220219 private readonly _themeService : IThemeService ;
221220
222- private _focusTracker : CodeEditorWidgetFocusTracker ;
221+ private readonly _focusTracker : CodeEditorWidgetFocusTracker ;
223222
224- private contentWidgets : { [ key : string ] : IContentWidgetData ; } ;
225- private overlayWidgets : { [ key : string ] : IOverlayWidgetData ; } ;
223+ private readonly _contentWidgets : { [ key : string ] : IContentWidgetData ; } ;
224+ private readonly _overlayWidgets : { [ key : string ] : IOverlayWidgetData ; } ;
226225
227226 /**
228227 * map from "parent" decoration type to live decoration ids.
@@ -242,8 +241,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
242241 @INotificationService notificationService : INotificationService
243242 ) {
244243 super ( ) ;
245- this . domElement = domElement ;
246- this . id = ( ++ EDITOR_ID ) ;
244+ this . _domElement = domElement ;
245+ this . _id = ( ++ EDITOR_ID ) ;
247246 this . _decorationTypeKeysToIds = { } ;
248247 this . _decorationTypeSubtypes = { } ;
249248 this . isSimpleWidget = codeEditorWidgetOptions . isSimpleWidget || false ;
@@ -258,13 +257,13 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
258257 this . _onDidLayoutChange . fire ( this . _configuration . editor . layoutInfo ) ;
259258 }
260259 if ( this . _configuration . editor . showUnused ) {
261- this . domElement . classList . add ( SHOW_UNUSED_ENABLED_CLASS ) ;
260+ this . _domElement . classList . add ( SHOW_UNUSED_ENABLED_CLASS ) ;
262261 } else {
263- this . domElement . classList . remove ( SHOW_UNUSED_ENABLED_CLASS ) ;
262+ this . _domElement . classList . remove ( SHOW_UNUSED_ENABLED_CLASS ) ;
264263 }
265264 } ) ) ;
266265
267- this . _contextKeyService = this . _register ( contextKeyService . createScoped ( this . domElement ) ) ;
266+ this . _contextKeyService = this . _register ( contextKeyService . createScoped ( this . _domElement ) ) ;
268267 this . _notificationService = notificationService ;
269268 this . _codeEditorService = codeEditorService ;
270269 this . _commandService = commandService ;
@@ -284,8 +283,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
284283 this . _editorWidgetFocus . setValue ( this . _focusTracker . hasFocus ( ) ) ;
285284 } ) ;
286285
287- this . contentWidgets = { } ;
288- this . overlayWidgets = { } ;
286+ this . _contentWidgets = { } ;
287+ this . _overlayWidgets = { } ;
289288
290289 mark ( 'editor/start/contrib' ) ;
291290 let contributions : IEditorContributionCtor [ ] ;
@@ -325,11 +324,11 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
325324 }
326325
327326 protected _createConfiguration ( options : editorOptions . IEditorOptions ) : editorCommon . IConfiguration {
328- return new Configuration ( options , this . domElement ) ;
327+ return new Configuration ( options , this . _domElement ) ;
329328 }
330329
331330 public getId ( ) : string {
332- return this . getEditorType ( ) + ':' + this . id ;
331+ return this . getEditorType ( ) + ':' + this . _id ;
333332 }
334333
335334 public getEditorType ( ) : string {
@@ -339,20 +338,14 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
339338 public dispose ( ) : void {
340339 this . _codeEditorService . removeCodeEditor ( this ) ;
341340
342- this . contentWidgets = { } ;
343- this . overlayWidgets = { } ;
344-
345341 this . _focusTracker . dispose ( ) ;
346342
347343 let keys = Object . keys ( this . _contributions ) ;
348344 for ( let i = 0 , len = keys . length ; i < len ; i ++ ) {
349345 let contributionId = keys [ i ] ;
350346 this . _contributions [ contributionId ] . dispose ( ) ;
351347 }
352- this . _contributions = { } ;
353348
354- // editor actions don't need to be disposed
355- this . _actions = { } ;
356349 this . _removeDecorationTypes ( ) ;
357350 this . _postDetachModelCleanup ( this . _detachModel ( ) ) ;
358351
@@ -1026,14 +1019,14 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
10261019 // callback will not be called
10271020 return null ;
10281021 }
1029- return this . _modelData . model . changeDecorations ( callback , this . id ) ;
1022+ return this . _modelData . model . changeDecorations ( callback , this . _id ) ;
10301023 }
10311024
10321025 public getLineDecorations ( lineNumber : number ) : IModelDecoration [ ] | null {
10331026 if ( ! this . _modelData ) {
10341027 return null ;
10351028 }
1036- return this . _modelData . model . getLineDecorations ( lineNumber , this . id , this . _configuration . editor . readOnly ) ;
1029+ return this . _modelData . model . getLineDecorations ( lineNumber , this . _id , this . _configuration . editor . readOnly ) ;
10371030 }
10381031
10391032 public deltaDecorations ( oldDecorations : string [ ] , newDecorations : IModelDeltaDecoration [ ] ) : string [ ] {
@@ -1045,7 +1038,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
10451038 return oldDecorations ;
10461039 }
10471040
1048- return this . _modelData . model . deltaDecorations ( oldDecorations , newDecorations , this . id ) ;
1041+ return this . _modelData . model . deltaDecorations ( oldDecorations , newDecorations , this . _id ) ;
10491042 }
10501043
10511044 public setDecorations ( decorationTypeKey : string , decorationOptions : editorCommon . IDecorationOptions [ ] ) : void {
@@ -1178,11 +1171,11 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
11781171 position : widget . getPosition ( )
11791172 } ;
11801173
1181- if ( this . contentWidgets . hasOwnProperty ( widget . getId ( ) ) ) {
1174+ if ( this . _contentWidgets . hasOwnProperty ( widget . getId ( ) ) ) {
11821175 console . warn ( 'Overwriting a content widget with the same id.' ) ;
11831176 }
11841177
1185- this . contentWidgets [ widget . getId ( ) ] = widgetData ;
1178+ this . _contentWidgets [ widget . getId ( ) ] = widgetData ;
11861179
11871180 if ( this . _modelData && this . _modelData . hasRealView ) {
11881181 this . _modelData . view . addContentWidget ( widgetData ) ;
@@ -1191,8 +1184,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
11911184
11921185 public layoutContentWidget ( widget : editorBrowser . IContentWidget ) : void {
11931186 let widgetId = widget . getId ( ) ;
1194- if ( this . contentWidgets . hasOwnProperty ( widgetId ) ) {
1195- let widgetData = this . contentWidgets [ widgetId ] ;
1187+ if ( this . _contentWidgets . hasOwnProperty ( widgetId ) ) {
1188+ let widgetData = this . _contentWidgets [ widgetId ] ;
11961189 widgetData . position = widget . getPosition ( ) ;
11971190 if ( this . _modelData && this . _modelData . hasRealView ) {
11981191 this . _modelData . view . layoutContentWidget ( widgetData ) ;
@@ -1202,9 +1195,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
12021195
12031196 public removeContentWidget ( widget : editorBrowser . IContentWidget ) : void {
12041197 let widgetId = widget . getId ( ) ;
1205- if ( this . contentWidgets . hasOwnProperty ( widgetId ) ) {
1206- let widgetData = this . contentWidgets [ widgetId ] ;
1207- delete this . contentWidgets [ widgetId ] ;
1198+ if ( this . _contentWidgets . hasOwnProperty ( widgetId ) ) {
1199+ let widgetData = this . _contentWidgets [ widgetId ] ;
1200+ delete this . _contentWidgets [ widgetId ] ;
12081201 if ( this . _modelData && this . _modelData . hasRealView ) {
12091202 this . _modelData . view . removeContentWidget ( widgetData ) ;
12101203 }
@@ -1217,11 +1210,11 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
12171210 position : widget . getPosition ( )
12181211 } ;
12191212
1220- if ( this . overlayWidgets . hasOwnProperty ( widget . getId ( ) ) ) {
1213+ if ( this . _overlayWidgets . hasOwnProperty ( widget . getId ( ) ) ) {
12211214 console . warn ( 'Overwriting an overlay widget with the same id.' ) ;
12221215 }
12231216
1224- this . overlayWidgets [ widget . getId ( ) ] = widgetData ;
1217+ this . _overlayWidgets [ widget . getId ( ) ] = widgetData ;
12251218
12261219 if ( this . _modelData && this . _modelData . hasRealView ) {
12271220 this . _modelData . view . addOverlayWidget ( widgetData ) ;
@@ -1230,8 +1223,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
12301223
12311224 public layoutOverlayWidget ( widget : editorBrowser . IOverlayWidget ) : void {
12321225 let widgetId = widget . getId ( ) ;
1233- if ( this . overlayWidgets . hasOwnProperty ( widgetId ) ) {
1234- let widgetData = this . overlayWidgets [ widgetId ] ;
1226+ if ( this . _overlayWidgets . hasOwnProperty ( widgetId ) ) {
1227+ let widgetData = this . _overlayWidgets [ widgetId ] ;
12351228 widgetData . position = widget . getPosition ( ) ;
12361229 if ( this . _modelData && this . _modelData . hasRealView ) {
12371230 this . _modelData . view . layoutOverlayWidget ( widgetData ) ;
@@ -1241,9 +1234,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
12411234
12421235 public removeOverlayWidget ( widget : editorBrowser . IOverlayWidget ) : void {
12431236 let widgetId = widget . getId ( ) ;
1244- if ( this . overlayWidgets . hasOwnProperty ( widgetId ) ) {
1245- let widgetData = this . overlayWidgets [ widgetId ] ;
1246- delete this . overlayWidgets [ widgetId ] ;
1237+ if ( this . _overlayWidgets . hasOwnProperty ( widgetId ) ) {
1238+ let widgetData = this . _overlayWidgets [ widgetId ] ;
1239+ delete this . _overlayWidgets [ widgetId ] ;
12471240 if ( this . _modelData && this . _modelData . hasRealView ) {
12481241 this . _modelData . view . removeOverlayWidget ( widgetData ) ;
12491242 }
@@ -1311,17 +1304,17 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
13111304
13121305 const listenersToRemove : IDisposable [ ] = [ ] ;
13131306
1314- this . domElement . setAttribute ( 'data-mode-id' , model . getLanguageIdentifier ( ) . language ) ;
1307+ this . _domElement . setAttribute ( 'data-mode-id' , model . getLanguageIdentifier ( ) . language ) ;
13151308 this . _configuration . setIsDominatedByLongLines ( model . isDominatedByLongLines ( ) ) ;
13161309 this . _configuration . setMaxLineNumber ( model . getLineCount ( ) ) ;
13171310
13181311 model . onBeforeAttached ( ) ;
13191312
1320- const viewModel = new ViewModel ( this . id , this . _configuration , model , ( callback ) => dom . scheduleAtNextAnimationFrame ( callback ) ) ;
1313+ const viewModel = new ViewModel ( this . _id , this . _configuration , model , ( callback ) => dom . scheduleAtNextAnimationFrame ( callback ) ) ;
13211314
13221315 listenersToRemove . push ( model . onDidChangeDecorations ( ( e ) => this . _onDidChangeModelDecorations . fire ( e ) ) ) ;
13231316 listenersToRemove . push ( model . onDidChangeLanguage ( ( e ) => {
1324- this . domElement . setAttribute ( 'data-mode-id' , model . getLanguageIdentifier ( ) . language ) ;
1317+ this . _domElement . setAttribute ( 'data-mode-id' , model . getLanguageIdentifier ( ) . language ) ;
13251318 this . _onDidChangeModelLanguage . fire ( e ) ;
13261319 } ) ) ;
13271320 listenersToRemove . push ( model . onDidChangeLanguageConfiguration ( ( e ) => this . _onDidChangeModelLanguageConfiguration . fire ( e ) ) ) ;
@@ -1365,18 +1358,18 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
13651358
13661359 const [ view , hasRealView ] = this . _createView ( viewModel , cursor ) ;
13671360 if ( hasRealView ) {
1368- this . domElement . appendChild ( view . domNode . domNode ) ;
1361+ this . _domElement . appendChild ( view . domNode . domNode ) ;
13691362
1370- let keys = Object . keys ( this . contentWidgets ) ;
1363+ let keys = Object . keys ( this . _contentWidgets ) ;
13711364 for ( let i = 0 , len = keys . length ; i < len ; i ++ ) {
13721365 let widgetId = keys [ i ] ;
1373- view . addContentWidget ( this . contentWidgets [ widgetId ] ) ;
1366+ view . addContentWidget ( this . _contentWidgets [ widgetId ] ) ;
13741367 }
13751368
1376- keys = Object . keys ( this . overlayWidgets ) ;
1369+ keys = Object . keys ( this . _overlayWidgets ) ;
13771370 for ( let i = 0 , len = keys . length ; i < len ; i ++ ) {
13781371 let widgetId = keys [ i ] ;
1379- view . addOverlayWidget ( this . overlayWidgets [ widgetId ] ) ;
1372+ view . addOverlayWidget ( this . _overlayWidgets [ widgetId ] ) ;
13801373 }
13811374
13821375 view . render ( false , true ) ;
@@ -1479,7 +1472,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
14791472
14801473 protected _postDetachModelCleanup ( detachedModel : ITextModel | null ) : void {
14811474 if ( detachedModel ) {
1482- detachedModel . removeAllDecorationsWithOwnerId ( this . id ) ;
1475+ detachedModel . removeAllDecorationsWithOwnerId ( this . _id ) ;
14831476 }
14841477 }
14851478
@@ -1493,9 +1486,9 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
14931486 this . _modelData . dispose ( ) ;
14941487 this . _modelData = null ;
14951488
1496- this . domElement . removeAttribute ( 'data-mode-id' ) ;
1489+ this . _domElement . removeAttribute ( 'data-mode-id' ) ;
14971490 if ( removeDomNode ) {
1498- this . domElement . removeChild ( removeDomNode ) ;
1491+ this . _domElement . removeChild ( removeDomNode ) ;
14991492 }
15001493
15011494 return model ;
0 commit comments