@@ -9,6 +9,7 @@ import { autocompletion, closeBrackets } from '@codemirror/autocomplete';
99// import 'codemirror/addon/search/jump-to-line';
1010
1111import { debounce } from 'lodash' ;
12+ import { openSearchPanel } from '@codemirror/search' ;
1213
1314import {
1415 getFileMode ,
@@ -20,9 +21,6 @@ import { useEffectWithComparison } from '../../hooks/custom-hooks';
2021import tidyCodeWithPrettier from './tidier' ;
2122
2223// ----- GENERAL TODOS (in order of priority) -----
23- // - autocomplete (hinter)
24- // - p5-javascript
25- // - search, find & replace
2624// - color themes
2725// - any features lost in the p5 conversion git merge
2826// - javascript color picker (extension works for css but needs to be forked for js)
@@ -208,13 +206,9 @@ export default function useCodeMirror({
208206 return updatedFile ;
209207 } ;
210208
211- // TODO: Add find and replace functionality.
212- // const showFind = () => {
213- // cmInstance.current.execCommand('findPersistent');
214- // };
215- // const showReplace = () => {
216- // cmInstance.current.execCommand('replace');
217- // };
209+ const showSearch = ( ) => {
210+ openSearchPanel ( cmView . current ) ;
211+ } ;
218212
219213 const tidyCode = ( ) => {
220214 const fileMode = getFileMode ( file . name ) ;
@@ -225,8 +219,7 @@ export default function useCodeMirror({
225219 setupCodeMirrorOnContainerMounted,
226220 teardownCodeMirror,
227221 getContent,
228- tidyCode
229- // showFind,
230- // showReplace
222+ tidyCode,
223+ showSearch
231224 } ;
232225}
0 commit comments