JetBrains: Improve key handlers and handle alt+enter in the preview panel
Created by: philipp-spiess
Fixes #34893 (closed) Fixes #35920 (closed)
This PR fixes key handlers that currently sometimes get swallowed when the editor has focus. It seems that in this case, the manual swing listener never fires which leads me to believe that the editor has a custom key handling (necessary for the advanced text editing capabilities). To work around this, we now add a global key listener. However since these are global, we need to be careful to only respond to events if they happen in the right project. To do that, we check if the popover is active and shown. The test plan includes tests with two projects open side-by-side to ensure there are no issues in this setup.
Additionally, since I've restructured the key handler code in Java, it was easy for me to add support for alt+enter
when the editor is in focus as well.
Test plan
#34893 (closed)
Esc key doesn't work in the popuphttps://user-images.githubusercontent.com/458591/171192148-abe42042-2463-4a6a-b51f-66f28c458427.mov
#35920 (closed)
Option+Enter doesn’t work if the preview is focusedhttps://user-images.githubusercontent.com/458591/171194901-45e9276f-f2fb-4743-af47-571b83078c22.mov
Fixes https://github.com/sourcegraph/sourcegraph/issues/34893)
App preview:
Check out the client app preview documentation to learn more.