当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript textModel.createTextBufferFactory函数代码示例

本文整理汇总了TypeScript中vs/editor/common/model/textModel.createTextBufferFactory函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createTextBufferFactory函数的具体用法?TypeScript createTextBufferFactory怎么用?TypeScript createTextBufferFactory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了createTextBufferFactory函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

		test('untitled file', function (done: () => void) {
			service.backupResource(untitledFile, createTextBufferFactory('test').create(DefaultEndOfLine.LF).createSnapshot(false)).then(() => {
				assert.equal(fs.readdirSync(path.join(workspaceBackupPath, 'untitled')).length, 1);
				assert.equal(fs.existsSync(untitledBackupPath), true);
				assert.equal(fs.readFileSync(untitledBackupPath), `${untitledFile.toString()}\ntest`);
				done();
			});
		});
开发者ID:tonycleveland,项目名称:vscode,代码行数:8,代码来源:backupFileService.test.ts

示例2: createTextBufferFactory

				return service.getWorkspaceFileBackups().then(textFiles => {
					assert.deepEqual(textFiles.map(f => f.fsPath), [fooFile.fsPath]);
					return service.backupResource(barFile, createTextBufferFactory('test').create(DefaultEndOfLine.LF).createSnapshot(false)).then(() => {
						return service.getWorkspaceFileBackups().then(textFiles => {
							assert.deepEqual(textFiles.map(f => f.fsPath), [fooFile.fsPath, barFile.fsPath]);
						});
					});
				});
开发者ID:eamodio,项目名称:vscode,代码行数:8,代码来源:backupFileService.test.ts

示例3: test

		test('should restore the original contents (untitled file)', () => {
			const contents = 'test\nand more stuff';
			service.backupResource(untitledFile, createTextBufferFactory(contents).create(DefaultEndOfLine.LF).createSnapshot(false)).then(() => {
				service.resolveBackupContent(service.toBackupResource(untitledFile)).then(factory => {
					assert.equal(contents, snapshotToString(factory!.create(platform.isWindows ? DefaultEndOfLine.CRLF : DefaultEndOfLine.LF).createSnapshot(true)));
				});
			});
		});
开发者ID:eamodio,项目名称:vscode,代码行数:8,代码来源:backupFileService.test.ts

示例4: test

	test('BaseTextEditorModel', async () => {
		let modelService = stubModelService(instantiationService);

		let m = new MyTextEditorModel(modelService, modeService);
		const model = await m.load() as MyTextEditorModel;

		assert(model === m);
		model.createTextEditorModel(createTextBufferFactory('foo'), null!, 'text/plain');
		assert.strictEqual(m.isResolved(), true);
		m.dispose();
	});
开发者ID:PKRoma,项目名称:vscode,代码行数:11,代码来源:editorModel.test.ts

示例5: testResolveBackup

		async function testResolveBackup(resource: URI, contents: string, meta?: IBackupTestMetaData, expectedMeta?: IBackupTestMetaData | null) {
			if (typeof expectedMeta === 'undefined') {
				expectedMeta = meta;
			}

			await service.backupResource(resource, createTextBufferFactory(contents).create(DefaultEndOfLine.LF).createSnapshot(false), 1, meta);

			assert.ok(await service.loadBackupResource(resource));

			const backup = await service.resolveBackupContent<IBackupTestMetaData>(service.toBackupResource(resource));
			assert.equal(contents, snapshotToString(backup.value.create(platform.isWindows ? DefaultEndOfLine.CRLF : DefaultEndOfLine.LF).createSnapshot(true)));

			if (expectedMeta) {
				assert.equal(backup.meta!.etag, expectedMeta.etag);
				assert.equal(backup.meta!.size, expectedMeta.size);
				assert.equal(backup.meta!.mtime, expectedMeta.mtime);
				assert.equal(backup.meta!.orphaned, expectedMeta.orphaned);
			} else {
				assert.ok(!backup.meta);
			}
		}
开发者ID:PKRoma,项目名称:vscode,代码行数:21,代码来源:backupFileService.test.ts


注:本文中的vs/editor/common/model/textModel.createTextBufferFactory函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。