src/vs/editor/common/model/tokenizationTextModelPart.ts/TokenizationTextModelPart/_findLanguageBoundaries
class TokenizationTextModelPart:	private static _findLanguageBoundaries(
		lineTokens: LineTokens,
		tokenIndex: number
	): [number, number] {
		const languageId = lineTokens.getLanguageId(tokenIndex);

		// go left until a different language is hit
		let startOffset = 0;
		for (
			let i = tokenIndex;
			i >= 0 && lineTokens.getLanguageId(i) === languageId;
			i--
		) {
			startOffset = lineTokens.getStartOffset(i);
		}

		// go right until a different language is hit
		let endOffset = lineTokens.getLineContent().length;
		for (
			let i = tokenIndex, tokenCount = lineTokens.getCount();
			i < tokenCount && lineTokens.getLanguageId(i) === languageId;
			i++
		) {
			endOffset = lineTokens.getEndOffset(i);
		}

		return [startOffset, endOffset];
	}