|
@@ -264,10 +264,11 @@ class CompleterModel implements CompleterWidget.IModel {
|
|
for (let option of options) {
|
|
for (let option of options) {
|
|
let match = StringExt.matchSumOfSquares(option, query);
|
|
let match = StringExt.matchSumOfSquares(option, query);
|
|
if (match) {
|
|
if (match) {
|
|
|
|
+ let marked = StringExt.highlight(option, match.indices, Private.mark);
|
|
results.push({
|
|
results.push({
|
|
raw: option,
|
|
raw: option,
|
|
score: match.score,
|
|
score: match.score,
|
|
- text: StringExt.highlight(option, match.indices, this._mark).join('')
|
|
|
|
|
|
+ text: marked.join('')
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -276,13 +277,6 @@ class CompleterModel implements CompleterWidget.IModel {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Mark a highlighted chunk of text.
|
|
|
|
- */
|
|
|
|
- private _mark(value: string): string {
|
|
|
|
- return `<mark>${value}</mark>`;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Reset the state of the model.
|
|
* Reset the state of the model.
|
|
*/
|
|
*/
|
|
@@ -333,6 +327,14 @@ namespace Private {
|
|
text: string;
|
|
text: string;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Mark a highlighted chunk of text.
|
|
|
|
+ */
|
|
|
|
+ export
|
|
|
|
+ function mark(value: string): string {
|
|
|
|
+ return `<mark>${value}</mark>`;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* A sort comparison function for item match scores.
|
|
* A sort comparison function for item match scores.
|
|
*
|
|
*
|