Skip to content
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

[Feature Request] Event listener for when findController is opened/closed #4676

Open
2 tasks done
nmandel opened this issue Sep 11, 2024 · 0 comments
Open
2 tasks done
Labels
feature-request Request for new features or functionality

Comments

@nmandel
Copy link

nmandel commented Sep 11, 2024

Context

  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

This is in reference to the Find/Replace widget:

image

Ask

We'd like a built-in event listener to hook into that fires when the widget is opened and closed (e.g. onFindWidgetOpen, onFindWidgetClose)

Use case

We have an extra button outside the editor that should be able to open and close the find widget. This button's background will also change depending on whether the widget is open.

We're able to use editor.getAction("actions.find").run(); to open the widget and editor.getContribution("editor.contrib.findController").closeFindWidget(); to close the widget; the problem is that the widget can also be opened and closed from within the Monaco editor itself (opened via ctrl/cmd+F, closed via "X" button, esc key, etc). We need to know when the widget is opened or closed from within the editor so that we can sync the state to our own button and have it fire the correct action. Currently it seems the only solution available is a series of hacky onMouseDown and onKeyDown listeners.

We have tried hooking into editor.getContribution("editor.contrib.findController").getState().onFindReplaceStateChange as well, but the isVisible prop available there did not seem to update accurately.

Thank you!

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

@nmandel nmandel added the feature-request Request for new features or functionality label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

1 participant