-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix bug #1627 ("Go to Definition" prepopulated text doesn't work via menu) #1864
Conversation
activated via menu) -- There are two problems at play. First, smart-autocomplete only listens for key events, not programmatic or other textfield changes, so we need to kick it to generate results for the prepopulated text. Second, the results are generated asynchronously while QuickOpen's auto-"focus" is synchronous. That bug is not fixed here since it's related to a whole tangle of async issues in #1855. Fixing the first bug alone means that hitting Enter now goes to the correct result (instead of doing nothing), but that the editor doesn't auto-scroll to that result as soon as the search bar is opened. This commit also cleans up QuickOpen to use KeyEvent consts for key codes.
Here's what I'm seeing:
Is this the intended behavior? Seems like 4 would be easy to fix by calling ViewUtils.scrollElementIntoView() or something equivalent. |
Hmm, I hadn't noticed the scrolling problem before. We're doing the exact same thing in both cases 1 and 4 -- just setting the selection, which normally scrolls it into view automatically. Might be a CodeMirror bug... investigating now. |
The scrolling bug appears to be a regression due to all the focusedEditorChange changes that occurred this sprint -- in particular, the issues described in #1860. Any time an editor regains focus, this event is dispatched spuriously, and it causes the editor state to get blown away and refreshed three times. The refresh() essentially blows away the pending scroll position change that was just set by the Quick Open bar before it gave focus back to the editor. |
* Revert main-editor-swapping codepath back to how it used to work, mostly disentangled from focus events. * Don't fire focusedEditorChanged on the many times focus returns to the same Editor that had it last (due to window reactivation, closing a dialog, closing a search bar, etc.). All the current use cases for this event don't care about those cases. Add more detailed docs on event cases. * Simplify how Editor signals focus: trigger only from "onFocus" (a superset of the other case), and remove _internalFocus flag that was guarding against the overlap. * Don't call resizeEditor() on every editor swap just because statusbar *might* have been shown/hidden: only call when statusbar actually did change (going to/from no editor). Fixes scrolling issue in #1864. #1257 still isn't 100% fixed: there are at least two cases where getFocusedEditor() lags behind the focusedEditorChanged event: opening an inline editor; and moving focus from open inline editor to its host editor. These same cases - and a number of others - were broken before this change, however.
Merging. |
Fix bug #1627 ("Go to Definition" prepopulated text doesn't work via menu)
Fix bug #1627 ("Go to Definition" prepopulated text doesn't work when activated via menu)
See my comment in the bug for details.
This also contains a minor cleanup to use KeyEvent consts for key codes.