提交 8ac83276 编写于 作者: B Benjamin Pasero

Use same highlighting strategy for fuzzy and full path search (fixes #1293, fixes #1294)

上级 0e6a5960
......@@ -188,16 +188,16 @@ export class QuickOpenEntry {
// Highlight file aware
if (entry.getResource()) {
// Fuzzy: Highlight is special
if (fuzzyHighlight) {
let candidateLabelHighlights = Filters.matchesFuzzy(lookFor, entry.getLabel(), true);
// Fuzzy/Full-Path: Highlight is special
if (fuzzyHighlight || lookFor.indexOf(Paths.nativeSep) >= 0) {
let candidateLabelHighlights = Filters.matchesFuzzy(lookFor, entry.getLabel(), fuzzyHighlight);
if (!candidateLabelHighlights) {
const pathPrefix = entry.getDescription() ? (entry.getDescription() + Paths.nativeSep) : '';
const pathPrefixLength = pathPrefix.length;
// If there are no highlights in the label, build a path out of description and highlight and match on both,
// then extract the individual label and description highlights back to the original positions
let pathHighlights = Filters.matchesFuzzy(lookFor, pathPrefix + entry.getLabel(), true);
let pathHighlights = Filters.matchesFuzzy(lookFor, pathPrefix + entry.getLabel(), fuzzyHighlight);
if (pathHighlights) {
pathHighlights.forEach(h => {
......@@ -223,17 +223,6 @@ export class QuickOpenEntry {
}
}
// Path search: Highlight in label and description
else if (lookFor.indexOf(Paths.nativeSep) >= 0) {
descriptionHighlights = Filters.matchesFuzzy(Strings.trim(lookFor, Paths.nativeSep), entry.getDescription());
// If we have no highlights, assume that the match is split among name and parent folder
if (!descriptionHighlights || !descriptionHighlights.length) {
labelHighlights = Filters.matchesFuzzy(Paths.basename(lookFor), entry.getLabel());
descriptionHighlights = Filters.matchesFuzzy(Strings.trim(Paths.dirname(lookFor), Paths.nativeSep), entry.getDescription());
}
}
// Highlight only inside label
else {
labelHighlights = Filters.matchesFuzzy(lookFor, entry.getLabel());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册