fix(editor): Make AI Agent appear before Magento 2 when typing agent (#15302)

This commit is contained in:
Charlie Kolb
2025-05-12 17:06:19 +02:00
committed by GitHub
parent cd2e2dc8d9
commit d683a54da0
2 changed files with 8 additions and 3 deletions
@@ -2,8 +2,13 @@ import topLevel from './snapshots/toplevel.snapshot.json';
import { sublimeSearch } from './sublimeSearch';
describe('sublimeSearch', () => {
describe('search finds at least one match', () => {
const testCases: Array<[string, string[]]> = [['agent', ['Magento 2', 'AI Agent']]];
describe('search finds specific matches first', () => {
// Note that this only tests the order of the specified matches
// Further results may appear after the listed ones
const testCases: Array<[string, string[]]> = [
['set', ['Edit Fields (Set)']],
['agent', ['AI Agent', 'Magento 2']],
];
test.each(testCases)(
'should return at least "$expectedOrder" for filter "$filter"',
@@ -4,7 +4,7 @@
*/
const SEQUENTIAL_BONUS = 60; // bonus for adjacent matches
const SEPARATOR_BONUS = 30; // bonus if match occurs after a separator
const SEPARATOR_BONUS = 38; // bonus if match occurs after a separator
const CAMEL_BONUS = 30; // bonus if match is uppercase and prev is lower
const FIRST_LETTER_BONUS = 15; // bonus if the first letter is matched