chrome-devtools-frontend 1.0.1568864 → 1.0.1569477
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/front_end/core/common/ParsedURL.ts +3 -0
- package/front_end/core/host/AidaClient.ts +1 -0
- package/front_end/core/root/Runtime.ts +4 -8
- package/front_end/entrypoints/main/MainImpl.ts +17 -20
- package/front_end/generated/SupportedCSSProperties.js +14 -14
- package/front_end/models/ai_assistance/agents/PatchAgent.ts +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +12 -0
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +12 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +4 -1
- package/front_end/models/stack_trace/StackTraceImpl.ts +12 -2
- package/front_end/models/stack_trace/StackTraceModel.ts +9 -1
- package/front_end/models/trace/Styles.ts +11 -8
- package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +3 -2
- package/front_end/models/trace/types/TraceEvents.ts +19 -10
- package/front_end/panels/common/AiCodeGenerationTeaser.ts +1 -1
- package/front_end/panels/elements/ElementsPanel.ts +6 -3
- package/front_end/panels/elements/ElementsSidebarPane.ts +5 -2
- package/front_end/panels/elements/MetricsSidebarPane.ts +192 -177
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +3 -11
- package/front_end/panels/settings/SettingsScreen.ts +8 -38
- package/front_end/panels/settings/settingsScreen.css +0 -4
- package/front_end/panels/sources/BreakpointEditDialog.ts +203 -138
- package/front_end/panels/sources/DebuggerPlugin.ts +15 -7
- package/front_end/panels/timeline/TimelineUIUtils.ts +9 -3
- package/front_end/panels/timeline/TimingsTrackAppender.ts +1 -0
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +3 -1
- package/front_end/panels/timeline/timelineFlameChartView.css +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +23 -1
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +16 -4
- package/front_end/ui/kit/link/Link.ts +14 -8
- package/front_end/ui/kit/link/link.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
|
@@ -11,12 +11,13 @@ import * as SDK from '../../core/sdk/sdk.js';
|
|
|
11
11
|
import type * as BreakpointManager from '../../models/breakpoints/breakpoints.js';
|
|
12
12
|
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
13
13
|
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
|
14
|
-
import {createIcon} from '../../ui/kit/kit.js';
|
|
15
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
15
|
+
import {Directives, html, render} from '../../ui/lit/lit.js';
|
|
16
16
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
17
17
|
|
|
18
18
|
import breakpointEditDialogStyles from './breakpointEditDialog.css.js';
|
|
19
19
|
|
|
20
|
+
const {ref} = Directives;
|
|
20
21
|
const {Direction} = TextEditor.TextEditorHistory;
|
|
21
22
|
|
|
22
23
|
const UIStrings = {
|
|
@@ -73,191 +74,255 @@ export interface BreakpointEditDialogResult {
|
|
|
73
74
|
isLogpoint: boolean;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
interface ViewInput {
|
|
78
|
+
state: CodeMirror.EditorState;
|
|
79
|
+
breakpointType: SDK.DebuggerModel.BreakpointType.LOGPOINT|SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT;
|
|
80
|
+
editorLineNumber: number;
|
|
81
|
+
onTypeChanged(breakpointType: SDK.DebuggerModel.BreakpointType): void;
|
|
82
|
+
saveAndFinish(): void;
|
|
83
|
+
}
|
|
84
|
+
interface ViewOutput {
|
|
85
|
+
editor: TextEditor.TextEditor.TextEditor|undefined;
|
|
86
|
+
}
|
|
87
|
+
type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
|
|
88
|
+
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
89
|
+
const editorRef = (e: Element|undefined): void => {
|
|
90
|
+
output.editor = e as TextEditor.TextEditor.TextEditor;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const onTypeChanged = (event: Event): void => {
|
|
94
|
+
if (event.target instanceof HTMLSelectElement && event.target.selectedOptions.length === 1) {
|
|
95
|
+
input.onTypeChanged(event.target.selectedOptions.item(0)?.value as SDK.DebuggerModel.BreakpointType);
|
|
96
|
+
}
|
|
97
|
+
output.editor?.focus();
|
|
98
|
+
};
|
|
82
99
|
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
// clang-format off
|
|
101
|
+
render(html`
|
|
102
|
+
<style>${breakpointEditDialogStyles}</style>
|
|
103
|
+
<div class=dialog-header>
|
|
104
|
+
<devtools-toolbar class=source-frame-breakpoint-toolbar>Line ${input.editorLineNumber + 1}:
|
|
105
|
+
<select
|
|
106
|
+
class=type-selector
|
|
107
|
+
title=${input.breakpointType === SDK.DebuggerModel.BreakpointType.LOGPOINT
|
|
108
|
+
? i18nString(UIStrings.logAMessageToConsoleDoNotBreak)
|
|
109
|
+
: i18nString(UIStrings.pauseOnlyWhenTheConditionIsTrue)}
|
|
110
|
+
aria-label=${i18nString(UIStrings.breakpointType)}
|
|
111
|
+
jslog=${VisualLogging.dropDown('type').track({change: true})}
|
|
112
|
+
@change=${onTypeChanged}>
|
|
113
|
+
<option value=${SDK.DebuggerModel.BreakpointType.REGULAR_BREAKPOINT}>
|
|
114
|
+
${i18nString(UIStrings.breakpoint)}
|
|
115
|
+
</option>
|
|
116
|
+
<option
|
|
117
|
+
value=${SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT}
|
|
118
|
+
.selected=${input.breakpointType === SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT}>
|
|
119
|
+
${i18nString(UIStrings.conditionalBreakpoint)}
|
|
120
|
+
</option>
|
|
121
|
+
<option
|
|
122
|
+
value=${SDK.DebuggerModel.BreakpointType.LOGPOINT}
|
|
123
|
+
.selected=${input.breakpointType === SDK.DebuggerModel.BreakpointType.LOGPOINT}>
|
|
124
|
+
${i18nString(UIStrings.logpoint)}
|
|
125
|
+
</option>
|
|
126
|
+
</select>
|
|
127
|
+
</devtools-toolbar>
|
|
128
|
+
<devtools-icon
|
|
129
|
+
name=cross
|
|
130
|
+
title=${i18nString(UIStrings.closeDialog)}
|
|
131
|
+
jslog=${VisualLogging.close().track({click: true})}
|
|
132
|
+
@click=${input.saveAndFinish}>
|
|
133
|
+
</devtools-icon>
|
|
134
|
+
</div>
|
|
135
|
+
<div class=condition-editor jslog=${VisualLogging.textField().track({change: true})}>
|
|
136
|
+
<devtools-text-editor
|
|
137
|
+
${ref(editorRef)}
|
|
138
|
+
autofocus
|
|
139
|
+
.state=${input.state}
|
|
140
|
+
@focus=${() => output.editor?.focus()}></devtools-text-editor>
|
|
141
|
+
</div>
|
|
142
|
+
<div class=link-wrapper>
|
|
143
|
+
<devtools-icon name=open-externally class=link-icon></devtools-icon>
|
|
144
|
+
<x-link class="link devtools-link" tabindex="0" href="https://goo.gle/devtools-loc"
|
|
145
|
+
jslog=${VisualLogging.link('learn-more')}>${
|
|
146
|
+
i18nString(UIStrings.learnMoreOnBreakpointTypes)}</x-link>
|
|
147
|
+
</div>
|
|
148
|
+
`,
|
|
149
|
+
// clang-format on
|
|
150
|
+
target);
|
|
151
|
+
};
|
|
85
152
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
153
|
+
export class BreakpointEditDialog extends UI.Widget.Widget {
|
|
154
|
+
readonly #view: View;
|
|
155
|
+
readonly #history = new TextEditor.AutocompleteHistory.AutocompleteHistory(
|
|
156
|
+
Common.Settings.Settings.instance().createLocalSetting('breakpoint-condition-history', []));
|
|
157
|
+
#finished = false;
|
|
158
|
+
#editorLineNumber = 0;
|
|
159
|
+
#oldCondition = '';
|
|
160
|
+
#breakpointType: SDK.DebuggerModel.BreakpointType.LOGPOINT|SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT =
|
|
161
|
+
SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT;
|
|
162
|
+
#onFinish: (result: BreakpointEditDialogResult) => void = () => {};
|
|
163
|
+
#editor?: TextEditor.TextEditor.TextEditor;
|
|
164
|
+
#state?: CodeMirror.EditorState;
|
|
165
|
+
|
|
166
|
+
constructor(target?: HTMLElement, view = DEFAULT_VIEW) {
|
|
89
167
|
super({
|
|
90
168
|
jslog: `${VisualLogging.dialog('edit-breakpoint')}`,
|
|
91
169
|
useShadowDom: true,
|
|
170
|
+
delegatesFocus: true,
|
|
171
|
+
classes: ['sources-edit-breakpoint-dialog'],
|
|
92
172
|
});
|
|
93
|
-
this
|
|
173
|
+
this.#view = view;
|
|
94
174
|
|
|
95
|
-
const editorConfig = [
|
|
96
|
-
CodeMirror.javascript.javascriptLanguage,
|
|
97
|
-
TextEditor.Config.baseConfiguration(oldCondition || ''),
|
|
98
|
-
TextEditor.Config.closeBrackets.instance(),
|
|
99
|
-
TextEditor.Config.autocompletion.instance(),
|
|
100
|
-
CodeMirror.EditorView.lineWrapping,
|
|
101
|
-
TextEditor.Config.showCompletionHint,
|
|
102
|
-
TextEditor.Config.conservativeCompletion,
|
|
103
|
-
CodeMirror.javascript.javascriptLanguage.data.of({
|
|
104
|
-
autocomplete: (context: CodeMirror.CompletionContext) => this.#editorHistory.historyCompletions(context),
|
|
105
|
-
}),
|
|
106
|
-
CodeMirror.autocompletion(),
|
|
107
|
-
TextEditor.JavaScript.argumentHints(),
|
|
108
|
-
];
|
|
109
|
-
|
|
110
|
-
this.onFinish = onFinish;
|
|
111
|
-
this.finished = false;
|
|
112
175
|
this.element.tabIndex = -1;
|
|
176
|
+
}
|
|
113
177
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
178
|
+
get editorLineNumber(): number {
|
|
179
|
+
return this.#editorLineNumber;
|
|
180
|
+
}
|
|
181
|
+
set editorLineNumber(editorLineNumber: number) {
|
|
182
|
+
this.#editorLineNumber = editorLineNumber;
|
|
183
|
+
this.requestUpdate();
|
|
184
|
+
}
|
|
185
|
+
get oldCondition(): string {
|
|
186
|
+
return this.#oldCondition;
|
|
187
|
+
}
|
|
188
|
+
set oldCondition(oldCondition: string) {
|
|
189
|
+
this.#state = undefined;
|
|
190
|
+
this.#oldCondition = oldCondition;
|
|
191
|
+
this.requestUpdate();
|
|
192
|
+
}
|
|
193
|
+
get breakpointType(): SDK.DebuggerModel.BreakpointType {
|
|
194
|
+
return this.#breakpointType;
|
|
195
|
+
}
|
|
196
|
+
set breakpointType(
|
|
197
|
+
breakpointType: SDK.DebuggerModel.BreakpointType.LOGPOINT|
|
|
198
|
+
SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT) {
|
|
199
|
+
this.#breakpointType = breakpointType;
|
|
200
|
+
this.requestUpdate();
|
|
201
|
+
}
|
|
202
|
+
get onFinish(): (result: BreakpointEditDialogResult) => void {
|
|
203
|
+
return this.#onFinish;
|
|
204
|
+
}
|
|
205
|
+
set onFinish(onFinish: (result: BreakpointEditDialogResult) => void) {
|
|
206
|
+
this.#onFinish = onFinish;
|
|
207
|
+
this.requestUpdate();
|
|
208
|
+
}
|
|
118
209
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
210
|
+
override performUpdate(): void {
|
|
211
|
+
const input: ViewInput = {
|
|
212
|
+
state: this.#getEditorState(),
|
|
213
|
+
breakpointType: this.#breakpointType,
|
|
214
|
+
editorLineNumber: this.#editorLineNumber,
|
|
215
|
+
onTypeChanged: type => this.#typeChanged(type),
|
|
216
|
+
saveAndFinish: () => this.saveAndFinish(),
|
|
217
|
+
};
|
|
218
|
+
const that = this;
|
|
219
|
+
const output = {
|
|
220
|
+
get editor() {
|
|
221
|
+
return that.#editor;
|
|
222
|
+
},
|
|
223
|
+
set editor(editor) {
|
|
224
|
+
that.#editor = editor;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
this.#view(input, output, this.contentElement);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#getEditorState(): CodeMirror.EditorState {
|
|
231
|
+
if (this.#state) {
|
|
232
|
+
return this.#state;
|
|
233
|
+
}
|
|
234
|
+
const getPlaceholder = (): CodeMirror.Extension => {
|
|
235
|
+
if (this.#breakpointType === SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT) {
|
|
236
|
+
return CodeMirror.placeholder(i18nString(UIStrings.expressionToCheckBeforePausingEg));
|
|
237
|
+
}
|
|
238
|
+
if (this.#breakpointType === SDK.DebuggerModel.BreakpointType.LOGPOINT) {
|
|
239
|
+
return CodeMirror.placeholder(i18nString(UIStrings.logMessageEgXIsX));
|
|
240
|
+
}
|
|
241
|
+
return [];
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const history = (): TextEditor.TextEditorHistory.TextEditorHistory|undefined =>
|
|
245
|
+
this.#editor && new TextEditor.TextEditorHistory.TextEditorHistory(this.#editor, this.#history);
|
|
246
|
+
const autocomplete = (context: CodeMirror.CompletionContext): CodeMirror.CompletionResult|null =>
|
|
247
|
+
history()?.historyCompletions(context) ?? null;
|
|
248
|
+
const historyBack = (force: boolean): boolean => history()?.moveHistory(Direction.BACKWARD, force) ?? false;
|
|
249
|
+
const historyForward = (force: boolean): boolean => history()?.moveHistory(Direction.FORWARD, force) ?? false;
|
|
129
250
|
|
|
130
|
-
const content = oldCondition || '';
|
|
131
251
|
const finishIfComplete = (view: CodeMirror.EditorView): boolean => {
|
|
132
252
|
void TextEditor.JavaScript.isExpressionComplete(view.state.doc.toString()).then(complete => {
|
|
133
253
|
if (complete) {
|
|
134
|
-
this.finishEditing(true,
|
|
254
|
+
this.finishEditing(true, view.state.doc.toString());
|
|
135
255
|
} else {
|
|
136
256
|
CodeMirror.insertNewlineAndIndent(view);
|
|
137
257
|
}
|
|
138
258
|
});
|
|
139
259
|
return true;
|
|
140
260
|
};
|
|
261
|
+
|
|
141
262
|
const keymap = [
|
|
142
|
-
{key: 'ArrowUp', run: () =>
|
|
143
|
-
{key: 'ArrowDown', run: () =>
|
|
144
|
-
{mac: 'Ctrl-p', run: () =>
|
|
145
|
-
{mac: 'Ctrl-n', run: () =>
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
key: 'Enter',
|
|
152
|
-
run: finishIfComplete,
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: 'Shift-Enter',
|
|
156
|
-
run: CodeMirror.insertNewlineAndIndent,
|
|
157
|
-
},
|
|
263
|
+
{key: 'ArrowUp', run: () => historyBack(false)},
|
|
264
|
+
{key: 'ArrowDown', run: () => historyForward(false)},
|
|
265
|
+
{mac: 'Ctrl-p', run: () => historyBack(true)},
|
|
266
|
+
{mac: 'Ctrl-n', run: () => historyForward(true)},
|
|
267
|
+
{key: 'Mod-Enter', run: finishIfComplete},
|
|
268
|
+
{key: 'Enter', run: finishIfComplete},
|
|
269
|
+
{key: 'Shift-Enter', run: CodeMirror.insertNewlineAndIndent},
|
|
158
270
|
{
|
|
159
271
|
key: 'Escape',
|
|
160
272
|
run: () => {
|
|
161
273
|
this.finishEditing(false, '');
|
|
162
274
|
return true;
|
|
163
|
-
}
|
|
275
|
+
}
|
|
164
276
|
},
|
|
165
277
|
];
|
|
166
278
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
279
|
+
const editorConfig = [
|
|
280
|
+
CodeMirror.javascript.javascriptLanguage,
|
|
281
|
+
TextEditor.Config.baseConfiguration(this.oldCondition),
|
|
282
|
+
TextEditor.Config.closeBrackets.instance(),
|
|
283
|
+
TextEditor.Config.autocompletion.instance(),
|
|
284
|
+
CodeMirror.EditorView.lineWrapping,
|
|
285
|
+
TextEditor.Config.showCompletionHint,
|
|
286
|
+
TextEditor.Config.conservativeCompletion,
|
|
287
|
+
CodeMirror.javascript.javascriptLanguage.data.of({autocomplete}),
|
|
288
|
+
CodeMirror.autocompletion(),
|
|
289
|
+
TextEditor.JavaScript.argumentHints(),
|
|
290
|
+
];
|
|
172
291
|
|
|
173
|
-
this
|
|
174
|
-
doc:
|
|
175
|
-
selection: {anchor: 0, head:
|
|
292
|
+
this.#state = CodeMirror.EditorState.create({
|
|
293
|
+
doc: this.oldCondition,
|
|
294
|
+
selection: {anchor: 0, head: this.oldCondition.length},
|
|
176
295
|
extensions: [
|
|
177
|
-
|
|
296
|
+
new CodeMirror.Compartment().of(getPlaceholder()),
|
|
178
297
|
CodeMirror.keymap.of(keymap),
|
|
179
298
|
editorConfig,
|
|
180
299
|
],
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const closeIcon = createIcon('cross');
|
|
185
|
-
closeIcon.title = i18nString(UIStrings.closeDialog);
|
|
186
|
-
closeIcon.setAttribute('jslog', `${VisualLogging.close().track({click: true})}`);
|
|
187
|
-
closeIcon.onclick = () => this.finishEditing(true, this.editor.state.doc.toString());
|
|
188
|
-
header.appendChild(closeIcon);
|
|
189
|
-
|
|
190
|
-
this.#history = new TextEditor.AutocompleteHistory.AutocompleteHistory(
|
|
191
|
-
Common.Settings.Settings.instance().createLocalSetting('breakpoint-condition-history', []));
|
|
192
|
-
this.#editorHistory = new TextEditor.TextEditorHistory.TextEditorHistory(this.editor, this.#history);
|
|
193
|
-
|
|
194
|
-
const linkWrapper = this.contentElement.appendChild(document.createElement('div'));
|
|
195
|
-
linkWrapper.classList.add('link-wrapper');
|
|
196
|
-
const link = UI.Fragment.html`<x-link class="link devtools-link" tabindex="0" href="https://goo.gle/devtools-loc"
|
|
197
|
-
jslog="${VisualLogging.link('learn-more')}">${
|
|
198
|
-
i18nString(UIStrings.learnMoreOnBreakpointTypes)}</x-link>` as UI.XLink.XLink;
|
|
199
|
-
const linkIcon = createIcon('open-externally', 'link-icon');
|
|
200
|
-
link.prepend(linkIcon);
|
|
201
|
-
linkWrapper.appendChild(link);
|
|
202
|
-
|
|
203
|
-
this.updateTooltip();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
saveAndFinish(): void {
|
|
207
|
-
this.finishEditing(true, this.editor.state.doc.toString());
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
focusEditor(): void {
|
|
211
|
-
this.editor.editor.focus();
|
|
300
|
+
});
|
|
301
|
+
return this.#state;
|
|
212
302
|
}
|
|
213
303
|
|
|
214
|
-
|
|
215
|
-
if (
|
|
304
|
+
#typeChanged(breakpointType: SDK.DebuggerModel.BreakpointType): void {
|
|
305
|
+
if (breakpointType === SDK.DebuggerModel.BreakpointType.REGULAR_BREAKPOINT) {
|
|
216
306
|
this.finishEditing(true, '');
|
|
217
307
|
return;
|
|
218
308
|
}
|
|
219
|
-
this.
|
|
220
|
-
this.
|
|
221
|
-
this.updateTooltip();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
private get breakpointType(): string|null {
|
|
225
|
-
const option = this.typeSelector.selectedOption();
|
|
226
|
-
return option ? option.value : null;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
private getPlaceholder(): CodeMirror.Extension {
|
|
230
|
-
const type = this.breakpointType;
|
|
231
|
-
if (type === SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT) {
|
|
232
|
-
return CodeMirror.placeholder(i18nString(UIStrings.expressionToCheckBeforePausingEg));
|
|
233
|
-
}
|
|
234
|
-
if (type === SDK.DebuggerModel.BreakpointType.LOGPOINT) {
|
|
235
|
-
return CodeMirror.placeholder(i18nString(UIStrings.logMessageEgXIsX));
|
|
236
|
-
}
|
|
237
|
-
return [];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
private updateTooltip(): void {
|
|
241
|
-
const type = this.breakpointType;
|
|
242
|
-
if (type === SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT) {
|
|
243
|
-
UI.Tooltip.Tooltip.install((this.typeSelector.element), i18nString(UIStrings.pauseOnlyWhenTheConditionIsTrue));
|
|
244
|
-
} else if (type === SDK.DebuggerModel.BreakpointType.LOGPOINT) {
|
|
245
|
-
UI.Tooltip.Tooltip.install((this.typeSelector.element), i18nString(UIStrings.logAMessageToConsoleDoNotBreak));
|
|
246
|
-
}
|
|
309
|
+
this.breakpointType = breakpointType;
|
|
310
|
+
this.requestUpdate();
|
|
247
311
|
}
|
|
248
312
|
|
|
249
313
|
finishEditing(committed: boolean, condition: string): void {
|
|
250
|
-
if (this
|
|
314
|
+
if (this.#finished) {
|
|
251
315
|
return;
|
|
252
316
|
}
|
|
253
|
-
this
|
|
254
|
-
this.editor.remove();
|
|
317
|
+
this.#finished = true;
|
|
255
318
|
this.#history.pushHistoryItem(condition);
|
|
256
319
|
const isLogpoint = this.breakpointType === SDK.DebuggerModel.BreakpointType.LOGPOINT;
|
|
257
320
|
this.onFinish({committed, condition: condition as BreakpointManager.BreakpointManager.UserCondition, isLogpoint});
|
|
258
321
|
}
|
|
259
322
|
|
|
260
|
-
|
|
261
|
-
|
|
323
|
+
saveAndFinish(): void {
|
|
324
|
+
if (this.#editor) {
|
|
325
|
+
this.finishEditing(true, this.#editor.state.doc.toString());
|
|
326
|
+
}
|
|
262
327
|
}
|
|
263
328
|
}
|
|
@@ -479,7 +479,8 @@ export class DebuggerPlugin extends Plugin {
|
|
|
479
479
|
contextMenu.debugSection().appendItem(
|
|
480
480
|
i18nString(UIStrings.addBreakpoint),
|
|
481
481
|
this.createNewBreakpoint.bind(
|
|
482
|
-
this, line, EMPTY_BREAKPOINT_CONDITION,
|
|
482
|
+
this, line, EMPTY_BREAKPOINT_CONDITION,
|
|
483
|
+
/* enabled */ true, /* isLogpoint */ false),
|
|
483
484
|
{jslogContext: 'add-breakpoint'});
|
|
484
485
|
if (supportsConditionalBreakpoints) {
|
|
485
486
|
contextMenu.debugSection().appendItem(i18nString(UIStrings.addConditionalBreakpoint), () => {
|
|
@@ -491,7 +492,8 @@ export class DebuggerPlugin extends Plugin {
|
|
|
491
492
|
contextMenu.debugSection().appendItem(
|
|
492
493
|
i18nString(UIStrings.neverPauseHere),
|
|
493
494
|
this.createNewBreakpoint.bind(
|
|
494
|
-
this, line, NEVER_PAUSE_HERE_CONDITION, /* enabled */ true,
|
|
495
|
+
this, line, NEVER_PAUSE_HERE_CONDITION, /* enabled */ true,
|
|
496
|
+
/* isLogpoint */ false),
|
|
495
497
|
{jslogContext: 'never-pause-here'});
|
|
496
498
|
}
|
|
497
499
|
}
|
|
@@ -865,7 +867,12 @@ export class DebuggerPlugin extends Plugin {
|
|
|
865
867
|
const isLogpointForDialog = breakpoint?.isLogpoint() ?? Boolean(isLogpoint);
|
|
866
868
|
const decorationElement = document.createElement('div');
|
|
867
869
|
const compartment = new CodeMirror.Compartment();
|
|
868
|
-
const dialog = new BreakpointEditDialog(
|
|
870
|
+
const dialog = new BreakpointEditDialog();
|
|
871
|
+
dialog.editorLineNumber = line.number - 1;
|
|
872
|
+
dialog.oldCondition = oldCondition,
|
|
873
|
+
dialog.breakpointType = isLogpointForDialog ? SDK.DebuggerModel.BreakpointType.LOGPOINT :
|
|
874
|
+
SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT;
|
|
875
|
+
dialog.onFinish = async result => {
|
|
869
876
|
this.activeBreakpointDialog = null;
|
|
870
877
|
this.#activeBreakpointEditRequest = undefined;
|
|
871
878
|
dialog.detach();
|
|
@@ -883,7 +890,7 @@ export class DebuggerPlugin extends Plugin {
|
|
|
883
890
|
} else {
|
|
884
891
|
await this.createNewBreakpoint(line, result.condition, /* enabled */ true, result.isLogpoint);
|
|
885
892
|
}
|
|
886
|
-
}
|
|
893
|
+
};
|
|
887
894
|
editor.dispatch({
|
|
888
895
|
effects: CodeMirror.StateEffect.appendConfig.of(compartment.of(CodeMirror.EditorView.decorations.of(
|
|
889
896
|
CodeMirror.Decoration.set([CodeMirror.Decoration
|
|
@@ -909,7 +916,7 @@ export class DebuggerPlugin extends Plugin {
|
|
|
909
916
|
dialog.saveAndFinish();
|
|
910
917
|
this.#scheduledFinishingActiveDialog = false;
|
|
911
918
|
} else {
|
|
912
|
-
dialog.
|
|
919
|
+
dialog.focus();
|
|
913
920
|
}
|
|
914
921
|
}
|
|
915
922
|
}, 200);
|
|
@@ -918,7 +925,7 @@ export class DebuggerPlugin extends Plugin {
|
|
|
918
925
|
|
|
919
926
|
dialog.markAsExternallyManaged();
|
|
920
927
|
dialog.show(decorationElement);
|
|
921
|
-
dialog.
|
|
928
|
+
dialog.focus();
|
|
922
929
|
this.activeBreakpointDialog = dialog;
|
|
923
930
|
this.#activeBreakpointEditRequest = breakpointEditRequest;
|
|
924
931
|
|
|
@@ -1341,7 +1348,8 @@ export class DebuggerPlugin extends Plugin {
|
|
|
1341
1348
|
const line = this.editor.state.doc.lineAt(editorLocation);
|
|
1342
1349
|
const uiLocation = this.transformer.editorLocationToUILocation(line.number - 1, editorLocation - line.from);
|
|
1343
1350
|
void this.setBreakpoint(
|
|
1344
|
-
uiLocation.lineNumber, uiLocation.columnNumber, EMPTY_BREAKPOINT_CONDITION,
|
|
1351
|
+
uiLocation.lineNumber, uiLocation.columnNumber, EMPTY_BREAKPOINT_CONDITION,
|
|
1352
|
+
/* enabled */ true,
|
|
1345
1353
|
/* isLogpoint */ false);
|
|
1346
1354
|
}
|
|
1347
1355
|
}
|
|
@@ -822,15 +822,19 @@ export class TimelineUIUtils {
|
|
|
822
822
|
switch (event.name) {
|
|
823
823
|
case Trace.Types.Events.Name.MARK_LCP_CANDIDATE:
|
|
824
824
|
link = 'https://web.dev/lcp/';
|
|
825
|
-
name = '
|
|
825
|
+
name = 'Largest Contentful Paint';
|
|
826
826
|
break;
|
|
827
827
|
case Trace.Types.Events.Name.MARK_LCP_CANDIDATE_FOR_SOFT_NAVIGATION:
|
|
828
828
|
link = 'https://developer.chrome.com/docs/web-platform/soft-navigations-experiment';
|
|
829
|
-
name = '
|
|
829
|
+
name = 'Soft Largest Contentful Paint';
|
|
830
|
+
break;
|
|
831
|
+
case Trace.Types.Events.Name.SOFT_NAVIGATION_START:
|
|
832
|
+
link = 'https://developer.chrome.com/docs/web-platform/soft-navigations-experiment';
|
|
833
|
+
name = 'Soft Navigations';
|
|
830
834
|
break;
|
|
831
835
|
case Trace.Types.Events.Name.MARK_FCP:
|
|
832
836
|
link = 'https://web.dev/first-contentful-paint/';
|
|
833
|
-
name = '
|
|
837
|
+
name = 'First Contentful Paint';
|
|
834
838
|
break;
|
|
835
839
|
default:
|
|
836
840
|
break;
|
|
@@ -1017,6 +1021,8 @@ export class TimelineUIUtils {
|
|
|
1017
1021
|
if (url) {
|
|
1018
1022
|
contentHelper.appendElementRow(i18nString(UIStrings.url), LegacyComponents.Linkifier.Linkifier.linkifyURL(url));
|
|
1019
1023
|
}
|
|
1024
|
+
contentHelper.appendElementRow(
|
|
1025
|
+
i18nString(UIStrings.details), TimelineUIUtils.buildDetailsNodeForMarkerEvents(event));
|
|
1020
1026
|
}
|
|
1021
1027
|
|
|
1022
1028
|
if (Trace.Types.Events.isV8Compile(event)) {
|
|
@@ -162,6 +162,7 @@ export class TimingsTrackAppender implements TrackAppender {
|
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
164
|
* Gets the style for a page load marker event.
|
|
165
|
+
* TODO(paulirish): Unify with trace/Styles.ts markerDetailsForEvent. Currently only color is read, the rest is ignored.
|
|
165
166
|
*/
|
|
166
167
|
markerStyleForPageLoadEvent(markerEvent: Trace.Types.Events.PageLoadEvent): TimelineMarkerStyle {
|
|
167
168
|
const tallMarkerDashStyle = [6, 4];
|
|
@@ -1569,7 +1569,7 @@ export class Overlays extends EventTarget {
|
|
|
1569
1569
|
const {color} = Trace.Styles.markerDetailsForEvent(overlay.entries[0]);
|
|
1570
1570
|
const markersComponent = this.#createTimingsMarkerElement(overlay);
|
|
1571
1571
|
overlayElement.appendChild(markersComponent);
|
|
1572
|
-
overlayElement.style.
|
|
1572
|
+
overlayElement.style.setProperty('--marker-color', color);
|
|
1573
1573
|
return overlayElement;
|
|
1574
1574
|
}
|
|
1575
1575
|
default: {
|
|
@@ -1618,6 +1618,8 @@ export class Overlays extends EventTarget {
|
|
|
1618
1618
|
markers: HTMLElement, marker: HTMLElement): void {
|
|
1619
1619
|
if (Trace.Types.Events.isSoftNavigationStart(event)) {
|
|
1620
1620
|
name = 'Soft Nav';
|
|
1621
|
+
} else if (Trace.Types.Events.isSoftLargestContentfulPaintCandidate(event)) {
|
|
1622
|
+
name = 'Soft LCP';
|
|
1621
1623
|
}
|
|
1622
1624
|
|
|
1623
1625
|
const fieldResult = overlay.entryToFieldResult.get(event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: https://chromium.googlesource.com/chromium/src
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: 45ca275b4749431e27f80dc5defcf893accdf583
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -6,12 +6,14 @@ import * as Common from '../../../core/common/common.js';
|
|
|
6
6
|
import * as Host from '../../../core/host/host.js';
|
|
7
7
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
8
8
|
import * as AiCodeCompletion from '../../../models/ai_code_completion/ai_code_completion.js';
|
|
9
|
+
import * as AiCodeGeneration from '../../../models/ai_code_generation/ai_code_generation.js';
|
|
9
10
|
import * as PanelCommon from '../../../panels/common/common.js';
|
|
10
11
|
import * as CodeMirror from '../../../third_party/codemirror.next/codemirror.next.js';
|
|
11
12
|
import * as UI from '../../legacy/legacy.js';
|
|
12
13
|
import * as VisualLogging from '../../visual_logging/visual_logging.js';
|
|
13
14
|
|
|
14
15
|
import {AccessiblePlaceholder} from './AccessiblePlaceholder.js';
|
|
16
|
+
import {type AiCodeGenerationConfig, AiCodeGenerationProvider} from './AiCodeGenerationProvider.js';
|
|
15
17
|
import {
|
|
16
18
|
acceptAiAutoCompleteSuggestion,
|
|
17
19
|
aiAutoCompleteSuggestion,
|
|
@@ -68,6 +70,8 @@ export class AiCodeCompletionProvider {
|
|
|
68
70
|
#editor?: TextEditor;
|
|
69
71
|
#aiCodeCompletionCitations: Host.AidaClient.Citation[] = [];
|
|
70
72
|
#aiCodeCompletionConfig?: AiCodeCompletionConfig;
|
|
73
|
+
#aiCodeGenerationConfig?: AiCodeGenerationConfig;
|
|
74
|
+
#aiCodeGenerationProvider?: AiCodeGenerationProvider;
|
|
71
75
|
|
|
72
76
|
#boundOnUpdateAiCodeCompletionState = this.#updateAiCodeCompletionState.bind(this);
|
|
73
77
|
|
|
@@ -77,6 +81,18 @@ export class AiCodeCompletionProvider {
|
|
|
77
81
|
throw new Error('AI code completion feature is not enabled.');
|
|
78
82
|
}
|
|
79
83
|
this.#aiCodeCompletionConfig = aiCodeCompletionConfig;
|
|
84
|
+
if (AiCodeGeneration.AiCodeGeneration.AiCodeGeneration.isAiCodeGenerationEnabled(devtoolsLocale.locale)) {
|
|
85
|
+
this.#aiCodeGenerationConfig = {
|
|
86
|
+
generationContext: {
|
|
87
|
+
inferenceLanguage: this.#aiCodeCompletionConfig.completionContext.inferenceLanguage,
|
|
88
|
+
},
|
|
89
|
+
onSuggestionAccepted: this.#aiCodeCompletionConfig.onSuggestionAccepted.bind(this),
|
|
90
|
+
onRequestTriggered: this.#aiCodeCompletionConfig.onRequestTriggered.bind(this),
|
|
91
|
+
onResponseReceived: this.#aiCodeCompletionConfig.onResponseReceived.bind(this),
|
|
92
|
+
panel: this.#aiCodeCompletionConfig.panel,
|
|
93
|
+
};
|
|
94
|
+
this.#aiCodeGenerationProvider = AiCodeGenerationProvider.createInstance(this.#aiCodeGenerationConfig);
|
|
95
|
+
}
|
|
80
96
|
}
|
|
81
97
|
|
|
82
98
|
static createInstance(aiCodeCompletionConfig: AiCodeCompletionConfig): AiCodeCompletionProvider {
|
|
@@ -84,7 +100,7 @@ export class AiCodeCompletionProvider {
|
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
extension(): CodeMirror.Extension[] {
|
|
87
|
-
|
|
103
|
+
const extensions = [
|
|
88
104
|
CodeMirror.EditorView.updateListener.of(update => this.#triggerAiCodeCompletion(update)),
|
|
89
105
|
this.#teaserCompartment.of([]),
|
|
90
106
|
aiAutoCompleteSuggestion,
|
|
@@ -92,6 +108,10 @@ export class AiCodeCompletionProvider {
|
|
|
92
108
|
aiAutoCompleteSuggestionState,
|
|
93
109
|
CodeMirror.Prec.highest(CodeMirror.keymap.of(this.#editorKeymap())),
|
|
94
110
|
];
|
|
111
|
+
if (this.#aiCodeGenerationProvider) {
|
|
112
|
+
extensions.push(this.#aiCodeGenerationProvider.extension());
|
|
113
|
+
}
|
|
114
|
+
return extensions;
|
|
95
115
|
}
|
|
96
116
|
|
|
97
117
|
dispose(): void {
|
|
@@ -101,6 +121,7 @@ export class AiCodeCompletionProvider {
|
|
|
101
121
|
Host.AidaClient.HostConfigTracker.instance().removeEventListener(
|
|
102
122
|
Host.AidaClient.Events.AIDA_AVAILABILITY_CHANGED, this.#boundOnUpdateAiCodeCompletionState);
|
|
103
123
|
this.#cleanupAiCodeCompletion();
|
|
124
|
+
this.#aiCodeGenerationProvider?.dispose();
|
|
104
125
|
}
|
|
105
126
|
|
|
106
127
|
editorInitialized(editor: TextEditor): void {
|
|
@@ -116,6 +137,7 @@ export class AiCodeCompletionProvider {
|
|
|
116
137
|
Host.AidaClient.Events.AIDA_AVAILABILITY_CHANGED, this.#boundOnUpdateAiCodeCompletionState);
|
|
117
138
|
this.#aiCodeCompletionSetting.addChangeListener(this.#boundOnUpdateAiCodeCompletionState);
|
|
118
139
|
void this.#updateAiCodeCompletionState();
|
|
140
|
+
this.#aiCodeGenerationProvider?.editorInitialized(editor);
|
|
119
141
|
}
|
|
120
142
|
|
|
121
143
|
clearCache(): void {
|