Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created May 16, 2019 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/9727088f5fa1dfeadb96cece3b677cd5 to your computer and use it in GitHub Desktop.
Save jasonLaster/9727088f5fa1dfeadb96cece3b677cd5 to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/debugger/src/actions/project-text-search.js b/devtools/client/debugger/src/actions/project-text-search.js
index ae534a9a03f9..e30987922997 100644
--- a/devtools/client/debugger/src/actions/project-text-search.js
+++ b/devtools/client/debugger/src/actions/project-text-search.js
@@ -84,7 +84,12 @@ export function stopOngoingSearch(cx: Context) {
};
}
-export function searchSources(cx: Context, query: string) {
+export function searchSources(
+ cx: Context,
+ query: string,
+ resources,
+ loadContent
+) {
let cancelled = false;
const search = async ({ dispatch, getState }: ThunkArgs) => {
@@ -93,14 +98,16 @@ export function searchSources(cx: Context, query: string) {
await dispatch(clearSearchResults(cx));
await dispatch(addSearchQuery(cx, query));
dispatch(updateSearchStatus(cx, statusType.fetching));
- const validSources = getSourceList(getState()).filter(
- source => !hasPrettySource(getState(), source.id) && !isThirdParty(source)
- );
- for (const source of validSources) {
+ // const validSources = getSourceList(getState()).filter(
+ // source => !hasPrettySource(getState(), source.id) && !isThirdParty(source)
+ // );
+ for (const source of resources) {
if (cancelled) {
return;
}
- await dispatch(loadSourceText({ cx, source }));
+ // this needs to be overridden
+ // await dispatch(loadSourceText({ cx, source }));
+ dispatch(loadContent());
await dispatch(searchSource(cx, source.id, query));
}
dispatch(updateSearchStatus(cx, statusType.done));
diff --git a/devtools/client/debugger/src/components/ProjectSearch.js b/devtools/client/debugger/src/components/ProjectSearch.js
index 13a8f6d79667..19b579c15f53 100644
--- a/devtools/client/debugger/src/components/ProjectSearch.js
+++ b/devtools/client/debugger/src/components/ProjectSearch.js
@@ -201,19 +201,20 @@ export class ProjectSearch extends Component<Props, State> {
};
renderFile = (file: Result, focused: boolean, expanded: boolean) => {
- const matchesLength = file.matches.length;
- const matches = ` (${matchesLength} match${matchesLength > 1 ? "es" : ""})`;
+ // const matchesLength = file.matches.length;
+ // const matches = ` (${matchesLength} match${matchesLength > 1 ? "es" : ""})`;
return (
- <div
- className={classnames("file-result", { focused })}
- key={file.sourceId}
- >
- <AccessibleImage className={classnames("arrow", { expanded })} />
- <AccessibleImage className="file" />
- <span className="file-path">{getRelativePath(file.filepath)}</span>
- <span className="matches-summary">{matches}</span>
- </div>
+ <div> file</div>
+ // <div
+ // className={classnames("file-result", { focused })}
+ // key={file.sourceId}
+ // >
+ // <AccessibleImage className={classnames("arrow", { expanded })} />
+ // <AccessibleImage className="file" />
+ // <span className="file-path">{getRelativePath(file.filepath)}</span>
+ // <span className="matches-summary">{matches}</span>
+ // </div>
);
};
@@ -221,7 +222,10 @@ export class ProjectSearch extends Component<Props, State> {
return (
<div
className={classnames("result", { focused })}
- onClick={() => setTimeout(() => this.selectMatchItem(match), 50)}
+ onClick={() => setTimeout(() => {
+ // this needs to be overridden
+ // this.selectMatchItem(match), 50)
+ }}
>
<span className="line-number" key={match.line}>
{match.line}
diff --git a/devtools/client/debugger/src/reducers/project-text-search.js b/devtools/client/debugger/src/reducers/project-text-search.js
index 9212a9b09cac..d40dbec04b4d 100644
--- a/devtools/client/debugger/src/reducers/project-text-search.js
+++ b/devtools/client/debugger/src/reducers/project-text-search.js
@@ -52,6 +52,8 @@ export function initialProjectTextSearchState(): ProjectTextSearchState {
};
}
+// we'll need to import this...
+
function update(
state: ProjectTextSearchState = initialProjectTextSearchState(),
action: Action
diff --git a/devtools/client/debugger/src/workers/search/index.js b/devtools/client/debugger/src/workers/search/index.js
index fcc9315659b3..4009c9c24ff6 100644
--- a/devtools/client/debugger/src/workers/search/index.js
+++ b/devtools/client/debugger/src/workers/search/index.js
@@ -7,9 +7,12 @@
import { workerUtils } from "devtools-utils";
const { WorkerDispatcher } = workerUtils;
-const dispatcher = new WorkerDispatcher();
-export const start = dispatcher.start.bind(dispatcher);
-export const stop = dispatcher.stop.bind(dispatcher);
+export class SearchDispatcher extends WorkerDispatcher {
+ getMatches() {
+ return this.task("getMatches");
+ }
-export const getMatches = dispatcher.task("getMatches");
-export const findSourceMatches = dispatcher.task("findSourceMatches");
+ findSourceMatches() {
+ return this.task("findSourceMatches");
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment