55
66import { Emitter , Event } from 'vs/base/common/event' ;
77import { Disposable , IDisposable , dispose } from 'vs/base/common/lifecycle' ;
8- import * as network from 'vs/base/common/network' ;
98import * as platform from 'vs/base/common/platform' ;
109import { URI } from 'vs/base/common/uri' ;
1110import { EDITOR_MODEL_DEFAULTS } from 'vs/editor/common/config/editorOptions' ;
@@ -20,7 +19,6 @@ import { ILanguageSelection } from 'vs/editor/common/services/modeService';
2019import { IModelService } from 'vs/editor/common/services/modelService' ;
2120import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration' ;
2221import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
23- import { IMarkerService } from 'vs/platform/markers/common/markers' ;
2422
2523function MODEL_ID ( resource : URI ) : string {
2624 return resource . toString ( ) ;
@@ -92,8 +90,6 @@ const DEFAULT_EOL = (platform.isLinux || platform.isMacintosh) ? DefaultEndOfLin
9290export class ModelServiceImpl extends Disposable implements IModelService {
9391 public _serviceBrand : any ;
9492
95- private _markerService : IMarkerService | null ;
96- private _markerServiceSubscription : IDisposable ;
9793 private _configurationService : IConfigurationService ;
9894 private _configurationServiceSubscription : IDisposable ;
9995 private _resourcePropertiesService : ITextResourcePropertiesService ;
@@ -117,12 +113,10 @@ export class ModelServiceImpl extends Disposable implements IModelService {
117113 private _models : { [ modelId : string ] : ModelData ; } ;
118114
119115 constructor (
120- @IMarkerService markerService : IMarkerService | null ,
121116 @IConfigurationService configurationService : IConfigurationService ,
122117 @ITextResourcePropertiesService resourcePropertiesService : ITextResourcePropertiesService
123118 ) {
124119 super ( ) ;
125- this . _markerService = markerService ;
126120 this . _configurationService = configurationService ;
127121 this . _resourcePropertiesService = resourcePropertiesService ;
128122 this . _models = { } ;
@@ -237,27 +231,10 @@ export class ModelServiceImpl extends Disposable implements IModelService {
237231 }
238232
239233 public dispose ( ) : void {
240- if ( this . _markerServiceSubscription ) {
241- this . _markerServiceSubscription . dispose ( ) ;
242- }
243234 this . _configurationServiceSubscription . dispose ( ) ;
244235 super . dispose ( ) ;
245236 }
246237
247- private _cleanUp ( model : ITextModel ) : void {
248- // clean up markers for internal, transient models
249- if ( model . uri . scheme === network . Schemas . inMemory
250- || model . uri . scheme === network . Schemas . internal
251- || model . uri . scheme === network . Schemas . vscode ) {
252- if ( this . _markerService ) {
253- this . _markerService . read ( { resource : model . uri } ) . map ( marker => marker . owner ) . forEach ( owner => this . _markerService ! . remove ( owner , [ model . uri ] ) ) ;
254- }
255- }
256-
257- // clean up cache
258- delete this . _modelCreationOptionsByLanguageAndResource [ model . getLanguageIdentifier ( ) . language + model . uri ] ;
259- }
260-
261238 // --- begin IModelService
262239
263240 private _createModelData ( value : string | ITextBufferFactory , languageIdentifier : LanguageIdentifier , resource : URI | null | undefined , isForSimpleWidget : boolean ) : ModelData {
@@ -416,7 +393,9 @@ export class ModelServiceImpl extends Disposable implements IModelService {
416393 delete this . _models [ modelId ] ;
417394 modelData . dispose ( ) ;
418395
419- this . _cleanUp ( model ) ;
396+ // clean up cache
397+ delete this . _modelCreationOptionsByLanguageAndResource [ model . getLanguageIdentifier ( ) . language + model . uri ] ;
398+
420399 this . _onModelRemoved . fire ( model ) ;
421400 }
422401
0 commit comments