mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from master
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. 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';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
|
||||
export interface IHighlight {
|
||||
start: number;
|
||||
@@ -22,7 +22,7 @@ export class HighlightedLabel implements IDisposable {
|
||||
private highlights: IHighlight[];
|
||||
private didEverRender: boolean;
|
||||
|
||||
constructor(container: HTMLElement) {
|
||||
constructor(container: HTMLElement, private supportOcticons: boolean) {
|
||||
this.domNode = document.createElement('span');
|
||||
this.domNode.className = 'monaco-highlighted-label';
|
||||
this.didEverRender = false;
|
||||
@@ -69,19 +69,22 @@ export class HighlightedLabel implements IDisposable {
|
||||
}
|
||||
if (pos < highlight.start) {
|
||||
htmlContent.push('<span>');
|
||||
htmlContent.push(renderOcticons(this.text.substring(pos, highlight.start)));
|
||||
const substring = this.text.substring(pos, highlight.start);
|
||||
htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
|
||||
htmlContent.push('</span>');
|
||||
pos = highlight.end;
|
||||
}
|
||||
htmlContent.push('<span class="highlight">');
|
||||
htmlContent.push(renderOcticons(this.text.substring(highlight.start, highlight.end)));
|
||||
const substring = this.text.substring(highlight.start, highlight.end);
|
||||
htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
|
||||
htmlContent.push('</span>');
|
||||
pos = highlight.end;
|
||||
}
|
||||
|
||||
if (pos < this.text.length) {
|
||||
htmlContent.push('<span>');
|
||||
htmlContent.push(renderOcticons(this.text.substring(pos)));
|
||||
const substring = this.text.substring(pos);
|
||||
htmlContent.push(this.supportOcticons ? renderOcticons(substring) : escape(substring));
|
||||
htmlContent.push('</span>');
|
||||
}
|
||||
|
||||
@@ -91,8 +94,8 @@ export class HighlightedLabel implements IDisposable {
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.text = null;
|
||||
this.highlights = null;
|
||||
this.text = null!; // StrictNullOverride: nulling out ok in dispose
|
||||
this.highlights = null!; // StrictNullOverride: nulling out ok in dispose
|
||||
}
|
||||
|
||||
static escapeNewLines(text: string, highlights: IHighlight[]): string {
|
||||
|
||||
Reference in New Issue
Block a user