-
Notifications
You must be signed in to change notification settings - Fork 341
Adds a basic dialog for opening a file #3342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
One thing I'm still trying to figure out is why I'm seeing the error (below). It shows up when the dialog is first opened, and the autocomplete overlay is opened. Everything still seems to work as intended despite the error. If I only show the autocomplete results once a user has entered a query, then there is no error.
|
This means that setState is being called (or a ValueNotifer's value changed, which inherently calls setState), while the tree is building. This is only legal if the widget trying to be marked as needing to build (Overlay) has an ancestor that is already building. The Overlay however, is probably very high up in the widget tree, so it does not have any ancestors that are building in the current build phase. So I'd try to track down which setState call or value notifier change is occurring while a build is in progress. Looks like it is whatever is triggering the the Overlay widget to be marked as needing to build while the Container widget is already building. |
searchFieldKey: fileSearchFieldKey, | ||
searchFieldEnabled: true, | ||
shouldRequestFocus: true, | ||
closeOverlayOnEscape: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be true? I would think we'd want to give the user the ability to close the dialog from keyboard. Closing the dialog on Escape matches IntelliJ's open file dialog behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skips closing the autocomplete overlay. So ESC will close the dialog (otherwise a user first has to click ESC to close the autocomplete results, then click ESC again to close the dialog)
List<ScriptRef> scriptRefs, | ||
) { | ||
if (query.isEmpty) { | ||
takeTopMatches(scriptRefs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be returning this value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.where((scriptRef) => scriptRef.uri.caseInsensitiveFuzzyMatch(query)) | ||
.toList(); | ||
|
||
return takeTopMatches([...exactMatches, ...fuzzyMatches, ...scriptRefs]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we still be including scriptRefs here? If none match the query, I think we should have empty results. This matches the open file behavior in IntelliJ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, changed so that we return don't return any files if there is no match
|
||
_autoCompleteController.selectTheSearch = true; | ||
SchedulerBinding.instance.addPostFrameCallback((_) => _handleSearch()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment explaining why this needs to be in a post frame callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks!
This is working towards #3075.
The dialog is currently hidden behind a hard coded boolean until it's more polished and has tests.
The dialog can be opened with ⌘ P or from the codeview menu.
Demo opening the dialog with ⌘ P:
Demo opening the dialog from the menu: