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


TypeScript Range.equalsRange方法代码示例

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


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

示例1: onLineMappingChanged

	public onLineMappingChanged(emit:(eventType:string, payload:any)=>void): void {
		var decorations = this.decorations,
			d:IViewModelDecoration,
			i:number,
			newRange:EditorCommon.IEditorRange,
			somethingChanged:boolean = false,
			inlineDecorationsChanged = false,
			len:number;

		for (i = 0, len = decorations.length; i < len; i++) {
			d = decorations[i];
			newRange = this.converter.convertModelRangeToViewRange(d.modelRange, d.options.isWholeLine);
			if (!inlineDecorationsChanged && d.options.inlineClassName && !Range.equalsRange(newRange, d.range)) {
				inlineDecorationsChanged = true;
			}
			if (!somethingChanged && !Range.equalsRange(newRange, d.range)) {
				somethingChanged = true;
			}
			d.range = newRange;
		}

		if (somethingChanged) {
			this._clearCachedModelDecorationsResolver();
			this.decorations.sort(ViewModelDecorations.compareDecorations);
			var newEvent:EditorCommon.IViewDecorationsChangedEvent = {
				inlineDecorationsChanged: inlineDecorationsChanged
			};
			emit(EditorCommon.ViewEventNames.DecorationsChangedEvent, newEvent);
		}
	}
开发者ID:ErickWendel,项目名称:vscode,代码行数:30,代码来源:viewModelDecorations.ts

示例2: _findMatchesInLine

	private static _findMatchesInLine(searchRegex: RegExp, text: string, lineNumber: number, deltaOffset: number, counter: number, result: FindMatch[], captureMatches: boolean, limitResultCount: number): number {
		let m: RegExpExecArray;
		// Reset regex to search from the beginning
		searchRegex.lastIndex = 0;
		do {
			m = searchRegex.exec(text);
			if (m) {
				const range = new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset);
				if (result.length > 0 && range.equalsRange(result[result.length - 1].range)) {
					// Exit early if the regex matches the same range
					return counter;
				}
				result.push(createFindMatch(range, m, captureMatches));
				counter++;
				if (counter >= limitResultCount) {
					return counter;
				}
				if (m.index + m[0].length === text.length) {
					// Reached the end of the line
					return counter;
				}
			}
		} while (m);
		return counter;
	}
开发者ID:fs814,项目名称:vscode,代码行数:25,代码来源:textModelSearch.ts

示例3: setCurrentFindMatch

	public setCurrentFindMatch(nextMatch:Range): number {
		let newCurrentDecorationId: string = null;
		let matchPosition = 0;
		if (nextMatch) {
			for (let i = 0, len = this._decorations.length; i < len; i++) {
				let range = this._editor.getModel().getDecorationRange(this._decorations[i]);
				if (nextMatch.equalsRange(range)) {
					newCurrentDecorationId = this._decorations[i];
					matchPosition = (i + 1);
					break;
				}
			}
		}

		if (this._highlightedDecorationId !== null || newCurrentDecorationId !== null) {
			this._editor.changeDecorations((changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => {
				if (this._highlightedDecorationId !== null) {
					changeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations.createFindMatchDecorationOptions(false));
					this._highlightedDecorationId = null;
				}
				if (newCurrentDecorationId !== null) {
					this._highlightedDecorationId = newCurrentDecorationId;
					changeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations.createFindMatchDecorationOptions(true));
				}
			});
		}

		return matchPosition;
	}
开发者ID:AjuanM,项目名称:vscode,代码行数:29,代码来源:findDecorations.ts

示例4: _assertCheck

function _assertCheck(checker:lint.SimpleStyleRuleChecker, sourceFile:ts.SourceFile, numbers:number[]):void {

	var expected:EditorCommon.IRange[] = [];

	for(var i = 0, len = numbers.length; i < len - 1; i+=2) {
		expected.push({
			startLineNumber: 1,
			startColumn: 1 + numbers[i],
			endLineNumber: 1,
			endColumn: 1 + numbers[i] + numbers[i + 1]
		});
	}

	var actual = checker.check(sourceFile);

	assert.equal(actual.length, expected.length);

	if(actual.length !== expected.length) {
		assert.ok(false, String(actual));
		return;
	}

	while(actual.length > 0) {
		var _expected  = expected.pop(),
			_actual = actual.pop().range;

		assert.ok(Range.equalsRange(_expected, _actual), JSON.stringify(_expected) + JSON.stringify(_actual));
	}
}
开发者ID:578723746,项目名称:vscode,代码行数:29,代码来源:lint.test.ts

