Search ↔ Monaco Editor Integration
Summary
The global search feature should be tightly integrated with the flutter_monaco editor so that search results are actionable and intuitive.
At the moment, search can identify matches across files, but interaction with results does not fully translate into expected editor behavior such as navigation, visibility, highlighting, and focus handling.
This issue tracks the work needed to align search behavior with standard IDE expectations.
Why This Is Needed
-
Actionable search results
Clicking a search result should immediately take the user to the relevant code location.
-
Clear user feedback
Without scrolling and highlighting, users may feel that clicking a result did nothing.
-
Consistent IDE experience
Popular IDEs (VS Code, Android Studio) provide tight coupling between search and editor navigation.
-
Platform differences
Focus and selection behavior can vary across desktop, web, and mobile, requiring explicit handling.
-
flutter_monaco API constraints
Some Monaco editor capabilities are version-dependent or partially exposed, so integration must be handled carefully.
What’s Included in This Issue
1. Navigate to Match
- Open the target file when a search result is selected
- Move the editor cursor to the matched line and column
2. Reveal Match in Viewport
- Scroll the editor so the matched line is visible
- Avoid situations where navigation occurs off-screen
3. Highlight Match / Selection
- Visually highlight the matched range
- Clear or update highlights when a different result is selected
4. Editor Focus Management
- Ensure editor receives keyboard focus after clicking a search result
- Allow immediate typing or navigation after jump
Possible Implementation Approach
- Use the
MonacoController APIs to:
- Set cursor position (line / column)
- Reveal or scroll to a specific line
- Apply selection or inline decorations for highlights
- Maintain a lightweight search-to-editor bridge layer responsible for:
- Opening files
- Managing focus
- Clearing previous decorations
- Add fallbacks or guards where Monaco APIs are unavailable or differ by version
Notes on flutter_monaco
- Current dependency:
- Any previously used patched versions (e.g.
third_party/flutter_monaco_patch/) are not automatically applied
- If patches were relied upon earlier, they will need to be manually ported or rebased
Scope
- This issue is limited to editor-side behavior
- Navigation
- Scrolling / reveal
- Highlighting
- Focus handling
- Search indexing, file scanning, and ranking are out of scope
Search ↔ Monaco Editor Integration
Summary
The global search feature should be tightly integrated with the
flutter_monacoeditor so that search results are actionable and intuitive.At the moment, search can identify matches across files, but interaction with results does not fully translate into expected editor behavior such as navigation, visibility, highlighting, and focus handling.
This issue tracks the work needed to align search behavior with standard IDE expectations.
Why This Is Needed
Actionable search results
Clicking a search result should immediately take the user to the relevant code location.
Clear user feedback
Without scrolling and highlighting, users may feel that clicking a result did nothing.
Consistent IDE experience
Popular IDEs (VS Code, Android Studio) provide tight coupling between search and editor navigation.
Platform differences
Focus and selection behavior can vary across desktop, web, and mobile, requiring explicit handling.
flutter_monacoAPI constraintsSome Monaco editor capabilities are version-dependent or partially exposed, so integration must be handled carefully.
What’s Included in This Issue
1. Navigate to Match
2. Reveal Match in Viewport
3. Highlight Match / Selection
4. Editor Focus Management
Possible Implementation Approach
MonacoControllerAPIs to:Notes on
flutter_monacothird_party/flutter_monaco_patch/) are not automatically appliedScope