debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[CodeSearch] Save search modifiers as prefs

Open jasonLaster opened this issue 9 years ago • 2 comments

It would be really nice if modifier state were persisted across debugging sessions. We get the feedback that users often prefer one setting like case sensitivity and are frustrated by having to toggle that often.

Here's a quick sketch of what the feature could look like. We can base this off of other UI features that are also working in the UI reducer

diff --git a/assets/panel/prefs.js b/assets/panel/prefs.js
index 58469e1..552a3f0 100644
--- a/assets/panel/prefs.js
+++ b/assets/panel/prefs.js
@@ -38,3 +38,6 @@ pref("devtools.debugger.tabs", "[]");
 pref("devtools.debugger.pending-selected-location", "{}");
 pref("devtools.debugger.pending-breakpoints", "[]");
 pref("devtools.debugger.expressions", "[]");
+pref("devtools.debugger.file-search-case-sensitive", true);
+pref("devtools.debugger.file-search-whole-word", false );
+pref("devtools.debugger.file-search-regex-match", false);
diff --git a/src/reducers/ui.js b/src/reducers/ui.js
index ebe2eac..daf45ac 100644
--- a/src/reducers/ui.js
+++ b/src/reducers/ui.js
@@ -37,9 +37,9 @@ export const State = makeRecord(
     fileSearchOn: false,
     fileSearchQuery: "",
     fileSearchModifiers: makeRecord({
-      caseSensitive: true,
-      wholeWord: false,
-      regexMatch: false
+      caseSensitive: prefs.fileSearchCaseSensitive,
+      wholeWord: prefs.fileSearchWholeWord,
+      regexMatch: prefs.fileSearchRegexMatch
     })(),
     projectSearchOn: false,
     symbolSearchOn: false,
diff --git a/src/utils/prefs.js b/src/utils/prefs.js
index 3025a0b..197acae 100644
--- a/src/utils/prefs.js
+++ b/src/utils/prefs.js
@@ -16,12 +16,20 @@ if (isDevelopment()) {
   pref("devtools.debugger.pending-selected-location", "{}");
   pref("devtools.debugger.pending-breakpoints", "[]");
   pref("devtools.debugger.expressions", "[]");
+  pref("devtools.debugger.fileSearchCaseSensitive", true);
+  pref("devtools.debugger.fileSearchWholeWord", false );
+  pref("devtools.debugger.fileSearchRegexMatch", false);
 }

+
+
 const prefs = new PrefsHelper("devtools", {
   clientSourceMapsEnabled: ["Bool", "debugger.client-source-maps-enabled"],
   pauseOnExceptions: ["Bool", "debugger.pause-on-exceptions"],
   ignoreCaughtExceptions: ["Bool", "debugger.ignore-caught-exceptions"],
+  fileSearchCaseSensitive: ["Bool", "devtools.debugger.file-search-case-sensitive"],
+  fileSearchWholeWord: ["Bool", "devtools.debugger.file-search-whole-word"],
+  fileSearchRegexMatch: ["Bool", "devtools.debugger.file-search-regex-match"],
   callStackVisible: ["Bool", "debugger.call-stack-visible"],
   scopesVisible: ["Bool", "debugger.scopes-visible"],
   startPanelCollapsed: ["Bool", "debugger.start-panel-collapsed"],

jasonLaster avatar May 08 '17 21:05 jasonLaster

May I work on this?

sharathnarayanph avatar May 12 '17 15:05 sharathnarayanph

@sharathnarayanph that'd be great

jasonLaster avatar May 12 '17 15:05 jasonLaster