Skip to content

JetBrains: Improve key handlers and handle alt+enter in the preview panel

Warren Gifford requested to merge ps/jetbrains-key-listener-fixes into main

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

Esc key doesn't work in the popup #34893 (closed)

https://user-images.githubusercontent.com/458591/171192148-abe42042-2463-4a6a-b51f-66f28c458427.mov

Option+Enter doesn’t work if the preview is focused #35920 (closed)

https://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.

Merge request reports

Loading