本文整理汇总了TypeScript中vs/workbench/parts/search/browser/searchResultsView.SearchSorter.compare方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SearchSorter.compare方法的具体用法?TypeScript SearchSorter.compare怎么用?TypeScript SearchSorter.compare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/workbench/parts/search/browser/searchResultsView.SearchSorter
的用法示例。
在下文中一共展示了SearchSorter.compare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('Sorter', function () {
let fileMatch1 = aFileMatch('C:\\foo');
let fileMatch2 = aFileMatch('C:\\with\\path');
let fileMatch3 = aFileMatch('C:\\with\\path\\foo');
let lineMatch1 = new Match(fileMatch1, 'bar', 1, 1, 1);
let lineMatch2 = new Match(fileMatch1, 'bar', 2, 1, 1);
let lineMatch3 = new Match(fileMatch1, 'bar', 2, 1, 1);
let s = new SearchSorter();
assert(s.compare(null, fileMatch1, fileMatch2) < 0);
assert(s.compare(null, fileMatch2, fileMatch1) > 0);
assert(s.compare(null, fileMatch1, fileMatch1) === 0);
assert(s.compare(null, fileMatch2, fileMatch3) < 0);
assert(s.compare(null, lineMatch1, lineMatch2) < 0);
assert(s.compare(null, lineMatch2, lineMatch1) > 0);
assert(s.compare(null, lineMatch2, lineMatch3) === 0);
});
示例2: test
test('Sorter', () => {
let fileMatch1 = aFileMatch('C:\\foo');
let fileMatch2 = aFileMatch('C:\\with\\path');
let fileMatch3 = aFileMatch('C:\\with\\path\\foo');
let lineMatch1 = new Match(fileMatch1, ['bar'], new OneLineRange(0, 1, 1), new OneLineRange(0, 1, 1));
let lineMatch2 = new Match(fileMatch1, ['bar'], new OneLineRange(0, 1, 1), new OneLineRange(2, 1, 1));
let lineMatch3 = new Match(fileMatch1, ['bar'], new OneLineRange(0, 1, 1), new OneLineRange(2, 1, 1));
let s = new SearchSorter();
assert(s.compare(null, fileMatch1, fileMatch2) < 0);
assert(s.compare(null, fileMatch2, fileMatch1) > 0);
assert(s.compare(null, fileMatch1, fileMatch1) === 0);
assert(s.compare(null, fileMatch2, fileMatch3) < 0);
assert(s.compare(null, lineMatch1, lineMatch2) < 0);
assert(s.compare(null, lineMatch2, lineMatch1) > 0);
assert(s.compare(null, lineMatch2, lineMatch3) === 0);
});
示例3: test
test('Sorter', function () {
let fileMatch1 = aFileMatch('C:\\foo');
let fileMatch2 = aFileMatch('C:\\with\\path');
let fileMatch3 = aFileMatch('C:\\with\\path\\foo');
let lineMatch1 = new Match(fileMatch1, new TextSearchResult('bar', new OneLineRange(0, 1, 1)));
let lineMatch2 = new Match(fileMatch1, new TextSearchResult('bar', new OneLineRange(2, 1, 1)));
let lineMatch3 = new Match(fileMatch1, new TextSearchResult('bar', new OneLineRange(2, 1, 1)));
let s = new SearchSorter();
assert(s.compare(null, fileMatch1, fileMatch2) < 0);
assert(s.compare(null, fileMatch2, fileMatch1) > 0);
assert(s.compare(null, fileMatch1, fileMatch1) === 0);
assert(s.compare(null, fileMatch2, fileMatch3) < 0);
assert(s.compare(null, lineMatch1, lineMatch2) < 0);
assert(s.compare(null, lineMatch2, lineMatch1) > 0);
assert(s.compare(null, lineMatch2, lineMatch3) === 0);
});