fix formatter finding

This commit is contained in:
isidor
2019-01-18 15:19:23 +01:00
parent 2494a5f3cb
commit f20fb4e7c9
2 changed files with 3 additions and 3 deletions

View File

@@ -107,7 +107,7 @@ export class LabelService implements ILabelService {
this.formatters.forEach(formatter => {
if (formatter.scheme === resource.scheme) {
if (!bestResult) {
if (!bestResult && !formatter.authority) {
bestResult = formatter;
return;
}
@@ -115,7 +115,7 @@ export class LabelService implements ILabelService {
return;
}
if (match(formatter.authority, resource.authority) && (!bestResult.authority || formatter.authority.length > bestResult.authority.length)) {
if (match(formatter.authority, resource.authority) && (!bestResult || !bestResult.authority || formatter.authority.length > bestResult.authority.length)) {
bestResult = formatter;
}
}

View File

@@ -70,7 +70,7 @@ suite('URI Label', () => {
test('mulitple authority', function () {
labelService.registerFormatter({
scheme: 'vscode',
authority: 'micro*',
authority: 'not_matching_but_long',
formatting: {
label: 'first',
separator: '/'