chrome-devtools-frontend 1.0.945329 → 1.0.946351
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/config/gni/all_devtools_files.gni +0 -5
- package/config/gni/devtools_grd_files.gni +1 -33
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/circled_exclamation_icon.svg +3 -0
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/i18n/locales/en-US.json +12 -12
- package/front_end/core/i18n/locales/en-XL.json +12 -12
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMetadata.ts +0 -1
- package/front_end/core/sdk/CSSProperty.ts +16 -9
- package/front_end/core/sdk/sdk-meta.ts +20 -8
- package/front_end/devtools_compatibility.js +0 -7
- package/front_end/entrypoints/devtools_app/devtools_app.js +3 -0
- package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
- package/front_end/entrypoints/js_app/js_app.js +3 -0
- package/front_end/entrypoints/js_app/js_app.json +1 -2
- package/front_end/entrypoints/main/MainImpl.ts +0 -6
- package/front_end/entrypoints/ndb_app/ndb_app.js +3 -0
- package/front_end/entrypoints/ndb_app/ndb_app.json +1 -2
- package/front_end/entrypoints/node_app/node_app.js +3 -0
- package/front_end/entrypoints/node_app/node_app.json +1 -2
- package/front_end/entrypoints/shell/shell.js +18 -1
- package/front_end/entrypoints/worker_app/worker_app.js +3 -0
- package/front_end/entrypoints/worker_app/worker_app.json +1 -2
- package/front_end/generated/protocol.d.ts +0 -4
- package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/emulation/EmulatedDevices.ts +2 -4
- package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
- package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
- package/front_end/models/text_utils/TextUtils.ts +1 -2
- package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
- package/front_end/panels/application/BackForwardCacheView.ts +8 -1
- package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -12
- package/front_end/panels/elements/StylesSidebarPane.ts +35 -9
- package/front_end/panels/elements/elementsTreeOutline.css +0 -13
- package/front_end/panels/network/NetworkConfigView.ts +10 -0
- package/front_end/panels/network/NetworkItemView.ts +10 -1
- package/front_end/panels/network/networkConfigView.css +5 -0
- package/front_end/panels/profiler/heapProfiler.css +2 -5
- package/front_end/panels/profiler/profilesPanel.css +1 -1
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +6 -4
- package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
- package/front_end/panels/sources/DebuggerPlugin.ts +6 -2
- package/front_end/panels/sources/sourcesView.css +0 -130
- package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
- package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
- package/front_end/ui/components/adorners/Adorner.ts +14 -14
- package/front_end/ui/components/buttons/Button.ts +133 -42
- package/front_end/ui/components/buttons/button.css +31 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +131 -122
- package/front_end/ui/components/data_grid/DataGridController.ts +42 -42
- package/front_end/ui/components/diff_view/DiffView.ts +4 -4
- package/front_end/ui/components/docs/button/basic.html +3 -0
- package/front_end/ui/components/docs/button/basic.ts +58 -0
- package/front_end/ui/components/expandable_list/ExpandableList.ts +11 -11
- package/front_end/ui/components/icon_button/Icon.ts +24 -21
- package/front_end/ui/components/icon_button/IconButton.ts +31 -31
- package/front_end/ui/components/issue_counter/IssueCounter.ts +52 -52
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +42 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +67 -67
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +22 -22
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +36 -36
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +19 -19
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +24 -32
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +52 -52
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +21 -21
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +14 -14
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +8 -8
- package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -6
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +33 -33
- package/front_end/ui/components/report_view/ReportView.ts +18 -18
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +53 -53
- package/front_end/ui/components/settings/SettingCheckbox.ts +15 -15
- package/front_end/ui/components/survey_link/SurveyLink.ts +28 -28
- package/front_end/ui/components/text_editor/TextEditor.ts +55 -52
- package/front_end/ui/components/text_editor/config.ts +3 -3
- package/front_end/ui/components/text_editor/javascript.ts +27 -9
- package/front_end/ui/components/text_editor/theme.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +19 -19
- package/front_end/ui/components/tree_outline/TreeOutline.ts +56 -56
- package/front_end/ui/legacy/Infobar.ts +9 -0
- package/front_end/ui/legacy/ListWidget.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
- package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
- package/front_end/ui/legacy/legacy-legacy.ts +0 -6
- package/front_end/ui/legacy/legacy.ts +0 -2
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/inspector_overlay/main.ts +12 -2
- package/package.json +1 -1
- package/scripts/check_gn.js +1 -1
- package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
- package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
- package/scripts/hosted_mode/server.js +17 -2
- package/front_end/entrypoints/shell/shell-meta-files.ts +0 -22
- package/front_end/entrypoints/shell/shell.json +0 -5
- package/front_end/ui/legacy/TextEditor.ts +0 -82
- package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
- package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
- package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
- package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
- package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
- package/front_end/ui/legacy/components/text_editor/module.json +0 -7
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
|
@@ -21,35 +21,36 @@ declare global {
|
|
|
21
21
|
export class TextEditor extends HTMLElement {
|
|
22
22
|
static readonly litTagName = LitHtml.literal`devtools-text-editor`;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
if (this
|
|
36
|
-
CodeMirror.repositionTooltips(this
|
|
24
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
25
|
+
#activeEditor: CodeMirror.EditorView|undefined = undefined;
|
|
26
|
+
#dynamicSettings: readonly DynamicSetting<unknown>[] = DynamicSetting.none;
|
|
27
|
+
#activeSettingListeners: [Common.Settings.Setting<unknown>, (event: {data: unknown}) => void][] = [];
|
|
28
|
+
#pendingState: CodeMirror.EditorState|undefined;
|
|
29
|
+
#lastScrollPos = {left: 0, top: 0};
|
|
30
|
+
#resizeTimeout = -1;
|
|
31
|
+
#resizeListener = (): void => {
|
|
32
|
+
if (this.#resizeTimeout < 0) {
|
|
33
|
+
this.#resizeTimeout = window.setTimeout(() => {
|
|
34
|
+
this.#resizeTimeout = -1;
|
|
35
|
+
if (this.#activeEditor) {
|
|
36
|
+
CodeMirror.repositionTooltips(this.#activeEditor);
|
|
37
37
|
}
|
|
38
38
|
}, 50);
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
|
+
#devtoolsResizeObserver = new ResizeObserver(this.#resizeListener);
|
|
41
42
|
|
|
42
43
|
constructor(pendingState?: CodeMirror.EditorState) {
|
|
43
44
|
super();
|
|
44
|
-
this
|
|
45
|
-
this
|
|
45
|
+
this.#pendingState = pendingState;
|
|
46
|
+
this.#shadow.adoptedStyleSheets = [CodeHighlighter.Style.default];
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
private createEditor(): CodeMirror.EditorView {
|
|
49
|
-
this
|
|
50
|
+
this.#activeEditor = new CodeMirror.EditorView({
|
|
50
51
|
state: this.state,
|
|
51
|
-
parent: this
|
|
52
|
-
root: this
|
|
52
|
+
parent: this.#shadow,
|
|
53
|
+
root: this.#shadow,
|
|
53
54
|
dispatch: (tr: CodeMirror.Transaction): void => {
|
|
54
55
|
this.editor.update([tr]);
|
|
55
56
|
if (tr.reconfigured) {
|
|
@@ -57,19 +58,19 @@ export class TextEditor extends HTMLElement {
|
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
});
|
|
60
|
-
this
|
|
61
|
-
this
|
|
62
|
-
this
|
|
63
|
-
this
|
|
64
|
-
this
|
|
61
|
+
this.#activeEditor.scrollDOM.scrollTop = this.#lastScrollPos.top;
|
|
62
|
+
this.#activeEditor.scrollDOM.scrollLeft = this.#lastScrollPos.left;
|
|
63
|
+
this.#activeEditor.scrollDOM.addEventListener('scroll', (event): void => {
|
|
64
|
+
this.#lastScrollPos.left = (event.target as HTMLElement).scrollLeft;
|
|
65
|
+
this.#lastScrollPos.top = (event.target as HTMLElement).scrollTop;
|
|
65
66
|
});
|
|
66
67
|
this.ensureSettingListeners();
|
|
67
68
|
this.startObservingResize();
|
|
68
|
-
return this
|
|
69
|
+
return this.#activeEditor;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
get editor(): CodeMirror.EditorView {
|
|
72
|
-
return this
|
|
73
|
+
return this.#activeEditor || this.createEditor();
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
dispatch(spec: CodeMirror.TransactionSpec): void {
|
|
@@ -77,68 +78,69 @@ export class TextEditor extends HTMLElement {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
get state(): CodeMirror.EditorState {
|
|
80
|
-
if (this
|
|
81
|
-
return this
|
|
81
|
+
if (this.#activeEditor) {
|
|
82
|
+
return this.#activeEditor.state;
|
|
82
83
|
}
|
|
83
|
-
if (!this
|
|
84
|
-
this
|
|
84
|
+
if (!this.#pendingState) {
|
|
85
|
+
this.#pendingState = CodeMirror.EditorState.create({extensions: baseConfiguration('')});
|
|
85
86
|
}
|
|
86
|
-
return this
|
|
87
|
+
return this.#pendingState;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
set state(state: CodeMirror.EditorState) {
|
|
90
|
-
if (this
|
|
91
|
-
this
|
|
91
|
+
if (this.#activeEditor) {
|
|
92
|
+
this.#activeEditor.setState(state);
|
|
92
93
|
} else {
|
|
93
|
-
this
|
|
94
|
+
this.#pendingState = state;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
connectedCallback(): void {
|
|
98
|
-
if (!this
|
|
99
|
+
if (!this.#activeEditor) {
|
|
99
100
|
this.createEditor();
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
disconnectedCallback(): void {
|
|
104
|
-
if (this
|
|
105
|
-
this
|
|
106
|
-
this
|
|
107
|
-
|
|
108
|
-
this.
|
|
105
|
+
if (this.#activeEditor) {
|
|
106
|
+
this.#pendingState = this.#activeEditor.state;
|
|
107
|
+
this.#devtoolsResizeObserver.disconnect();
|
|
108
|
+
window.removeEventListener('resize', this.#resizeListener);
|
|
109
|
+
this.#activeEditor.destroy();
|
|
110
|
+
this.#activeEditor = undefined;
|
|
109
111
|
this.ensureSettingListeners();
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
focus(): void {
|
|
114
|
-
if (this
|
|
115
|
-
this
|
|
116
|
+
if (this.#activeEditor) {
|
|
117
|
+
this.#activeEditor.focus();
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
private ensureSettingListeners(): void {
|
|
120
|
-
const dynamicSettings = this
|
|
121
|
-
if (dynamicSettings === this
|
|
122
|
+
const dynamicSettings = this.#activeEditor ? this.#activeEditor.state.facet(dynamicSetting) : DynamicSetting.none;
|
|
123
|
+
if (dynamicSettings === this.#dynamicSettings) {
|
|
122
124
|
return;
|
|
123
125
|
}
|
|
124
|
-
this
|
|
126
|
+
this.#dynamicSettings = dynamicSettings;
|
|
125
127
|
|
|
126
|
-
for (const [setting, listener] of this
|
|
128
|
+
for (const [setting, listener] of this.#activeSettingListeners) {
|
|
127
129
|
setting.removeChangeListener(listener);
|
|
128
130
|
}
|
|
129
|
-
this
|
|
131
|
+
this.#activeSettingListeners = [];
|
|
130
132
|
|
|
131
133
|
const settings = Common.Settings.Settings.instance();
|
|
132
134
|
for (const dynamicSetting of dynamicSettings) {
|
|
133
135
|
const handler = ({data}: {data: unknown}): void => {
|
|
134
136
|
const change = dynamicSetting.sync(this.state, data);
|
|
135
|
-
if (change && this
|
|
136
|
-
this
|
|
137
|
+
if (change && this.#activeEditor) {
|
|
138
|
+
this.#activeEditor.dispatch({effects: change});
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
const setting = settings.moduleSetting(dynamicSetting.settingName);
|
|
140
142
|
setting.addChangeListener(handler);
|
|
141
|
-
this
|
|
143
|
+
this.#activeSettingListeners.push([setting, handler]);
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -146,12 +148,13 @@ export class TextEditor extends HTMLElement {
|
|
|
146
148
|
const devtoolsElement =
|
|
147
149
|
WindowBoundsService.WindowBoundsService.WindowBoundsServiceImpl.instance().getDevToolsBoundingElement();
|
|
148
150
|
if (devtoolsElement) {
|
|
149
|
-
this
|
|
151
|
+
this.#devtoolsResizeObserver.observe(devtoolsElement);
|
|
150
152
|
}
|
|
153
|
+
window.addEventListener('resize', this.#resizeListener);
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
revealPosition(selection: CodeMirror.EditorSelection, highlight: boolean = true): void {
|
|
154
|
-
const view = this
|
|
157
|
+
const view = this.#activeEditor;
|
|
155
158
|
if (!view) {
|
|
156
159
|
return;
|
|
157
160
|
}
|
|
@@ -63,7 +63,7 @@ export class DynamicSetting<T> {
|
|
|
63
63
|
static none: readonly DynamicSetting<unknown>[] = [];
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.keymap.of([{
|
|
66
|
+
export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', [], CM.keymap.of([{
|
|
67
67
|
key: 'Tab',
|
|
68
68
|
run: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentMore(view) : false,
|
|
69
69
|
shift: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentLess(view) : false,
|
|
@@ -85,7 +85,7 @@ export function guessIndent(doc: CM.Text): string {
|
|
|
85
85
|
let scanned = 0;
|
|
86
86
|
for (let cur = doc.iterLines(1, Math.min(doc.lines + 1, LINES_TO_SCAN_FOR_INDENTATION_GUESSING)); !cur.next().done;) {
|
|
87
87
|
let space = (/^\s*/.exec(cur.value) as string[])[0];
|
|
88
|
-
if (space.length === cur.value.length || !space.length) {
|
|
88
|
+
if (space.length === cur.value.length || !space.length || cur.value[space.length] === '*') {
|
|
89
89
|
continue;
|
|
90
90
|
}
|
|
91
91
|
if (space[0] === '\t') {
|
|
@@ -324,7 +324,7 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
|
|
|
324
324
|
if (pos !== lineBefore.to) {
|
|
325
325
|
return null;
|
|
326
326
|
}
|
|
327
|
-
const wordBefore =
|
|
327
|
+
const wordBefore = /#?[\w$]+$/.exec(lineBefore.text);
|
|
328
328
|
if (wordBefore && !label.startsWith(wordBefore[0])) {
|
|
329
329
|
return null;
|
|
330
330
|
}
|
|
@@ -15,6 +15,23 @@ export function completion(): CodeMirror.Extension {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export async function completeInContext(
|
|
19
|
+
textBefore: string, query: string, force: boolean = false): Promise<UI.SuggestBox.Suggestions> {
|
|
20
|
+
const state = CodeMirror.EditorState.create({
|
|
21
|
+
doc: textBefore,
|
|
22
|
+
selection: {anchor: textBefore.length},
|
|
23
|
+
extensions: CodeMirror.javascript.javascriptLanguage,
|
|
24
|
+
});
|
|
25
|
+
const result = await javascriptCompletionSource(new CodeMirror.CompletionContext(state, textBefore.length, force));
|
|
26
|
+
return result ?
|
|
27
|
+
result.options.filter((o): boolean => o.label.startsWith(query)).map((o): UI.SuggestBox.Suggestion => ({
|
|
28
|
+
text: o.label,
|
|
29
|
+
priority: 100 + (o.boost || 0),
|
|
30
|
+
isSecondary: o.type === 'secondary',
|
|
31
|
+
})) :
|
|
32
|
+
[];
|
|
33
|
+
}
|
|
34
|
+
|
|
18
35
|
class CompletionSet {
|
|
19
36
|
constructor(
|
|
20
37
|
readonly completions: CodeMirror.Completion[] = [],
|
|
@@ -101,7 +118,7 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number, doc: CodeMirror
|
|
|
101
118
|
return null;
|
|
102
119
|
}
|
|
103
120
|
|
|
104
|
-
if (node.name === 'PropertyName') {
|
|
121
|
+
if (node.name === 'PropertyName' || node.name === 'PrivatePropertyName') {
|
|
105
122
|
return parent?.name !== 'MemberExpression' ? null :
|
|
106
123
|
{type: QueryType.PropertyName, from: node.from, relatedNode: parent};
|
|
107
124
|
}
|
|
@@ -172,7 +189,7 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
|
|
|
172
189
|
return {
|
|
173
190
|
from: query.from ?? cx.pos,
|
|
174
191
|
options: result.completions,
|
|
175
|
-
span:
|
|
192
|
+
span: /^#?[\w\P{ASCII}]*/u,
|
|
176
193
|
};
|
|
177
194
|
}
|
|
178
195
|
|
|
@@ -217,10 +234,10 @@ let cacheInstance: PropertyCache|null = null;
|
|
|
217
234
|
// Store recent collections of property completions. The empty string
|
|
218
235
|
// is used to store the set of global bindings.
|
|
219
236
|
class PropertyCache {
|
|
220
|
-
|
|
237
|
+
readonly #cache: Map<string, Promise<CompletionSet>> = new Map();
|
|
221
238
|
|
|
222
239
|
constructor() {
|
|
223
|
-
const clear = (): void => this
|
|
240
|
+
const clear = (): void => this.#cache.clear();
|
|
224
241
|
SDK.ConsoleModel.ConsoleModel.instance().addEventListener(SDK.ConsoleModel.Events.CommandEvaluated, clear);
|
|
225
242
|
UI.Context.Context.instance().addFlavorChangeListener(SDK.RuntimeModel.ExecutionContext, clear);
|
|
226
243
|
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
@@ -230,14 +247,14 @@ class PropertyCache {
|
|
|
230
247
|
}
|
|
231
248
|
|
|
232
249
|
get(expression: string): Promise<CompletionSet>|undefined {
|
|
233
|
-
return this
|
|
250
|
+
return this.#cache.get(expression);
|
|
234
251
|
}
|
|
235
252
|
|
|
236
253
|
set(expression: string, value: Promise<CompletionSet>): void {
|
|
237
|
-
this
|
|
254
|
+
this.#cache.set(expression, value);
|
|
238
255
|
setTimeout(() => {
|
|
239
|
-
if (this
|
|
240
|
-
this
|
|
256
|
+
if (this.#cache.get(expression) === value) {
|
|
257
|
+
this.#cache.delete(expression);
|
|
241
258
|
}
|
|
242
259
|
}, maxCacheAge);
|
|
243
260
|
}
|
|
@@ -312,7 +329,8 @@ async function completePropertiesInner(
|
|
|
312
329
|
const properties = await object.getAllProperties(false, false);
|
|
313
330
|
const isFunction = object.type === 'function';
|
|
314
331
|
for (const prop of properties.properties || []) {
|
|
315
|
-
if (!prop.symbol && !(isFunction && (prop.name === 'arguments' || prop.name === 'caller'))
|
|
332
|
+
if (!prop.symbol && !(isFunction && (prop.name === 'arguments' || prop.name === 'caller')) &&
|
|
333
|
+
(!prop.private || expression === 'this')) {
|
|
316
334
|
const label = quoted ? quoted + prop.name + quoted : prop.name;
|
|
317
335
|
const completion: CodeMirror.Completion = {
|
|
318
336
|
label,
|
|
@@ -26,27 +26,27 @@ export class PromptInputEvent extends Event {
|
|
|
26
26
|
|
|
27
27
|
export class TextPrompt extends HTMLElement {
|
|
28
28
|
static readonly litTagName = LitHtml.literal`devtools-text-prompt`;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
30
|
+
#ariaLabelText = '';
|
|
31
|
+
#prefixText = '';
|
|
32
|
+
#suggestionText = '';
|
|
33
33
|
|
|
34
34
|
connectedCallback(): void {
|
|
35
|
-
this
|
|
35
|
+
this.#shadow.adoptedStyleSheets = [textPromptStyles];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
set data(data: TextPromptData) {
|
|
39
|
-
this
|
|
40
|
-
this
|
|
41
|
-
this
|
|
39
|
+
this.#ariaLabelText = data.ariaLabel;
|
|
40
|
+
this.#prefixText = data.prefix;
|
|
41
|
+
this.#suggestionText = data.suggestion;
|
|
42
42
|
this.render();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
get data(): TextPromptData {
|
|
46
46
|
return {
|
|
47
|
-
ariaLabel: this
|
|
48
|
-
prefix: this
|
|
49
|
-
suggestion: this
|
|
47
|
+
ariaLabel: this.#ariaLabelText,
|
|
48
|
+
prefix: this.#prefixText,
|
|
49
|
+
suggestion: this.#suggestionText,
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ export class TextPrompt extends HTMLElement {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
private input(): HTMLInputElement {
|
|
58
|
-
const inputElement = this
|
|
58
|
+
const inputElement = this.#shadow.querySelector<HTMLInputElement>('input');
|
|
59
59
|
if (!inputElement) {
|
|
60
60
|
throw new Error('Expected an input element!');
|
|
61
61
|
}
|
|
@@ -92,12 +92,12 @@ export class TextPrompt extends HTMLElement {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
setPrefix(prefix: string): void {
|
|
95
|
-
this
|
|
95
|
+
this.#prefixText = prefix;
|
|
96
96
|
this.render();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
setSuggestion(suggestion: string): void {
|
|
100
|
-
this
|
|
100
|
+
this.#suggestionText = suggestion;
|
|
101
101
|
this.render();
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -112,7 +112,7 @@ export class TextPrompt extends HTMLElement {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
private suggestion(): HTMLSpanElement {
|
|
115
|
-
const suggestionElement = this
|
|
115
|
+
const suggestionElement = this.#shadow.querySelector<HTMLSpanElement>('.suggestion');
|
|
116
116
|
if (!suggestionElement) {
|
|
117
117
|
throw new Error('Expected an suggestion element!');
|
|
118
118
|
}
|
|
@@ -125,11 +125,11 @@ export class TextPrompt extends HTMLElement {
|
|
|
125
125
|
|
|
126
126
|
private render(): void {
|
|
127
127
|
const output = LitHtml.html`
|
|
128
|
-
<span class="prefix">${this
|
|
129
|
-
<span class="text-prompt-input"><input aria-label=${this
|
|
128
|
+
<span class="prefix">${this.#prefixText} </span>
|
|
129
|
+
<span class="text-prompt-input"><input aria-label=${this.#ariaLabelText} spellcheck="false" @input=${
|
|
130
130
|
this.onInput} @keydown=${this.onKeyDown}/><span class='suggestion' suggestion="${
|
|
131
|
-
this
|
|
132
|
-
LitHtml.render(output, this
|
|
131
|
+
this.#suggestionText}"></span></span>`;
|
|
132
|
+
LitHtml.render(output, this.#shadow, {host: this});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|