diff --git a/examples/api-tests/src/file-search.spec.js b/examples/api-tests/src/file-search.spec.js index 76eac1d3c09e8..cef044eb44a1b 100644 --- a/examples/api-tests/src/file-search.spec.js +++ b/examples/api-tests/src/file-search.spec.js @@ -58,8 +58,8 @@ describe('file-search', function () { }); it('should not place very good matches above exact matches', () => { - const exactMatch = 'aa_bb_cc_dd.file'; - const veryGoodMatch = 'aa_bb_cc_ed_fd.file'; + const exactMatch = 'almost_absurdly_long_file_name_with_many_parts.file'; + const veryGoodMatch = 'almost_absurdly_long_file_name_with_many_parts_plus_one.file'; quickFileOpenService['filterAndRange'] = { filter: exactMatch }; /** @type import ('@theia/file-search/lib/browser/quick-file-open').FileQuickPickItem*/ const a = { label: exactMatch, uri: new Uri.default(exactMatch) }; diff --git a/packages/file-search/src/browser/quick-file-open.ts b/packages/file-search/src/browser/quick-file-open.ts index 7c63bf88e54ea..acc4164f4b0f7 100644 --- a/packages/file-search/src/browser/quick-file-open.ts +++ b/packages/file-search/src/browser/quick-file-open.ts @@ -19,7 +19,7 @@ import { OpenerService, KeybindingRegistry, QuickAccessRegistry, QuickAccessProv import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service'; import URI from '@theia/core/lib/common/uri'; import { FileSearchService, WHITESPACE_QUERY_SEPARATOR } from '../common/file-search-service'; -import { CancellationToken, Command, nls, MAX_SAFE_INTEGER } from '@theia/core/lib/common'; +import { CancellationToken, Command, nls } from '@theia/core/lib/common'; import { LabelProvider } from '@theia/core/lib/browser/label-provider'; import { NavigationLocationService } from '@theia/editor/lib/browser/navigation/navigation-location-service'; import * as fuzzy from '@theia/core/shared/fuzzy'; @@ -245,7 +245,7 @@ export class QuickFileOpenService implements QuickAccessProvider { // Check fuzzy matches. const fuzzyMatch = fuzzy.match(queryJoin, str) ?? { score: 0 }; if (fuzzyMatch.score === Infinity && exactMatch) { - return MAX_SAFE_INTEGER; + return Number.MAX_SAFE_INTEGER; } return fuzzyMatch.score + partialMatches + (exactMatch ? QuickFileOpenService.Scores.exact : 0);