[ProjectSearch] search the source when a match is selected
When clicking on a line result in the search results, it would be nice if the line or keyword instance would be highlighted when the source is opened.
Atom does this really nicely when you select a match. For us it would be as easy as firing this action
1. project search

2. bin/mochi

/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!
export class ProjectSearch extends Component<Props, State> {
selectMatchItem = (matchItem: Match) => {
this.props.selectLocation({ ...matchItem });
+ this.props.doSearch(this.state.inputValue, editor);
};
getResults = (): Result[] => {
This change will add the search on source selection, but the editor is not available within this component and would need to be obtained.
I am not sure if this helps, but anyway The old FireFox debugger had this feature as you can see in this GIF :

Comparing to the new debugger which doesn't highlight the matching clause :

Thanks @urielha
I think we can get the editor if we set it in module state:
diff --git a/src/utils/editor/index.js b/src/utils/editor/index.js
index 00d689a..fa6e15c 100644
--- a/src/utils/editor/index.js
+++ b/src/utils/editor/index.js
@@ -20,6 +20,20 @@ import type { AstLocation } from "../../workers/parser";
import type { EditorPosition, EditorRange } from "../editor/types";
import type { Location } from "../../types";
+let editor = null;
+
+export function setEditor(_editor) {
+ editor = _editor;
+}
+
+export function getEditor() {
+ return editor;
+}
+
+export function clearEditor() {
+ editor = null;
+}
+
index 92fcfc3..963e920 100644
--- a/src/actions/navigation.js
+++ b/src/actions/navigation.js
@@ -37,6 +37,7 @@ export function willNavigate(event: Object) {
await sourceMaps.clearSourceMaps();
clearWasmStates();
clearDocuments();
+ clearEditor();
clearSymbols();
clearASTs();
clearScopes();