本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例10: getOutputPositionOfInputOffset
public getOutputPositionOfInputOffset(inputOffset: number): OutputPosition {
let r = this._prefixSums.getIndexOf(inputOffset);
return new OutputPosition(r.index, r.remainder);
}