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


TypeScript Range.compareRangesUsingStarts方法代码示例

本文整理汇总了TypeScript中vs/editor/common/core/range.Range.compareRangesUsingStarts方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Range.compareRangesUsingStarts方法的具体用法?TypeScript Range.compareRangesUsingStarts怎么用?TypeScript Range.compareRangesUsingStarts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/common/core/range.Range的用法示例。


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

示例1:

		return symbols.sort((a, b) => {
			// sort by range and provider rank
			let ret = Range.compareRangesUsingStarts(a.symbol.range, b.symbol.range);
			if (ret === 0) {
				ret = provider.indexOf(a.provider) - provider.indexOf(b.provider);
			}
			return ret;
		});
开发者ID:asotog,项目名称:vscode,代码行数:8,代码来源:codelens.ts

示例2:

		decorations = decorations.sort((a, b) => {
			let aClassName = a.options.className;
			let bClassName = b.options.className;

			if (aClassName < bClassName) {
				return -1;
			}
			if (aClassName > bClassName) {
				return 1;
			}

			return Range.compareRangesUsingStarts(a.range, b.range);
		});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:13,代码来源:decorations.ts

示例3:

		decorations = decorations.sort((a, b) => {
			if (a.options.zIndex! < b.options.zIndex!) {
				return -1;
			}
			if (a.options.zIndex! > b.options.zIndex!) {
				return 1;
			}
			const aClassName = a.options.className!;
			const bClassName = b.options.className!;

			if (aClassName < bClassName) {
				return -1;
			}
			if (aClassName > bClassName) {
				return 1;
			}

			return Range.compareRangesUsingStarts(a.range, b.range);
		});
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:19,代码来源:decorations.ts

示例4: union

function union(oldLinks: Link[], newLinks: Link[]): Link[] {
	// reunite oldLinks with newLinks and remove duplicates
	var result: Link[] = [],
		oldIndex: number,
		oldLen: number,
		newIndex: number,
		newLen: number,
		oldLink: Link,
		newLink: Link,
		comparisonResult: number;

	for (oldIndex = 0, newIndex = 0, oldLen = oldLinks.length, newLen = newLinks.length; oldIndex < oldLen && newIndex < newLen;) {
		oldLink = oldLinks[oldIndex];
		newLink = newLinks[newIndex];

		if (Range.areIntersectingOrTouching(oldLink.range, newLink.range)) {
			// Remove the oldLink
			oldIndex++;
			continue;
		}

		comparisonResult = Range.compareRangesUsingStarts(oldLink.range, newLink.range);

		if (comparisonResult < 0) {
			// oldLink is before
			result.push(oldLink);
			oldIndex++;
		} else {
			// newLink is before
			result.push(newLink);
			newIndex++;
		}
	}

	for (; oldIndex < oldLen; oldIndex++) {
		result.push(oldLinks[oldIndex]);
	}
	for (; newIndex < newLen; newIndex++) {
		result.push(newLinks[newIndex]);
	}

	return result;
}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:43,代码来源:getLinks.ts

示例5: compareEntriesUsingStart

