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


TypeScript diffComputer.DiffComputer類代碼示例

本文整理匯總了TypeScript中vs/editor/common/diff/diffComputer.DiffComputer的典型用法代碼示例。如果您正苦於以下問題:TypeScript DiffComputer類的具體用法?TypeScript DiffComputer怎麽用?TypeScript DiffComputer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: computeDiff

export function computeDiff(oneDocument: vscode.TextDocument, otherDocument: vscode.TextDocument): Thenable<vscode.LineChange[]> {
	const oneLines = getTextDocumentLines(oneDocument);
	const otherLines = getTextDocumentLines(otherDocument);
	const computer = new DiffComputer(oneLines, otherLines, {
		shouldPostProcessCharChanges: false,
		shouldIgnoreTrimWhitespace: false, // options?
		shouldConsiderTrimWhitespaceInEmptyCase: false
	});

	return toThenable(computer.computeDiff());
}
開發者ID:yuit,項目名稱:vscode,代碼行數:11,代碼來源:extHostFunctions.ts

示例2: assertDiff

function assertDiff(originalLines: string[], modifiedLines: string[], expectedChanges: IChange[], shouldPostProcessCharChanges: boolean = false, shouldIgnoreTrimWhitespace: boolean = false) {
	var diffComputer = new DiffComputer(originalLines, modifiedLines, {
		shouldPostProcessCharChanges: shouldPostProcessCharChanges || false,
		shouldIgnoreTrimWhitespace: shouldIgnoreTrimWhitespace || false,
		shouldConsiderTrimWhitespaceInEmptyCase: true
	});
	var changes = diffComputer.computeDiff();

	var extracted = [];
	for (var i = 0; i < changes.length; i++) {
		extracted.push(extractLineChangeRepresentation(changes[i], i < expectedChanges.length ? expectedChanges[i] : null));
	}
	assert.deepEqual(extracted, expectedChanges);
}
開發者ID:hungys,項目名稱:vscode,代碼行數:14,代碼來源:diffComputer.test.ts

示例3: computeDirtyDiff

	public computeDirtyDiff(originalUrl:string, modifiedUrl:string, ignoreTrimWhitespace:boolean):TPromise<EditorCommon.IChange[]> {
		let original = this._models[originalUrl];
		let modified = this._models[modifiedUrl];
		if (!original || !modified) {
			return null;
		}

		let originalLines = original.getLinesContent();
		let modifiedLines = modified.getLinesContent();
		let diffComputer = new DiffComputer(originalLines, modifiedLines, {
			shouldPostProcessCharChanges: false,
			shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
			shouldConsiderTrimWhitespaceInEmptyCase: false
		});
		return TPromise.as(diffComputer.computeDiff());
	}
開發者ID:ErickWendel,項目名稱:vscode,代碼行數:16,代碼來源:editorSimpleWorker.ts


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