mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
fix formatter finding
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: '/'
|
||||
|
||||
Reference in New Issue
Block a user