當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。