Skip to content

Commit

Permalink
refactor: use subscribeAlways instead of subscribeEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
teixeira0x committed Dec 9, 2024
1 parent cd0ad58 commit cb4001d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ open class EditorActionsMenu(val editor: IDEEditor) :

open fun subscribe() {
receipts.add(
editor.subscribeEvent(SelectionChangeEvent::class.java) { event, _ ->
editor.subscribeAlways(SelectionChangeEvent::class.java) { event ->
this.onSelectionChanged(event)
}
)
receipts.add(editor.subscribeEvent(ScrollEvent::class.java) { _, _ -> this.onScrollEvent() })
receipts.add(editor.subscribeAlways(ScrollEvent::class.java) { this.onScrollEvent() })
receipts.add(
editor.subscribeEvent(HandleStateChangeEvent::class.java) { event, _ ->
editor.subscribeAlways(HandleStateChangeEvent::class.java) { event ->
this.onHandleStateChanged(event)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,23 +672,23 @@ open class IDEEditor @JvmOverloads constructor(

getComponent(EditorTextActionWindow::class.java).isEnabled = false

subscribeEvent(ContentChangeEvent::class.java) { event, _ ->
subscribeAlways(ContentChangeEvent::class.java) { event ->
if (isReleased) {
return@subscribeEvent
return@subscribeAlways
}

markModified()
file ?: return@subscribeEvent
file ?: return@subscribeAlways

editorScope.launch {
dispatchDocumentChangeEvent(event)
checkForSignatureHelp(event)
}
}

subscribeEvent(SelectionChangeEvent::class.java) { _, _ ->
subscribeAlways(SelectionChangeEvent::class.java) {
if (isReleased) {
return@subscribeEvent
return@subscribeAlways
}

if (_diagnosticWindow?.isShowing == true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public class SignatureHelpWindow extends BaseEditorWindow {
public SignatureHelpWindow(@NonNull IDEEditor editor) {
super(editor);

editor.subscribeEvent(
editor.subscribeAlways(
SelectionChangeEvent.class,
(event, unsubscribe) -> {
event -> {
if (isShowing()) {
dismiss();
}
Expand Down

0 comments on commit cb4001d

Please sign in to comment.