summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/project-search.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/utils/project-search.js')
-rw-r--r--devtools/client/debugger/src/utils/project-search.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/devtools/client/debugger/src/utils/project-search.js b/devtools/client/debugger/src/utils/project-search.js
new file mode 100644
index 0000000000..97b7c29d88
--- /dev/null
+++ b/devtools/client/debugger/src/utils/project-search.js
@@ -0,0 +1,26 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+// Maybe reuse file search's functions?
+
+import React from "react";
+
+export function highlightMatches(lineMatch) {
+ const { value, matchIndex, match } = lineMatch;
+ const len = match.length;
+
+ return (
+ <span className="line-value">
+ <span className="line-match" key={0}>
+ {value.slice(0, matchIndex)}
+ </span>
+ <span className="query-match" key={1}>
+ {value.substr(matchIndex, len)}
+ </span>
+ <span className="line-match" key={2}>
+ {value.slice(matchIndex + len, value.length)}
+ </span>
+ </span>
+ );
+}