mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 (#9279)
* Merge from vscode 33a65245075e4d18908652865a79cf5489c30f40 * remove github
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { workbenchInstantiationService as browserWorkbenchInstantiationService, ITestInstantiationService, TestLifecycleService, TestFilesConfigurationService, TestContextService, TestFileService, TestFileDialogService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { NativeTextFileService } from 'vs/workbench/services/textfile/electron-browser/nativeTextFileService';
|
||||
import { NativeTextFileService, EncodingOracle, IEncodingOverride } from 'vs/workbench/services/textfile/electron-browser/nativeTextFileService';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
|
||||
import { FileOperationError, IFileService } from 'vs/platform/files/common/files';
|
||||
@@ -30,6 +30,13 @@ import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { LogLevel } from 'vs/platform/log/common/log';
|
||||
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
|
||||
import { IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { UTF16le, UTF16be, UTF8_with_bom } from 'vs/base/node/encoding';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
import { NodeTestBackupFileService } from 'vs/workbench/services/backup/test/electron-browser/backupFileService.test';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
export const TestWindowConfiguration: IWindowConfiguration = {
|
||||
windowId: 0,
|
||||
@@ -110,6 +117,31 @@ export class TestTextFileService extends NativeTextFileService {
|
||||
}
|
||||
}
|
||||
|
||||
export class TestNativeTextFileServiceWithEncodingOverrides extends NativeTextFileService {
|
||||
|
||||
private _testEncoding: TestEncodingOracle | undefined;
|
||||
get encoding(): TestEncodingOracle {
|
||||
if (!this._testEncoding) {
|
||||
this._testEncoding = this._register(this.instantiationService.createInstance(TestEncodingOracle));
|
||||
}
|
||||
|
||||
return this._testEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
class TestEncodingOracle extends EncodingOracle {
|
||||
|
||||
protected get encodingOverrides(): IEncodingOverride[] {
|
||||
return [
|
||||
{ extension: 'utf16le', encoding: UTF16le },
|
||||
{ extension: 'utf16be', encoding: UTF16be },
|
||||
{ extension: 'utf8bom', encoding: UTF8_with_bom }
|
||||
];
|
||||
}
|
||||
|
||||
protected set encodingOverrides(overrides: IEncodingOverride[]) { }
|
||||
}
|
||||
|
||||
export class TestSharedProcessService implements ISharedProcessService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
@@ -187,3 +219,20 @@ export function workbenchInstantiationService(): ITestInstantiationService {
|
||||
|
||||
return instantiationService;
|
||||
}
|
||||
|
||||
export class TestServiceAccessor {
|
||||
constructor(
|
||||
@ILifecycleService public lifecycleService: TestLifecycleService,
|
||||
@ITextFileService public textFileService: TestTextFileService,
|
||||
@IFilesConfigurationService public filesConfigurationService: TestFilesConfigurationService,
|
||||
@IWorkspaceContextService public contextService: TestContextService,
|
||||
@IModelService public modelService: ModelServiceImpl,
|
||||
@IFileService public fileService: TestFileService,
|
||||
@IElectronService public electronService: TestElectronService,
|
||||
@IFileDialogService public fileDialogService: TestFileDialogService,
|
||||
@IBackupFileService public backupFileService: NodeTestBackupFileService,
|
||||
@IWorkingCopyService public workingCopyService: IWorkingCopyService,
|
||||
@IEditorService public editorService: IEditorService
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user