示例5: equals

	public equals(other: SingleCursorState) {
		return (
			this.selectionStartLeftoverVisibleColumns === other.selectionStartLeftoverVisibleColumns
			&& this.leftoverVisibleColumns === other.leftoverVisibleColumns
			&& this.position.equals(other.position)
			&& this.selectionStart.equalsRange(other.selectionStart)
		);
	}
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:8,代码来源:cursorCommon.ts

示例6:

		thisModel.onDidChangeDecorations((e) => {
			listenerCalled++;
			assert.equal(e.ids.length, 1);
			assert.equal(e.addedOrChangedDecorations.length, 1);
			assert.ok(Range.equalsRange(e.addedOrChangedDecorations[0].range, {
				startLineNumber: 1,
				startColumn: 8,
				endLineNumber: 3,
				endColumn: 2
			}));
			assert.ok(Range.equalsRange(e.oldRanges[decId], {
				startLineNumber: 1,
				startColumn: 2,
				endLineNumber: 3,
				endColumn: 2
			}));
			assert.equal(e.removedDecorations.length, 0);
		});
开发者ID:1Hgm,项目名称:vscode,代码行数:18,代码来源:modelDecorations.test.ts

示例7: getCurrentMatchesPosition

	public getCurrentMatchesPosition(desiredRange:Range): number {
		for (let i = 0, len = this._decorations.length; i < len; i++) {
			let range = this._editor.getModel().getDecorationRange(this._decorations[i]);
			if (desiredRange.equalsRange(range)) {
				return (i + 1);
			}
		}
		return 1;
	}
开发者ID:GYGit,项目名称:vscode,代码行数:9,代码来源:findDecorations.ts

示例8: getDecorationsViewportData

	public getDecorationsViewportData(viewRange: Range): IDecorationsViewportData {
		let cacheIsValid = (this._cachedModelDecorationsResolver !== null);
		cacheIsValid = cacheIsValid && (viewRange.equalsRange(this._cachedModelDecorationsResolverViewRange));
		if (!cacheIsValid) {
			this._cachedModelDecorationsResolver = this._getDecorationsViewportData(viewRange);
			this._cachedModelDecorationsResolverViewRange = viewRange;
		}
		return this._cachedModelDecorationsResolver!;
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:9,代码来源:viewModelDecorations.ts

示例9:

		thisModel.addListener(EditorCommon.EventType.ModelDecorationsChanged, (e) => {
			listenerCalled++;
			assert.equal(e.ids.length, 1);
			assert.equal(e.addedOrChangedDecorations.length, 1);
			assert.ok(Range.equalsRange(e.addedOrChangedDecorations[0].range, {
				startLineNumber: 1,
				startColumn: 8,
				endLineNumber: 3,
				endColumn: 2
			}));
			assert.ok(Range.equalsRange(e.oldRanges[decId], {
				startLineNumber: 1,
				startColumn: 2,
				endLineNumber: 3,
				endColumn: 2
			}));
			assert.equal(e.removedDecorations.length, 0);
		});
开发者ID:ErickWendel,项目名称:vscode,代码行数:18,代码来源:modelDecorations.test.ts

示例10: _findLastMatchInLine

	private _findLastMatchInLine(searchRegex:RegExp, text:string, lineNumber:number): EditorCommon.IEditorRange {
		let bestResult: EditorCommon.IEditorRange = null;
		let m:RegExpExecArray;
		while ((m = searchRegex.exec(text))) {
			let result = new Range(lineNumber, m.index + 1, lineNumber, m.index + 1 + m[0].length);
			if (result.equalsRange(bestResult)) {
				break;
			}
			bestResult = result;
		}
		return bestResult;
	}
开发者ID:ErickWendel,项目名称:vscode,代码行数:12,代码来源:textModel.ts


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