microsoft / microsoft/monaco-editor
[Feature Request] Event listener for when findController is opened/closed
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
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:
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the findController contribution and its getState().onFindReplaceStateChange entry point; compare how the existing open and close paths are represented. Done means consumers can reliably observe the find widget opening and closing, whether triggered externally or from within the editor.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api, frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100