chrome-devtools-frontend 1.0.1514545 → 1.0.1515446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/docs/committers_policy.md +1 -1
- package/docs/contributing/infrastructure.md +101 -5
- package/front_end/Images/gdp-logo-dark.png +0 -0
- package/front_end/Images/gdp-logo-light.png +0 -0
- package/front_end/core/common/Settings.ts +11 -32
- package/front_end/global_typings/global_defs.d.ts +15 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +22 -23
- package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +6 -7
- package/front_end/models/ai_assistance/ai_assistance.ts +3 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +77 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +76 -10
- package/front_end/models/cpu_profile/ProfileTreeModel.ts +1 -1
- package/front_end/models/extensions/ExtensionPanel.ts +4 -0
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +5 -1
- package/front_end/models/trace/helpers/Trace.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +6 -7
- package/front_end/panels/ai_assistance/components/ChatView.ts +1 -2
- package/front_end/panels/common/GdpSignUpDialog.ts +2 -6
- package/front_end/panels/common/gdpSignUpDialog.css +6 -14
- package/front_end/panels/console/ConsoleView.ts +4 -0
- package/front_end/panels/elements/ElementsPanel.ts +4 -0
- package/front_end/panels/elements/StylePropertiesSection.ts +4 -4
- package/front_end/panels/network/NetworkConfigView.ts +1 -1
- package/front_end/panels/network/NetworkLogView.ts +2 -2
- package/front_end/panels/network/components/HeaderSectionRow.ts +2 -3
- package/front_end/panels/profiler/HeapProfileView.ts +1 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +5 -1
- package/front_end/panels/profiler/ProfileDataGrid.ts +4 -0
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +7 -29
- package/front_end/panels/profiler/ProfileView.ts +4 -0
- package/front_end/panels/recorder/components/CreateRecordingView.ts +2 -2
- package/front_end/panels/search/SearchView.ts +219 -205
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -1
- package/front_end/panels/settings/components/SyncSection.ts +2 -6
- package/front_end/panels/settings/components/syncSection.css +11 -4
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +3 -3
- package/front_end/panels/sources/SourcesView.ts +4 -0
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -2
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +6 -3
- package/front_end/panels/timeline/CountersGraph.ts +5 -5
- package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +4 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +9 -4
- package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -2
- package/front_end/panels/timeline/TimelinePanel.ts +4 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +6 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +2 -1
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +2 -2
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +6 -6
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +2 -2
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -3
- package/front_end/panels/timeline/utils/utils.ts +0 -8
- package/front_end/{panels/timeline/utils → services/tracing}/FreshRecording.ts +1 -1
- package/front_end/services/tracing/tracing.ts +2 -0
- package/front_end/ui/legacy/Dialog.ts +38 -13
- package/front_end/ui/legacy/InspectorView.ts +7 -9
- package/front_end/ui/legacy/SearchableView.ts +73 -55
- package/front_end/ui/legacy/SettingsUI.ts +5 -5
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -4
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +5 -5
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -2
- package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +2 -2
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +1 -4
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -2
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +10 -10
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -0
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +4 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -4
- package/front_end/ui/legacy/searchableView.css +0 -4
- package/package.json +1 -1
- package/front_end/Images/src/gdp-logo-standalone.svg +0 -9
- /package/front_end/{panels/timeline/utils → models/ai_assistance/performance}/AICallTree.ts +0 -0
- /package/front_end/{panels/timeline/utils → models/ai_assistance/performance}/AIContext.ts +0 -0
- /package/front_end/{panels/timeline/utils/InsightAIContext.ts → models/ai_assistance/performance/AIQueries.ts} +0 -0
@@ -109,33 +109,32 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
109
109
|
const {ref} = Directives;
|
110
110
|
|
111
111
|
export class SearchView extends UI.Widget.VBox {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
private readonly advancedSearchConfig: Common.Settings.Setting<{
|
112
|
+
#focusOnShow: boolean;
|
113
|
+
#isIndexing: boolean;
|
114
|
+
#searchId: number;
|
115
|
+
#searchMatchesCount: number;
|
116
|
+
#searchResultsCount: number;
|
117
|
+
#nonEmptySearchResultsCount: number;
|
118
|
+
#searchingView: UI.Widget.Widget|null;
|
119
|
+
#notFoundView: UI.Widget.Widget|null;
|
120
|
+
#searchConfig: Workspace.SearchConfig.SearchConfig|null;
|
121
|
+
#pendingSearchConfig: Workspace.SearchConfig.SearchConfig|null;
|
122
|
+
#searchResultsPane: SearchResultsPane|null;
|
123
|
+
#progressIndicator: UI.ProgressIndicator.ProgressIndicator|null;
|
124
|
+
#visiblePane: UI.Widget.Widget|null;
|
125
|
+
#searchResultsElement!: HTMLElement;
|
126
|
+
#searchInputElement!: HTMLInputElement;
|
127
|
+
#matchCaseButton!: Buttons.Button.Button;
|
128
|
+
#regexButton!: Buttons.Button.Button;
|
129
|
+
#searchMessageElement!: HTMLElement;
|
130
|
+
#searchProgressPlaceholderElement!: HTMLElement;
|
131
|
+
#searchResultsMessageElement!: HTMLElement;
|
132
|
+
readonly #advancedSearchConfig: Common.Settings.Setting<{
|
134
133
|
query: string,
|
135
134
|
ignoreCase: boolean,
|
136
135
|
isRegex: boolean,
|
137
136
|
}>;
|
138
|
-
|
137
|
+
#searchScope: SearchScope|null;
|
139
138
|
|
140
139
|
// We throttle adding search results, otherwise we trigger DOM layout for each
|
141
140
|
// result added.
|
@@ -150,27 +149,26 @@ export class SearchView extends UI.Widget.VBox {
|
|
150
149
|
});
|
151
150
|
this.setMinimumSize(0, 40);
|
152
151
|
|
153
|
-
this
|
154
|
-
this
|
155
|
-
this
|
156
|
-
this
|
157
|
-
this
|
158
|
-
this
|
159
|
-
this
|
160
|
-
this
|
161
|
-
this
|
162
|
-
this
|
163
|
-
this
|
164
|
-
this
|
165
|
-
this
|
152
|
+
this.#focusOnShow = false;
|
153
|
+
this.#isIndexing = false;
|
154
|
+
this.#searchId = 1;
|
155
|
+
this.#searchMatchesCount = 0;
|
156
|
+
this.#searchResultsCount = 0;
|
157
|
+
this.#nonEmptySearchResultsCount = 0;
|
158
|
+
this.#searchingView = null;
|
159
|
+
this.#notFoundView = null;
|
160
|
+
this.#searchConfig = null;
|
161
|
+
this.#pendingSearchConfig = null;
|
162
|
+
this.#searchResultsPane = null;
|
163
|
+
this.#progressIndicator = null;
|
164
|
+
this.#visiblePane = null;
|
166
165
|
this.#throttler = throttler;
|
167
166
|
|
168
167
|
// clang-format off
|
169
168
|
/* eslint-disable-next-line rulesdir/no-lit-render-outside-of-view */
|
170
169
|
render(html`
|
171
170
|
<style>${searchViewStyles}</style>
|
172
|
-
<div class="search-drawer-header" @keydown=${this
|
173
|
-
${ref(e => {this.searchPanelElement = e as HTMLElement;})}>
|
171
|
+
<div class="search-drawer-header" @keydown=${this.#onPanelKeyDown}>
|
174
172
|
<div class="search-container">
|
175
173
|
<div class="toolbar-item-search">
|
176
174
|
<devtools-icon name="search"></devtools-icon>
|
@@ -181,10 +179,10 @@ export class SearchView extends UI.Widget.VBox {
|
|
181
179
|
change: true, keydown: 'ArrowUp|ArrowDown|Enter'})}
|
182
180
|
aria-label=${i18nString(UIStrings.find)}
|
183
181
|
size="100" results="0"
|
184
|
-
@keydown=${this
|
185
|
-
${ref(e => {this
|
182
|
+
@keydown=${this.#onQueryKeyDown}
|
183
|
+
${ref(e => {this.#searchInputElement = e as HTMLInputElement;})}>
|
186
184
|
<devtools-button class="clear-button" tabindex="-1"
|
187
|
-
@click=${this
|
185
|
+
@click=${this.#onClearSearchInput}
|
188
186
|
.data=${{
|
189
187
|
variant: Buttons.Button.Variant.ICON,
|
190
188
|
iconName: 'cross-circle-filled',
|
@@ -193,7 +191,7 @@ export class SearchView extends UI.Widget.VBox {
|
|
193
191
|
title: i18nString(UIStrings.clearInput),
|
194
192
|
} as Buttons.Button.ButtonData}
|
195
193
|
></devtools-button>
|
196
|
-
<devtools-button @click=${this
|
194
|
+
<devtools-button @click=${this.#onToggleRegex} .data=${{
|
197
195
|
variant: Buttons.Button.Variant.ICON_TOGGLE,
|
198
196
|
iconName: 'regular-expression',
|
199
197
|
toggledIconName: 'regular-expression',
|
@@ -203,9 +201,9 @@ export class SearchView extends UI.Widget.VBox {
|
|
203
201
|
title: i18nString(UIStrings.enableRegularExpression),
|
204
202
|
jslogContext: 'regular-expression',
|
205
203
|
} as Buttons.Button.ButtonData}
|
206
|
-
${ref(e => {this
|
204
|
+
${ref(e => {this.#regexButton = e as Buttons.Button.Button;})}
|
207
205
|
></devtools-button>
|
208
|
-
<devtools-button @click=${this
|
206
|
+
<devtools-button @click=${this.#onToggleMatchCase} .data=${{
|
209
207
|
variant: Buttons.Button.Variant.ICON_TOGGLE,
|
210
208
|
iconName: 'match-case',
|
211
209
|
toggledIconName: 'match-case',
|
@@ -215,18 +213,18 @@ export class SearchView extends UI.Widget.VBox {
|
|
215
213
|
title: i18nString(UIStrings.enableCaseSensitive),
|
216
214
|
jslogContext: 'match-case',
|
217
215
|
} as Buttons.Button.ButtonData}
|
218
|
-
${ref(e => {this
|
216
|
+
${ref(e => {this.#matchCaseButton = e as Buttons.Button.Button;})}
|
219
217
|
></devtools-button>
|
220
218
|
</div>
|
221
219
|
</div>
|
222
220
|
<devtools-toolbar class="search-toolbar" jslog=${VisualLogging.toolbar()}>
|
223
|
-
<devtools-button title=${i18nString(UIStrings.refresh)} @click=${this
|
221
|
+
<devtools-button title=${i18nString(UIStrings.refresh)} @click=${this.#onRefresh}
|
224
222
|
.data=${{
|
225
223
|
variant: Buttons.Button.Variant.TOOLBAR,
|
226
224
|
iconName: 'refresh',
|
227
225
|
jslogContext: 'search.refresh',
|
228
226
|
} as Buttons.Button.ButtonData}></devtools-button>
|
229
|
-
<devtools-button title=${i18nString(UIStrings.clear)} @click=${this
|
227
|
+
<devtools-button title=${i18nString(UIStrings.clear)} @click=${this.#onClearSearch}
|
230
228
|
.data=${{
|
231
229
|
variant: Buttons.Button.Variant.TOOLBAR,
|
232
230
|
iconName: 'clear',
|
@@ -234,59 +232,59 @@ export class SearchView extends UI.Widget.VBox {
|
|
234
232
|
} as Buttons.Button.ButtonData}></devtools-button>
|
235
233
|
</devtools-toolbar>
|
236
234
|
</div>
|
237
|
-
<div class="search-results" @keydown=${this
|
238
|
-
${ref(e => {this
|
235
|
+
<div class="search-results" @keydown=${this.#onPanelKeyDown}
|
236
|
+
${ref(e => {this.#searchResultsElement = e as HTMLElement;})}>
|
239
237
|
</div>
|
240
|
-
<div class="search-toolbar-summary" @keydown=${this
|
241
|
-
<div class="search-message" ${ref(e => {this
|
242
|
-
<div class="flex-centered" ${ref(e => {this
|
238
|
+
<div class="search-toolbar-summary" @keydown=${this.#onPanelKeyDown}>
|
239
|
+
<div class="search-message" ${ref(e => {this.#searchMessageElement = e as HTMLElement;})}></div>
|
240
|
+
<div class="flex-centered" ${ref(e => {this.#searchProgressPlaceholderElement = e as HTMLElement;})}>
|
243
241
|
</div>
|
244
|
-
<div class="search-message" ${ref(e => {this
|
242
|
+
<div class="search-message" ${ref(e => {this.#searchResultsMessageElement = e as HTMLElement;})}>
|
245
243
|
</div>
|
246
244
|
</div>`, this.contentElement, {host: this});
|
247
245
|
// clang-format on
|
248
246
|
|
249
|
-
this
|
247
|
+
this.#advancedSearchConfig = Common.Settings.Settings.instance().createLocalSetting(
|
250
248
|
settingKey + '-search-config', new Workspace.SearchConfig.SearchConfig('', true, false).toPlainObject());
|
251
249
|
|
252
|
-
this
|
253
|
-
this
|
250
|
+
this.#load();
|
251
|
+
this.#searchScope = null;
|
254
252
|
|
255
253
|
this.#emptyStartView = new UI.EmptyWidget.EmptyWidget(
|
256
254
|
i18nString(UIStrings.noSearchResult), i18nString(UIStrings.typeAndPressSToSearch, {
|
257
255
|
PH1: UI.KeyboardShortcut.KeyboardShortcut.shortcutToString(UI.KeyboardShortcut.Keys.Enter)
|
258
256
|
}));
|
259
|
-
this
|
257
|
+
this.#showPane(this.#emptyStartView);
|
260
258
|
}
|
261
259
|
|
262
|
-
|
263
|
-
this
|
264
|
-
|
260
|
+
#onToggleRegex(): void {
|
261
|
+
this.#regexButton.title = this.#regexButton.toggled ? i18nString(UIStrings.disableRegularExpression) :
|
262
|
+
i18nString(UIStrings.enableRegularExpression);
|
265
263
|
}
|
266
264
|
|
267
|
-
|
268
|
-
this
|
269
|
-
|
265
|
+
#onToggleMatchCase(): void {
|
266
|
+
this.#matchCaseButton.title = this.#matchCaseButton.toggled ? i18nString(UIStrings.disableCaseSensitive) :
|
267
|
+
i18nString(UIStrings.enableCaseSensitive);
|
270
268
|
}
|
271
269
|
|
272
|
-
|
270
|
+
#buildSearchConfig(): Workspace.SearchConfig.SearchConfig {
|
273
271
|
return new Workspace.SearchConfig.SearchConfig(
|
274
|
-
this.
|
272
|
+
this.#searchInputElement.value, !this.#matchCaseButton.toggled, this.#regexButton.toggled);
|
275
273
|
}
|
276
274
|
|
277
275
|
toggle(queryCandidate: string, searchImmediately?: boolean): void {
|
278
|
-
this.
|
276
|
+
this.#searchInputElement.value = queryCandidate;
|
279
277
|
if (this.isShowing()) {
|
280
278
|
this.focus();
|
281
279
|
} else {
|
282
|
-
this
|
280
|
+
this.#focusOnShow = true;
|
283
281
|
}
|
284
282
|
|
285
|
-
this
|
283
|
+
this.#initScope();
|
286
284
|
if (searchImmediately) {
|
287
|
-
this
|
285
|
+
this.#onRefresh();
|
288
286
|
} else {
|
289
|
-
this
|
287
|
+
this.#startIndexing();
|
290
288
|
}
|
291
289
|
}
|
292
290
|
|
@@ -294,208 +292,212 @@ export class SearchView extends UI.Widget.VBox {
|
|
294
292
|
throw new Error('Not implemented');
|
295
293
|
}
|
296
294
|
|
297
|
-
|
298
|
-
this
|
295
|
+
#initScope(): void {
|
296
|
+
this.#searchScope = this.createScope();
|
299
297
|
}
|
300
298
|
|
301
299
|
override wasShown(): void {
|
302
300
|
super.wasShown();
|
303
|
-
if (this
|
301
|
+
if (this.#focusOnShow) {
|
304
302
|
this.focus();
|
305
|
-
this
|
303
|
+
this.#focusOnShow = false;
|
306
304
|
}
|
307
305
|
}
|
308
306
|
|
309
|
-
|
310
|
-
if (!this
|
307
|
+
#onIndexingFinished(): void {
|
308
|
+
if (!this.#progressIndicator) {
|
311
309
|
return;
|
312
310
|
}
|
313
311
|
|
314
|
-
const finished = !this
|
315
|
-
this
|
316
|
-
this
|
317
|
-
this
|
318
|
-
this
|
312
|
+
const finished = !this.#progressIndicator.isCanceled();
|
313
|
+
this.#progressIndicator.done();
|
314
|
+
this.#progressIndicator = null;
|
315
|
+
this.#isIndexing = false;
|
316
|
+
this.#searchMessageElement.textContent = finished ? '' : i18nString(UIStrings.indexingInterrupted);
|
319
317
|
if (!finished) {
|
320
|
-
this
|
318
|
+
this.#pendingSearchConfig = null;
|
321
319
|
}
|
322
|
-
if (!this
|
320
|
+
if (!this.#pendingSearchConfig) {
|
323
321
|
return;
|
324
322
|
}
|
325
|
-
const searchConfig = this
|
326
|
-
this
|
327
|
-
this
|
323
|
+
const searchConfig = this.#pendingSearchConfig;
|
324
|
+
this.#pendingSearchConfig = null;
|
325
|
+
this.#innerStartSearch(searchConfig);
|
328
326
|
}
|
329
327
|
|
330
|
-
|
331
|
-
this
|
332
|
-
if (this
|
333
|
-
this
|
328
|
+
#startIndexing(): void {
|
329
|
+
this.#isIndexing = true;
|
330
|
+
if (this.#progressIndicator) {
|
331
|
+
this.#progressIndicator.done();
|
334
332
|
}
|
335
|
-
this
|
336
|
-
this
|
337
|
-
this
|
338
|
-
if (this
|
339
|
-
this
|
340
|
-
new Common.Progress.ProgressProxy(this
|
333
|
+
this.#progressIndicator = document.createElement('devtools-progress');
|
334
|
+
this.#searchMessageElement.textContent = i18nString(UIStrings.indexing);
|
335
|
+
this.#searchProgressPlaceholderElement.appendChild(this.#progressIndicator);
|
336
|
+
if (this.#searchScope) {
|
337
|
+
this.#searchScope.performIndexing(
|
338
|
+
new Common.Progress.ProgressProxy(this.#progressIndicator, this.#onIndexingFinished.bind(this)));
|
341
339
|
}
|
342
340
|
}
|
343
341
|
|
344
|
-
|
345
|
-
this.
|
346
|
-
this
|
342
|
+
#onClearSearchInput(): void {
|
343
|
+
this.#searchInputElement.value = '';
|
344
|
+
this.#save();
|
347
345
|
this.focus();
|
348
|
-
this
|
346
|
+
this.#showPane(this.#emptyStartView);
|
349
347
|
}
|
350
348
|
|
351
|
-
|
352
|
-
if (searchId !== this
|
349
|
+
#onSearchResult(searchId: number, searchResult: SearchResult): void {
|
350
|
+
if (searchId !== this.#searchId || !this.#progressIndicator) {
|
353
351
|
return;
|
354
352
|
}
|
355
|
-
if (this
|
356
|
-
this
|
353
|
+
if (this.#progressIndicator?.isCanceled()) {
|
354
|
+
this.#onIndexingFinished();
|
357
355
|
return;
|
358
356
|
}
|
359
|
-
if (!this
|
360
|
-
this
|
361
|
-
this
|
357
|
+
if (!this.#searchResultsPane) {
|
358
|
+
this.#searchResultsPane = this.createSearchResultsPane();
|
359
|
+
this.#showPane(this.#searchResultsPane);
|
362
360
|
}
|
363
361
|
this.#pendingSearchResults.push(searchResult);
|
364
362
|
void this.#throttler.schedule(async () => this.#addPendingSearchResults());
|
365
363
|
}
|
366
364
|
|
365
|
+
protected createSearchResultsPane(): SearchResultsPane {
|
366
|
+
return new SearchResultsPane((this.#searchConfig as Workspace.SearchConfig.SearchConfig));
|
367
|
+
}
|
368
|
+
|
367
369
|
#addPendingSearchResults(): void {
|
368
370
|
for (const searchResult of this.#pendingSearchResults) {
|
369
|
-
this
|
371
|
+
this.#addSearchResult(searchResult);
|
370
372
|
if (searchResult.matchesCount()) {
|
371
|
-
this
|
373
|
+
this.#searchResultsPane?.addSearchResult(searchResult);
|
372
374
|
}
|
373
375
|
}
|
374
376
|
this.#pendingSearchResults = [];
|
375
377
|
}
|
376
378
|
|
377
|
-
|
378
|
-
if (searchId !== this
|
379
|
+
#onSearchFinished(searchId: number, finished: boolean): void {
|
380
|
+
if (searchId !== this.#searchId || !this.#progressIndicator) {
|
379
381
|
return;
|
380
382
|
}
|
381
|
-
if (!this
|
382
|
-
this
|
383
|
+
if (!this.#searchResultsPane) {
|
384
|
+
this.#nothingFound();
|
383
385
|
}
|
384
|
-
this
|
385
|
-
this
|
386
|
+
this.#searchFinished(finished);
|
387
|
+
this.#searchConfig = null;
|
386
388
|
UI.ARIAUtils.LiveAnnouncer.alert(
|
387
|
-
this
|
389
|
+
this.#searchMessageElement.textContent + ' ' + this.#searchResultsMessageElement.textContent);
|
388
390
|
}
|
389
391
|
|
390
|
-
|
391
|
-
this
|
392
|
-
if (this
|
393
|
-
this
|
392
|
+
#innerStartSearch(searchConfig: Workspace.SearchConfig.SearchConfig): void {
|
393
|
+
this.#searchConfig = searchConfig;
|
394
|
+
if (this.#progressIndicator) {
|
395
|
+
this.#progressIndicator.done();
|
394
396
|
}
|
395
|
-
this
|
396
|
-
this
|
397
|
-
if (this
|
398
|
-
void this
|
399
|
-
searchConfig, this
|
400
|
-
this
|
397
|
+
this.#progressIndicator = document.createElement('devtools-progress');
|
398
|
+
this.#searchStarted(this.#progressIndicator);
|
399
|
+
if (this.#searchScope) {
|
400
|
+
void this.#searchScope.performSearch(
|
401
|
+
searchConfig, this.#progressIndicator, this.#onSearchResult.bind(this, this.#searchId),
|
402
|
+
this.#onSearchFinished.bind(this, this.#searchId));
|
401
403
|
}
|
402
404
|
}
|
403
405
|
|
404
|
-
|
405
|
-
this
|
406
|
-
this
|
407
|
-
this
|
408
|
-
this
|
409
|
-
this
|
406
|
+
#resetSearch(): void {
|
407
|
+
this.#stopSearch();
|
408
|
+
this.#showPane(null);
|
409
|
+
this.#searchResultsPane = null;
|
410
|
+
this.#searchMessageElement.textContent = '';
|
411
|
+
this.#searchResultsMessageElement.textContent = '';
|
410
412
|
}
|
411
413
|
|
412
|
-
|
413
|
-
if (this
|
414
|
-
this
|
414
|
+
#stopSearch(): void {
|
415
|
+
if (this.#progressIndicator && !this.#isIndexing) {
|
416
|
+
this.#progressIndicator.cancel();
|
415
417
|
}
|
416
|
-
if (this
|
417
|
-
this
|
418
|
+
if (this.#searchScope) {
|
419
|
+
this.#searchScope.stopSearch();
|
418
420
|
}
|
419
|
-
this
|
421
|
+
this.#searchConfig = null;
|
420
422
|
}
|
421
423
|
|
422
|
-
|
423
|
-
this
|
424
|
-
this
|
425
|
-
this
|
426
|
-
if (!this
|
427
|
-
this
|
424
|
+
#searchStarted(progressIndicator: UI.ProgressIndicator.ProgressIndicator): void {
|
425
|
+
this.#searchMatchesCount = 0;
|
426
|
+
this.#searchResultsCount = 0;
|
427
|
+
this.#nonEmptySearchResultsCount = 0;
|
428
|
+
if (!this.#searchingView) {
|
429
|
+
this.#searchingView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.searching), '');
|
428
430
|
}
|
429
|
-
this
|
430
|
-
this
|
431
|
-
this
|
432
|
-
this
|
433
|
-
}
|
434
|
-
|
435
|
-
|
436
|
-
if (this
|
437
|
-
if (this
|
438
|
-
this
|
439
|
-
} else if (this
|
440
|
-
this
|
441
|
-
i18nString(UIStrings.foundDMatchingLinesInFile, {PH1: this
|
431
|
+
this.#showPane(this.#searchingView);
|
432
|
+
this.#searchMessageElement.textContent = i18nString(UIStrings.searching);
|
433
|
+
this.#searchProgressPlaceholderElement.appendChild(progressIndicator);
|
434
|
+
this.#updateSearchResultsMessage();
|
435
|
+
}
|
436
|
+
|
437
|
+
#updateSearchResultsMessage(): void {
|
438
|
+
if (this.#searchMatchesCount && this.#searchResultsCount) {
|
439
|
+
if (this.#searchMatchesCount === 1 && this.#nonEmptySearchResultsCount === 1) {
|
440
|
+
this.#searchResultsMessageElement.textContent = i18nString(UIStrings.foundMatchingLineInFile);
|
441
|
+
} else if (this.#searchMatchesCount > 1 && this.#nonEmptySearchResultsCount === 1) {
|
442
|
+
this.#searchResultsMessageElement.textContent =
|
443
|
+
i18nString(UIStrings.foundDMatchingLinesInFile, {PH1: this.#searchMatchesCount});
|
442
444
|
} else {
|
443
|
-
this
|
445
|
+
this.#searchResultsMessageElement.textContent = i18nString(
|
444
446
|
UIStrings.foundDMatchingLinesInDFiles,
|
445
|
-
{PH1: this
|
447
|
+
{PH1: this.#searchMatchesCount, PH2: this.#nonEmptySearchResultsCount});
|
446
448
|
}
|
447
449
|
} else {
|
448
|
-
this
|
450
|
+
this.#searchResultsMessageElement.textContent = '';
|
449
451
|
}
|
450
452
|
}
|
451
453
|
|
452
|
-
|
453
|
-
if (this
|
454
|
-
this
|
454
|
+
#showPane(panel: UI.Widget.Widget|null): void {
|
455
|
+
if (this.#visiblePane) {
|
456
|
+
this.#visiblePane.detach();
|
455
457
|
}
|
456
458
|
if (panel) {
|
457
|
-
panel.show(this
|
459
|
+
panel.show(this.#searchResultsElement);
|
458
460
|
}
|
459
|
-
this
|
461
|
+
this.#visiblePane = panel;
|
460
462
|
}
|
461
463
|
|
462
|
-
|
463
|
-
if (!this
|
464
|
-
this
|
464
|
+
#nothingFound(): void {
|
465
|
+
if (!this.#notFoundView) {
|
466
|
+
this.#notFoundView = new UI.EmptyWidget.EmptyWidget(
|
465
467
|
i18nString(UIStrings.noMatchesFound), i18nString(UIStrings.nothingMatchedTheQuery));
|
466
468
|
}
|
467
|
-
this
|
469
|
+
this.#showPane(this.#notFoundView);
|
468
470
|
}
|
469
471
|
|
470
|
-
|
472
|
+
#addSearchResult(searchResult: SearchResult): void {
|
471
473
|
const matchesCount = searchResult.matchesCount();
|
472
|
-
this
|
473
|
-
this
|
474
|
+
this.#searchMatchesCount += matchesCount;
|
475
|
+
this.#searchResultsCount++;
|
474
476
|
if (matchesCount) {
|
475
|
-
this
|
477
|
+
this.#nonEmptySearchResultsCount++;
|
476
478
|
}
|
477
|
-
this
|
479
|
+
this.#updateSearchResultsMessage();
|
478
480
|
}
|
479
481
|
|
480
|
-
|
481
|
-
this
|
482
|
+
#searchFinished(finished: boolean): void {
|
483
|
+
this.#searchMessageElement.textContent =
|
482
484
|
finished ? i18nString(UIStrings.searchFinished) : i18nString(UIStrings.searchInterrupted);
|
483
485
|
}
|
484
486
|
|
485
487
|
override focus(): void {
|
486
|
-
this.
|
487
|
-
this.
|
488
|
+
this.#searchInputElement.focus();
|
489
|
+
this.#searchInputElement.select();
|
488
490
|
}
|
489
491
|
|
490
492
|
override willHide(): void {
|
491
|
-
this
|
493
|
+
this.#stopSearch();
|
492
494
|
}
|
493
495
|
|
494
|
-
|
495
|
-
this
|
496
|
+
#onQueryKeyDown(event: KeyboardEvent): void {
|
497
|
+
this.#save();
|
496
498
|
switch (event.keyCode) {
|
497
499
|
case UI.KeyboardShortcut.Keys.Enter.code:
|
498
|
-
this
|
500
|
+
this.#onRefresh();
|
499
501
|
break;
|
500
502
|
}
|
501
503
|
}
|
@@ -518,7 +520,7 @@ export class SearchView extends UI.Widget.VBox {
|
|
518
520
|
*
|
519
521
|
* @param event KeyboardEvent
|
520
522
|
*/
|
521
|
-
|
523
|
+
#onPanelKeyDown(event: KeyboardEvent): void {
|
522
524
|
const isMac = Host.Platform.isMac();
|
523
525
|
// "Command + Alt + ]" for Mac
|
524
526
|
const shouldShowAllForMac =
|
@@ -534,49 +536,61 @@ export class SearchView extends UI.Widget.VBox {
|
|
534
536
|
!isMac && event.ctrlKey && !event.metaKey && event.shiftKey && event.code === 'BracketLeft';
|
535
537
|
|
536
538
|
if (shouldShowAllForMac || shouldShowAllForOtherPlatforms) {
|
537
|
-
this
|
539
|
+
this.#searchResultsPane?.showAllMatches();
|
538
540
|
void VisualLogging.logKeyDown(event.currentTarget, event, 'show-all-matches');
|
539
541
|
} else if (shouldCollapseAllForMac || shouldCollapseAllForOtherPlatforms) {
|
540
|
-
this
|
542
|
+
this.#searchResultsPane?.collapseAllResults();
|
541
543
|
void VisualLogging.logKeyDown(event.currentTarget, event, 'collapse-all-results');
|
542
544
|
}
|
543
545
|
}
|
544
546
|
|
545
|
-
|
546
|
-
this
|
547
|
+
#save(): void {
|
548
|
+
this.#advancedSearchConfig.set(this.#buildSearchConfig().toPlainObject());
|
547
549
|
}
|
548
550
|
|
549
|
-
|
550
|
-
const searchConfig = Workspace.SearchConfig.SearchConfig.fromPlainObject(this
|
551
|
-
this.
|
551
|
+
#load(): void {
|
552
|
+
const searchConfig = Workspace.SearchConfig.SearchConfig.fromPlainObject(this.#advancedSearchConfig.get());
|
553
|
+
this.#searchInputElement.value = searchConfig.query();
|
552
554
|
|
553
|
-
this
|
554
|
-
this
|
555
|
+
this.#matchCaseButton.toggled = !searchConfig.ignoreCase();
|
556
|
+
this.#onToggleMatchCase();
|
555
557
|
|
556
|
-
this
|
557
|
-
this
|
558
|
+
this.#regexButton.toggled = searchConfig.isRegex();
|
559
|
+
this.#onToggleRegex();
|
558
560
|
}
|
559
561
|
|
560
|
-
|
561
|
-
const searchConfig = this
|
562
|
+
#onRefresh(): void {
|
563
|
+
const searchConfig = this.#buildSearchConfig();
|
562
564
|
if (!searchConfig.query()?.length) {
|
563
565
|
return;
|
564
566
|
}
|
565
|
-
this
|
566
|
-
++this
|
567
|
-
this
|
568
|
-
if (!this
|
569
|
-
this
|
567
|
+
this.#resetSearch();
|
568
|
+
++this.#searchId;
|
569
|
+
this.#initScope();
|
570
|
+
if (!this.#isIndexing) {
|
571
|
+
this.#startIndexing();
|
570
572
|
}
|
571
|
-
this
|
573
|
+
this.#pendingSearchConfig = searchConfig;
|
572
574
|
}
|
573
575
|
|
574
|
-
|
575
|
-
this
|
576
|
-
this
|
576
|
+
#onClearSearch(): void {
|
577
|
+
this.#resetSearch();
|
578
|
+
this.#onClearSearchInput();
|
577
579
|
}
|
578
580
|
|
579
581
|
get throttlerForTest(): Common.Throttler.Throttler {
|
580
582
|
return this.#throttler;
|
581
583
|
}
|
584
|
+
|
585
|
+
get search(): HTMLInputElement {
|
586
|
+
return this.#searchInputElement;
|
587
|
+
}
|
588
|
+
|
589
|
+
get matchCaseButton(): Buttons.Button.Button {
|
590
|
+
return this.#matchCaseButton;
|
591
|
+
}
|
592
|
+
|
593
|
+
get regexButton(): Buttons.Button.Button {
|
594
|
+
return this.#regexButton;
|
595
|
+
}
|
582
596
|
}
|
@@ -591,7 +591,7 @@ export class ShortcutListItem {
|
|
591
591
|
const activeElement = Platform.DOMUtilities.deepActiveElement(document);
|
592
592
|
for (const [shortcut, shortcutInput] of this.shortcutInputs.entries()) {
|
593
593
|
if (activeElement === shortcutInput) {
|
594
|
-
this.onShortcutInputKeyDown(shortcut, shortcutInput as HTMLInputElement, event
|
594
|
+
this.onShortcutInputKeyDown(shortcut, shortcutInput as HTMLInputElement, event);
|
595
595
|
}
|
596
596
|
}
|
597
597
|
}
|