function compareEntriesUsingStart(a: DocumentSymbol, b: DocumentSymbol): number {
	return Range.compareRangesUsingStarts(a.range, b.range);
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:3,代码来源:quickOpen.ts

示例6:

		newDecorations.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
开发者ID:aminroosta,项目名称:vscode,代码行数:1,代码来源:textModelWithDecorations.ts

示例7: _deltaDecorationsImpl

	private _deltaDecorationsImpl(eventBuilder:DeferredEventsBuilder, ownerId:number, oldDecorationsIds:string[], newDecorations: ModelDeltaDecoration[]): string[] {

		if (oldDecorationsIds.length === 0) {
			// Nothing to remove
			return this._addDecorationsImpl(eventBuilder, ownerId, newDecorations);
		}

		if (newDecorations.length === 0) {
			// Nothing to add
			this._removeDecorationsImpl(eventBuilder, oldDecorationsIds);
			return [];
		}

		let oldDecorations = this._resolveOldDecorations(oldDecorationsIds);

		oldDecorations.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
		newDecorations.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));

		let result:string[] = [],
			oldDecorationsIndex = 0,
			oldDecorationsLength = oldDecorations.length,
			newDecorationsIndex = 0,
			newDecorationsLength = newDecorations.length,
			decorationsToAdd: ModelDeltaDecoration[] = [],
			decorationsToRemove: string[] = [];

		while (oldDecorationsIndex < oldDecorationsLength && newDecorationsIndex < newDecorationsLength) {
			let oldDecoration = oldDecorations[oldDecorationsIndex];
			let newDecoration = newDecorations[newDecorationsIndex];
			let comparison = Range.compareRangesUsingStarts(oldDecoration.range, newDecoration.range);

			if (comparison < 0) {
				// `oldDecoration` is before `newDecoration` => remove `oldDecoration`
				decorationsToRemove.push(oldDecoration.id);
				oldDecorationsIndex++;
				continue;
			}

			if (comparison > 0) {
				// `newDecoration` is before `oldDecoration` => add `newDecoration`
				decorationsToAdd.push(newDecoration);
				newDecorationsIndex++;
				continue;
			}

			// The ranges of `oldDecoration` and `newDecoration` are equal

			if (!oldDecoration.options.equals(newDecoration.options)) {
				// The options do not match => remove `oldDecoration`
				decorationsToRemove.push(oldDecoration.id);
				oldDecorationsIndex++;
				continue;
			}

			// Bingo! We can reuse `oldDecoration` for `newDecoration`
			result[newDecoration.index] = oldDecoration.id;
			oldDecorationsIndex++;
			newDecorationsIndex++;
		}

		while (oldDecorationsIndex < oldDecorationsLength) {
			// No more new decorations => remove decoration at `oldDecorationsIndex`
			decorationsToRemove.push(oldDecorations[oldDecorationsIndex].id);
			oldDecorationsIndex++;
		}

		while (newDecorationsIndex < newDecorationsLength) {
			// No more old decorations => add decoration at `newDecorationsIndex`
			decorationsToAdd.push(newDecorations[newDecorationsIndex]);
			newDecorationsIndex++;
		}

		// Remove `decorationsToRemove`
		if (decorationsToRemove.length > 0) {
			this._removeDecorationsImpl(eventBuilder, decorationsToRemove);
		}

		// Add `decorationsToAdd`
		if (decorationsToAdd.length > 0) {
			let newIds = this._addDecorationsImpl(eventBuilder, ownerId, decorationsToAdd);
			for (let i = 0, len = decorationsToAdd.length; i < len; i++) {
				result[decorationsToAdd[i].index] = newIds[i];
			}
		}

		return result;
	}
开发者ID:aminroosta,项目名称:vscode,代码行数:87,代码来源:textModelWithDecorations.ts

示例8:

			ops.sort((o1, o2) => {
				return Range.compareRangesUsingStarts(o1.range, o2.range);
			});
开发者ID:PKRoma,项目名称:vscode,代码行数:3,代码来源:replaceAllCommand.ts

示例9: compareDecorations

	public static compareDecorations(a:EditorCommon.IModelDecoration, b:EditorCommon.IModelDecoration): number {
		return Range.compareRangesUsingStarts(a.range, b.range);
	}
开发者ID:ErickWendel,项目名称:vscode,代码行数:3,代码来源:viewModelDecorations.ts

示例10: compareEntriesUsingStart

function compareEntriesUsingStart(a: SymbolInformation, b: SymbolInformation): number {
	return Range.compareRangesUsingStarts(Range.lift(a.location.range), Range.lift(b.location.range));
}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:3,代码来源:quickOpen.ts


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