當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript FileService.resolveContent方法代碼示例

本文整理匯總了TypeScript中vs/workbench/services/files/node/fileService.FileService.resolveContent方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FileService.resolveContent方法的具體用法?TypeScript FileService.resolveContent怎麽用?TypeScript FileService.resolveContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/workbench/services/files/node/fileService.FileService的用法示例。


在下文中一共展示了FileService.resolveContent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('resolveContent - FILE_IS_BINARY', function () {
		const resource = uri.file(path.join(testDir, 'binary.txt'));

		return service.resolveContent(resource, { acceptTextOnly: true }).then(null, (e: FileOperationError) => {
			assert.equal(e.fileOperationResult, FileOperationResult.FILE_IS_BINARY);

			return service.resolveContent(uri.file(path.join(testDir, 'small.txt')), { acceptTextOnly: true }).then(r => {
				assert.equal(r.name, 'small.txt');
			});
		});
	});
開發者ID:sameer-coder,項目名稱:vscode,代碼行數:11,代碼來源:fileService.test.ts

示例2:

				return encodingLib.detectEncodingByBOM(c.resource.fsPath).then((enc) => {
					assert.equal(enc, encodingLib.UTF16le);

					return service.resolveContent(resource).then(c => {
						assert.equal(c.encoding, encoding);

						model.dispose();

						done();
					});
				});
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:11,代碼來源:fileService.test.ts

示例3:

			_service.resolveContent(uri.file(path.join(testDir, 'index.html'))).done(c => {
				assert.equal(c.encoding, 'windows1252');

				return _service.resolveContent(uri.file(path.join(testDir, 'deep', 'conway.js'))).done(c => {
					assert.equal(c.encoding, 'utf16le');

					// teardown
					_service.dispose();
					done();
				});
			});
開發者ID:elemongw,項目名稱:vscode,代碼行數:11,代碼來源:fileService.test.ts

示例4: test

	test('resolveContent - FILE_NOT_MODIFIED_SINCE', function (done: () => void) {
		let resource = uri.file(path.join(testDir, 'index.html'));

		service.resolveContent(resource).done(c => {
			return service.resolveContent(resource, { etag: c.etag }).then(null, (e: IFileOperationResult) => {
				assert.equal(e.fileOperationResult, FileOperationResult.FILE_NOT_MODIFIED_SINCE);

				done();
			});
		}, error => onError(error, done));
	});
開發者ID:elemongw,項目名稱:vscode,代碼行數:11,代碼來源:fileService.test.ts

示例5: test

	test('updateContent (large file)', function (done: () => void) {
		const resource = uri.file(path.join(testDir, 'lorem.txt'));

		service.resolveContent(resource).done(c => {
			const newValue = c.value + c.value;
			c.value = newValue;

			return service.updateContent(c.resource, c.value).then(c => {
				assert.equal(fs.readFileSync(resource.fsPath), newValue);

				done();
			});
		}, error => onError(error, done));
	});
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:14,代碼來源:fileService.test.ts


注:本文中的vs/workbench/services/files/node/fileService.FileService.resolveContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。