Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Adds multi-token file search, and prioritizes file name matches over full path matches#3582

Merged
elliette merged 3 commits intoflutter:masterfrom
elliette:multitokensearch
Jan 24, 2022
Merged

Adds multi-token file search, and prioritizes file name matches over full path matches#3582
elliette merged 3 commits intoflutter:masterfrom
elliette:multitokensearch

Conversation

@elliette
Copy link
Member

Work towards#3554

This PR makes two changes to the existing file search:

  1. Adds the ability for a user to do a multi-token search, eg."devtools_app file search"
  2. Prioritizes matches on the file name over the full path, e.g. for query"debugger",devtools/debugger.dart is shown beforedebugger/file_search.dart

if (isEmpty) return AutoCompleteMatch(script.uri);

final fileName = _fileName(script.uri);
final fileNameIdx = script.uri.lastIndexOf(fileName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nit: rename tofileNameIndex. When I first read this, I thought it wasfileNameId with a typo

_findFuzzySegments(script.uri, query.replaceAll(' ', ''));
} else {
final fileName = _fileName(script.uri);
final fileNameIdx = script.uri.lastIndexOf(fileName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nit: same naming comment as above

final start = file.indexOf(token);
final end = start + token.length;
autoCompleteResultSegments.add(Range(start, end));
matchedSegments.addAll(autoCompleteResultSegments);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

instead of creating theautoCompleteResultSegments variable, you can just add the Range tomatchedSegments directly:

matchedSegments.addd(Range(start, end));

@ellietteelliette merged commit4f5ae71 intoflutter:masterJan 24, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kenzieschmollkenzieschmollkenzieschmoll approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@elliette@kenzieschmoll

[8]ページ先頭

©2009-2026 Movatter.jp