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


TypeScript TextModel.getLineMaxColumn方法代碼示例

本文整理匯總了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;
	}
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:14,代碼來源:textModelSearch.ts

示例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);
	}
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:28,代碼來源:textModelSearch.ts

示例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)]);
	});
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:19,代碼來源:model.line.test.ts

示例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);
		}
	}
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:23,代碼來源:model.line.test.ts


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