Add test and regexpTest functions to SearchQuery config#18
Add test and regexpTest functions to SearchQuery config#18heyman wants to merge 3 commits intocodemirror:mainfrom
Conversation
… filtering search results
|
These look very specific to your use case, and not very elegant in their interface. Would a single function (not split between regexp and regular matches), that passes the matched string, an editor state, and from/to positions, work for you? I guess you're trying to optimize by passing in the data structures that are locally available, but that feels like it leaks too much of the internal implementation, and needlessly complicates the signatures. |
|
Yeah, this is just some minimal changes that would allow me to do the filtering I wanted to do, using the same signature as the test function used internally.
Yes, that should work. I do a regex test on the whole line (of the match) and use |
|
I've now updated the PR to use a single test function that is passed the matched string, state, and from/to positions like you suggested. |
|
Thanks, that looks much better. I've merged this as d554699 |
Remove modified version of @codemirror/search that we had vendored, since codemirror/search#18 was merged. Refactored code to use the same search test function for regular search, regexp search, and selection matching search.
|
Thanks! Feels good to be back on the official |
Remove modified version of @codemirror/search that we had vendored, since codemirror/search#18 was merged. Refactored code to use the same search test function for regular search, regexp search, and selection matching search.
Adds
testandregexpTesttoSearchQuery'sconfig, which can be used to specify a customtestfunction forSearchCursorandRegExpCursor.See: https://discuss.codemirror.net/t/custom-test-function-for-searchquery-config/9323