<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import { IDisposable } from 'vs/base/common/lifecycle';
import * as dom from 'vs/base/browser/dom';
import * as objects from 'vs/base/common/objects';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';

export interface IHighlight {
	start: number;
	end: number;
}

export class HighlightedLabel implements IDisposable {

	private domNode: HTMLElement;
	private text: string;
	private title: string;
	private highlights: IHighlight[];
	private didEverRender: boolean;

	constructor(container: HTMLElement) {
		this.domNode = document.createElement('span');
		this.domNode.className = 'monaco-highlighted-label';
		this.didEverRender = false;
		container.appendChild(this.domNode);
	}

	get element(): HTMLElement {
		return this.domNode;
	}

	set(text: string, highlights: IHighlight[] = [], title?: string) {
		if (!text) {
			text = '';
		}
		if (!title) {
			title = text;
		}
		if (this.didEverRender && this.text === text && this.title === title && objects.equals(this.highlights, highlights)) {
			return;
		}

		if (!Array.isArray(highlights)) {
			highlights = [];
		}

		this.text = text;
		this.title = title || text;
		this.highlights = highlights;<commit_msg>fix #50867<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import { IDisposable } from 'vs/base/common/lifecycle';
import * as dom from 'vs/base/browser/dom';
import * as objects from 'vs/base/common/objects';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';

export interface IHighlight {
	start: number;
	end: number;
}

export class HighlightedLabel implements IDisposable {

	private domNode: HTMLElement;
	private text: string;
	private title: string;
	private highlights: IHighlight[];
	private didEverRender: boolean;

	constructor(container: HTMLElement) {
		this.domNode = document.createElement('span');
		this.domNode.className = 'monaco-highlighted-label';
		this.didEverRender = false;
		container.appendChild(this.domNode);
	}

	get element(): HTMLElement {
		return this.domNode;
	}

	set(text: string, highlights: IHighlight[] = [], title: string = '') {
		if (!text) {
			text = '';
		}
		if (this.didEverRender && this.text === text && this.title === title && objects.equals(this.highlights, highlights)) {
			return;
		}

		if (!Array.isArray(highlights)) {
			highlights = [];
		}

		this.text = text;
		this.title = title;
		this.highlights = highlights;
{'fraction_non_alphanumeric': 0.2354073123797306, 'fraction_numerical': 0.001603592046183451, 'mean_word_length': 2.488814317673378, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4635649', 'n_tokens_mistral': 924, 'n_tokens_neox': 857, 'n_words': 225}