本文整理汇总了TypeScript中vs/editor/common/model/textModel.TextModel.getLineMaxColumn方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TextModel.getLineMaxColumn方法的具体用法?TypeScript TextModel.getLineMaxColumn怎么用?TypeScript TextModel.getLineMaxColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/model/textModel.TextModel
的用法示例。
在下文中一共展示了TextModel.getLineMaxColumn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _doFindPreviousMatchMultiline
private static _doFindPreviousMatchMultiline(model: TextModel, searchStart: Position, searcher: Searcher, captureMatches: boolean): FindMatch {
const matches = this._doFindMatchesMultiline(model, new Range(1, 1, searchStart.lineNumber, searchStart.column), searcher, captureMatches, 10 * LIMIT_FIND_COUNT);
if (matches.length > 0) {
return matches[matches.length - 1];
}
const lineCount = model.getLineCount();
if (searchStart.lineNumber !== lineCount || searchStart.column !== model.getLineMaxColumn(lineCount)) {
// Try again with all content
return this._doFindPreviousMatchMultiline(model, new Position(lineCount, model.getLineMaxColumn(lineCount)), searcher, captureMatches);
}
return null;
}
示例2: findMatches
public static findMatches(model: TextModel, searchParams: SearchParams, searchRange: Range, captureMatches: boolean, limitResultCount: number): FindMatch[] {
const searchData = searchParams.parseSearchRequest();
if (!searchData) {
return [];
}
if (searchData.regex.multiline) {
if (searchData.regex.source === '\\n') {
// Fast path for searching for EOL
let result: FindMatch[] = [], resultLen = 0;
for (let lineNumber = 1, lineCount = model.getLineCount(); lineNumber < lineCount; lineNumber++) {
const range = new Range(lineNumber, model.getLineMaxColumn(lineNumber), lineNumber + 1, 1);
if (captureMatches) {
result[resultLen++] = new FindMatch(range, null);
} else {
result[resultLen++] = new FindMatch(range, ['\n']);
}
if (resultLen >= limitResultCount) {
break;
}
}
return result;
}
return this._doFindMatchesMultiline(model, searchRange, new Searcher(searchData.wordSeparators, searchData.regex), captureMatches, limitResultCount);
}
return this._doFindMatchesLineByLine(model, searchRange, searchData, captureMatches, limitResultCount);
}
示例3: test
test('insertion on empty line', () => {
const model = new TextModel('some text', TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
model._tokens._setTokens(0, 0, model.getLineMaxColumn(1) - 1, TestToken.toTokens([new TestToken(0, 1)]));
model.applyEdits([{
range: new Range(1, 1, 1, 10),
text: ''
}]);
model._tokens._setTokens(0, 0, model.getLineMaxColumn(1) - 1, new Uint32Array(0));
model.applyEdits([{
range: new Range(1, 1, 1, 1),
text: 'a'
}]);
const actualTokens = model.getLineTokens(1);
assertLineTokens(actualTokens, [new TestToken(0, 1)]);
});
示例4: testApplyEdits
function testApplyEdits(initial: IBufferLineState[], edits: IEdit[], expected: IBufferLineState[]): void {
const initialText = initial.map(el => el.text).join('\n');
const model = new TextModel(initialText, TextModel.DEFAULT_CREATION_OPTIONS, new LanguageIdentifier('test', 0));
for (let lineIndex = 0; lineIndex < initial.length; lineIndex++) {
const lineTokens = initial[lineIndex].tokens;
const lineTextLength = model.getLineMaxColumn(lineIndex + 1) - 1;
model._tokens._setTokens(0, lineIndex, lineTextLength, TestToken.toTokens(lineTokens));
}
model.applyEdits(edits.map((ed) => ({
identifier: null,
range: ed.range,
text: ed.text,
forceMoveMarkers: false
})));
for (let lineIndex = 0; lineIndex < expected.length; lineIndex++) {
const actualLine = model.getLineContent(lineIndex + 1);
const actualTokens = model.getLineTokens(lineIndex + 1);
assert.equal(actualLine, expected[lineIndex].text);
assertLineTokens(actualTokens, expected[lineIndex].tokens);
}
}