MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / selectionMatchesQuery

Function selectionMatchesQuery

src/handlers/quickTools.js:822–837  ·  view source on GitHub ↗
(editor, query)

Source from the content-addressed store, hash-verified

820}
821
822function selectionMatchesQuery(editor, query) {
823 try {
824 if (!editor || !query || !query.valid || !query.search) return false;
825 const range = editor.state?.selection?.main;
826 if (!range || range.from === range.to) return false;
827 const cursor = query.getCursor(editor.state.doc, range.from, range.to);
828 cursor.next();
829 return (
830 !cursor.done &&
831 cursor.value.from === range.from &&
832 cursor.value.to === range.to
833 );
834 } catch (_) {
835 return false;
836 }
837}
838
839/**
840 * Gets text input

Callers 1

findFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected