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


TypeScript nullMode.nullTokenize2函數代碼示例

本文整理匯總了TypeScript中vs/editor/common/modes/nullMode.nullTokenize2函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript nullTokenize2函數的具體用法?TypeScript nullTokenize2怎麽用?TypeScript nullTokenize2使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: _updateTokensUntilLine

	public _updateTokensUntilLine(buffer: ITextBuffer, eventBuilder: ModelTokensChangedEventBuilder, lineNumber: number): void {
		if (!this.tokenizationSupport) {
			this._invalidLineStartIndex = buffer.getLineCount();
			return;
		}

		const linesLength = buffer.getLineCount();
		const endLineIndex = lineNumber - 1;

		// Validate all states up to and including endLineIndex
		for (let lineIndex = this._invalidLineStartIndex; lineIndex <= endLineIndex; lineIndex++) {
			const endStateIndex = lineIndex + 1;
			let r: TokenizationResult2 = null;
			const text = buffer.getLineContent(lineIndex + 1);

			try {
				// Tokenize only the first X characters
				let freshState = this._getState(lineIndex).clone();
				r = this.tokenizationSupport.tokenize2(text, freshState, 0);
			} catch (e) {
				onUnexpectedError(e);
			}

			if (!r) {
				r = nullTokenize2(this.languageIdentifier.id, text, this._getState(lineIndex), 0);
			}
			this._setTokens(this.languageIdentifier.id, lineIndex, text.length, r.tokens);
			eventBuilder.registerChangedTokens(lineIndex + 1);
			this._setIsInvalid(lineIndex, false);

			if (endStateIndex < linesLength) {
				if (this._getState(endStateIndex) !== null && r.endState.equals(this._getState(endStateIndex))) {
					// The end state of this line remains the same
					let nextInvalidLineIndex = lineIndex + 1;
					while (nextInvalidLineIndex < linesLength) {
						if (this._isInvalid(nextInvalidLineIndex)) {
							break;
						}
						if (nextInvalidLineIndex + 1 < linesLength) {
							if (this._getState(nextInvalidLineIndex + 1) === null) {
								break;
							}
						} else {
							if (this._lastState === null) {
								break;
							}
						}
						nextInvalidLineIndex++;
					}
					this._invalidLineStartIndex = Math.max(this._invalidLineStartIndex, nextInvalidLineIndex);
					lineIndex = nextInvalidLineIndex - 1; // -1 because the outer loop increments it
				} else {
					this._setState(endStateIndex, r.endState);
				}
			} else {
				this._lastState = r.endState;
			}
		}
		this._invalidLineStartIndex = Math.max(this._invalidLineStartIndex, endLineIndex + 1);
	}
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:60,代碼來源:textModelTokens.ts

示例2: _tokenizeText

	public _tokenizeText(buffer: ITextBuffer, text: string, state: IState): TokenizationResult2 {
		let r: TokenizationResult2 = null;

		try {
			r = this.tokenizationSupport.tokenize2(text, state, 0);
		} catch (e) {
			onUnexpectedError(e);
		}

		if (!r) {
			r = nullTokenize2(this.languageIdentifier.id, text, state, 0);
		}
		return r;
	}
開發者ID:AllureFer,項目名稱:vscode,代碼行數:14,代碼來源:textModelTokens.ts

示例3: nullTokenize2

		tokenize2: (buffer: string, state: IState, deltaOffset: number) => nullTokenize2(LanguageId.Null, buffer, state, deltaOffset)
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:1,代碼來源:textToHtmlTokenizer.ts


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