chore(code/find): jump to first result

This commit is contained in:
Elian Doran
2025-05-12 20:26:48 +03:00
parent f2745d546b
commit c4863dec50
2 changed files with 47 additions and 6 deletions

View File

@@ -176,9 +176,13 @@ export default class CodeMirror extends EditorView {
this.dispatch({
effects: this.searchHighlightCompartment.reconfigure(plugin)
});
// Wait for the plugin to activate in the next render cycle
await new Promise(requestAnimationFrame);
const instance = this.plugin(plugin); // TS workaround
const instance = this.plugin(plugin);
if (instance) {
instance.scrollToMatch(0);
}
return {
totalFound: instance?.totalFound ?? 0