提交 e0f12720 编写于 作者: B Benjamin Pasero

clarify why a resource can be null in comments

上级 c66373be
......@@ -266,7 +266,8 @@ export class OpenAnythingHandler extends QuickOpenHandler {
}
// Check if this entry is a match for the search value
let targetToMatch = searchInPath && entry.getResource() ? labels.getPathLabel(entry.getResource(), this.contextService) : entry.getLabel();
const resource = entry.getResource(); // can be null for symbol results!
let targetToMatch = searchInPath && resource ? labels.getPathLabel(resource, this.contextService) : entry.getLabel();
if (!filters.matchesFuzzy(searchValue, targetToMatch, this.fuzzyMatchingEnabled)) {
continue;
}
......@@ -311,10 +312,12 @@ export class OpenAnythingHandler extends QuickOpenHandler {
return labelAScore > labelBScore ? -1 : 1;
}
// Score on full resource path comes next
if (elementA.getResource() && elementB.getResource()) {
const resourceAScore = scorer.score(elementA.getResource().fsPath, lookFor, this.scorerCache);
const resourceBScore = scorer.score(elementB.getResource().fsPath, lookFor, this.scorerCache);
// Score on full resource path comes next (can be null for symbols!)
let resourceA = elementA.getResource();
let resourceB = elementB.getResource();
if (resourceA && resourceB) {
const resourceAScore = scorer.score(resourceA.fsPath, lookFor, this.scorerCache);
const resourceBScore = scorer.score(resourceB.fsPath, lookFor, this.scorerCache);
// Useful for understanding the scoring
// elementA.setPrefix(elementA.getPrefix() + ' ' + resourceAScore + ': ');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册