Restore undo-redo elements for IPathService.defaultUriScheme (#132612)

This commit is contained in:
Alexandru Dima
2021-09-08 17:27:34 +02:00
parent 94c829afd6
commit 4ad9d50796
3 changed files with 49 additions and 14 deletions

View File

@@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI } from 'vs/base/common/uri';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ILogService } from 'vs/platform/log/common/log';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { IPathService } from 'vs/workbench/services/path/common/pathService';
export class WorkbenchModelServiceImpl extends ModelServiceImpl {
constructor(
@IConfigurationService configurationService: IConfigurationService,
@ITextResourcePropertiesService resourcePropertiesService: ITextResourcePropertiesService,
@IThemeService themeService: IThemeService,
@ILogService logService: ILogService,
@IUndoRedoService undoRedoService: IUndoRedoService,
@IPathService private readonly _pathService: IPathService,
) {
super(configurationService, resourcePropertiesService, themeService, logService, undoRedoService);
}
protected override _schemaShouldMaintainUndoRedoElements(resource: URI) {
return (
super._schemaShouldMaintainUndoRedoElements(resource)
|| resource.scheme === this._pathService.defaultUriScheme
);
}
}
registerSingleton(IModelService, WorkbenchModelServiceImpl, true);