mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
testing: add new API sortText property to TestItem; if populated will be used instead of label for sorting items in Test Explorer tree and list view
This commit is contained in:
@@ -95,7 +95,7 @@ const testItemPropAccessor = <K extends keyof vscode.TestItem>(
|
||||
};
|
||||
};
|
||||
|
||||
type WritableProps = Pick<vscode.TestItem, 'range' | 'label' | 'description' | 'canResolveChildren' | 'busy' | 'error' | 'tags'>;
|
||||
type WritableProps = Pick<vscode.TestItem, 'range' | 'label' | 'description' | 'sortText' | 'canResolveChildren' | 'busy' | 'error' | 'tags'>;
|
||||
|
||||
const strictEqualComparator = <T>(a: T, b: T) => a === b;
|
||||
|
||||
@@ -107,6 +107,7 @@ const propComparators: { [K in keyof Required<WritableProps>]: (a: vscode.TestIt
|
||||
},
|
||||
label: strictEqualComparator,
|
||||
description: strictEqualComparator,
|
||||
sortText: strictEqualComparator,
|
||||
busy: strictEqualComparator,
|
||||
error: strictEqualComparator,
|
||||
canResolveChildren: strictEqualComparator,
|
||||
@@ -129,6 +130,7 @@ const makePropDescriptors = (api: IExtHostTestItemApi, label: string): { [K in k
|
||||
range: testItemPropAccessor(api, 'range', undefined, propComparators.range),
|
||||
label: testItemPropAccessor(api, 'label', label, propComparators.label),
|
||||
description: testItemPropAccessor(api, 'description', undefined, propComparators.description),
|
||||
sortText: testItemPropAccessor(api, 'sortText', undefined, propComparators.sortText),
|
||||
canResolveChildren: testItemPropAccessor(api, 'canResolveChildren', false, propComparators.canResolveChildren),
|
||||
busy: testItemPropAccessor(api, 'busy', false, propComparators.busy),
|
||||
error: testItemPropAccessor(api, 'error', undefined, propComparators.error),
|
||||
@@ -268,6 +270,7 @@ export class TestItemImpl implements vscode.TestItem {
|
||||
|
||||
public range!: vscode.Range | undefined;
|
||||
public description!: string | undefined;
|
||||
public sortText!: string | undefined;
|
||||
public label!: string;
|
||||
public error!: string | vscode.MarkdownString;
|
||||
public busy!: boolean;
|
||||
|
||||
Reference in New Issue
Block a user