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


TypeScript PrefixSumComputer.getIndexOf方法代碼示例

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


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

示例1: getRangeAt

	public getRangeAt(offset: number, length: number): Range {
		const startResult = this._lineStarts.getIndexOf(offset);
		const startLineLength = this._lines[startResult.index].length;
		const startColumn = Math.min(startResult.remainder + 1, startLineLength + 1);

		const endResult = this._lineStarts.getIndexOf(offset + length);
		const endLineLength = this._lines[endResult.index].length;
		const endColumn = Math.min(endResult.remainder + 1, endLineLength + 1);

		return new Range(startResult.index + 1, startColumn, endResult.index + 1, endColumn);
	}
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:11,代碼來源:linesTextBuffer.ts

示例2: getOutputLineTokens

	public getOutputLineTokens(outputLineNumber: number, inaccurateTokensAcceptable: boolean): editorCommon.IViewLineTokens {
		this._ensureValidState();
		this.prefixSumComputer.getIndexOf(outputLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		return this.lines[lineIndex].getOutputLineTokens(this.model, lineIndex + 1, remainder, inaccurateTokensAcceptable);
	}
開發者ID:pieandcakes,項目名稱:vscode,代碼行數:8,代碼來源:splitLinesCollection.ts

示例3: getOutputLineMaxColumn

	public getOutputLineMaxColumn(outputLineNumber: number): number {
		this._ensureValidState();
		this.prefixSumComputer.getIndexOf(outputLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		return this.lines[lineIndex].getOutputLineMaxColumn(this.model, lineIndex + 1, remainder);
	}
開發者ID:pieandcakes,項目名稱:vscode,代碼行數:8,代碼來源:splitLinesCollection.ts

示例4: getOutputLineTokens

	public getOutputLineTokens(outputLineNumber: number): editorCommon.ViewLineTokens {
		this._ensureValidState();
		outputLineNumber = this._toValidOutputLineNumber(outputLineNumber);
		let r = this.prefixSumComputer.getIndexOf(outputLineNumber - 1);
		let lineIndex = r.index;
		let remainder = r.remainder;

		return this.lines[lineIndex].getOutputLineTokens(this.model, lineIndex + 1, remainder);
	}
開發者ID:1833183060,項目名稱:vscode,代碼行數:9,代碼來源:splitLinesCollection.ts

示例5: getOutputLineMaxColumn

	public getOutputLineMaxColumn(outputLineNumber: number): number {
		this._ensureValidState();
		outputLineNumber = this._toValidOutputLineNumber(outputLineNumber);
		let r = this.prefixSumComputer.getIndexOf(outputLineNumber - 1);
		let lineIndex = r.index;
		let remainder = r.remainder;

		return this.lines[lineIndex].getOutputLineMaxColumn(this.model, lineIndex + 1, remainder);
	}
開發者ID:1833183060,項目名稱:vscode,代碼行數:9,代碼來源:splitLinesCollection.ts

示例6: getOutputLineContent

	public getOutputLineContent(outputLineNumber: number): string {
		this._ensureValidState();
		outputLineNumber = this._toValidOutputLineNumber(outputLineNumber);
		this.prefixSumComputer.getIndexOf(outputLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		return this.lines[lineIndex].getOutputLineContent(this.model, lineIndex + 1, remainder);
	}
開發者ID:578723746,項目名稱:vscode,代碼行數:9,代碼來源:splitLinesCollection.ts

示例7: convertOutputPositionToInputPosition

	public convertOutputPositionToInputPosition(viewLineNumber: number, viewColumn: number): editorCommon.IEditorPosition {
		this._ensureValidState();
		this.prefixSumComputer.getIndexOf(viewLineNumber - 1, this.tmpIndexOfResult);
		var lineIndex = this.tmpIndexOfResult.index;
		var remainder = this.tmpIndexOfResult.remainder;

		var inputColumn = this.lines[lineIndex].getInputColumnOfOutputPosition(remainder, viewColumn);
//		console.log('out -> in ' + viewLineNumber + ',' + viewColumn + ' ===> ' + (lineIndex+1) + ',' + inputColumn);
		return new Position(lineIndex+1, inputColumn);
	}
開發者ID:pieandcakes,項目名稱:vscode,代碼行數:10,代碼來源:splitLinesCollection.ts

示例8: getPositionAt

	public getPositionAt(offset: number): Position {
		offset = Math.floor(offset);
		offset = Math.max(0, offset);

		let out = this._lineStarts.getIndexOf(offset);

		let lineLength = this._lines[out.index].length;

		// Ensure we return a valid position
		return new Position(out.index + 1, Math.min(out.remainder + 1, lineLength + 1));
	}
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:11,代碼來源:linesTextBuffer.ts

示例9: convertOutputPositionToInputPosition

	public convertOutputPositionToInputPosition(viewLineNumber: number, viewColumn: number): editorCommon.IEditorPosition {
		this._ensureValidState();
		viewLineNumber = this._toValidOutputLineNumber(viewLineNumber);

		let r = this.prefixSumComputer.getIndexOf(viewLineNumber - 1);
		let lineIndex = r.index;
		let remainder = r.remainder;

		let inputColumn = this.lines[lineIndex].getInputColumnOfOutputPosition(remainder, viewColumn);
		// console.log('out -> in ' + viewLineNumber + ',' + viewColumn + ' ===> ' + (lineIndex+1) + ',' + inputColumn);
		return this.model.validatePosition(new Position(lineIndex+1, inputColumn));
	}
開發者ID:1833183060,項目名稱:vscode,代碼行數:12,代碼來源:splitLinesCollection.ts

示例10: getOutputPositionOfInputOffset

	public getOutputPositionOfInputOffset(inputOffset: number): OutputPosition {
		let r = this._prefixSums.getIndexOf(inputOffset);
		return new OutputPosition(r.index, r.remainder);
	}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:4,代碼來源:characterHardWrappingLineMapper.ts


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