chrome-devtools-frontend 1.0.943986 → 1.0.944427

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.
Files changed (37) hide show
  1. package/front_end/core/host/UserMetrics.ts +0 -1
  2. package/front_end/core/i18n/locales/en-US.json +0 -12
  3. package/front_end/core/i18n/locales/en-XL.json +0 -12
  4. package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -0
  5. package/front_end/core/sdk/OverlayModel.ts +0 -9
  6. package/front_end/core/sdk/sdk-meta.ts +0 -26
  7. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +0 -13
  8. package/front_end/entrypoints/main/MainImpl.ts +0 -2
  9. package/front_end/models/timeline_model/TimelineJSProfile.ts +3 -16
  10. package/front_end/models/timeline_model/TimelineModel.ts +0 -1
  11. package/front_end/panels/console/ConsolePinPane.ts +1 -0
  12. package/front_end/panels/console/ConsolePrompt.ts +121 -171
  13. package/front_end/panels/console/ConsoleView.ts +1 -1
  14. package/front_end/panels/console/consoleView.css +1 -1
  15. package/front_end/panels/css_overview/cssOverviewCompletedView.css +2 -2
  16. package/front_end/panels/elements/AccessibilityTreeUtils.ts +2 -1
  17. package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
  18. package/front_end/panels/elements/StyleEditorWidget.ts +13 -2
  19. package/front_end/panels/elements/StylePropertyHighlighter.ts +29 -19
  20. package/front_end/panels/elements/StylePropertyTreeElement.ts +7 -4
  21. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  22. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +27 -3
  23. package/front_end/panels/network/NetworkDataGridNode.ts +5 -1
  24. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
  25. package/front_end/panels/timeline/TimelineController.ts +0 -3
  26. package/front_end/third_party/codemirror.next/bundle.ts +3 -2
  27. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  28. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +32 -1
  29. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  30. package/front_end/third_party/codemirror.next/package.json +4 -4
  31. package/front_end/ui/components/text_editor/config.ts +34 -14
  32. package/front_end/ui/components/text_editor/javascript.ts +14 -9
  33. package/front_end/ui/components/text_editor/theme.ts +29 -4
  34. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
  35. package/front_end/ui/legacy/components/utils/Linkifier.ts +49 -79
  36. package/front_end/ui/legacy/themeColors.css +2 -0
  37. package/package.json +1 -1
@@ -3537,6 +3537,12 @@ interface CompletionConfig {
3537
3537
  */
3538
3538
  defaultKeymap?: boolean;
3539
3539
  /**
3540
+ By default, completions are shown below the cursor when there is
3541
+ space. Setting this to true will make the extension put the
3542
+ completions above the cursor when possible.
3543
+ */
3544
+ aboveCursor?: boolean;
3545
+ /**
3540
3546
  This can be used to add additional CSS classes to completion
3541
3547
  options.
3542
3548
  */
@@ -3739,6 +3745,14 @@ interface CompletionResult {
3739
3745
  Accept the current completion.
3740
3746
  */
3741
3747
  declare const acceptCompletion: Command;
3748
+ /**
3749
+ Explicitly start autocompletion.
3750
+ */
3751
+ declare const startCompletion: Command;
3752
+ /**
3753
+ Close the currently active completion.
3754
+ */
3755
+ declare const closeCompletion: Command;
3742
3756
 
3743
3757
  /**
3744
3758
  A completion source that will scan the document for words (using a
@@ -3755,6 +3769,10 @@ declare function autocompletion(config?: CompletionConfig): Extension;
3755
3769
  Returns the available completions as an array.
3756
3770
  */
3757
3771
  declare function currentCompletions(state: EditorState): readonly Completion[];
3772
+ /**
3773
+ Return the currently selected completion, if any.
3774
+ */
3775
+ declare function selectedCompletion(state: EditorState): Completion | null;
3758
3776
 
3759
3777
  /**
3760
3778
  Describes an element in your XML document schema.
@@ -5484,6 +5502,19 @@ declare function tooltips(config?: {
5484
5502
  those.
5485
5503
  */
5486
5504
  parent?: HTMLElement;
5505
+ /**
5506
+ By default, when figuring out whether there is room for a
5507
+ tooltip at a given position, the extension considers the entire
5508
+ space between 0,0 and `innerWidth`,`innerHeight` to be available
5509
+ for showing tooltips. You can provide a function here that
5510
+ returns an alternative rectangle.
5511
+ */
5512
+ tooltipSpace?: (view: EditorView) => {
5513
+ top: number;
5514
+ left: number;
5515
+ bottom: number;
5516
+ right: number;
5517
+ };
5487
5518
  }): Extension;
5488
5519
  /**
5489
5520
  Describes a tooltip. Values of this type, when provided through
@@ -5574,4 +5605,4 @@ declare function shell(): Promise<StreamLanguage<unknown>>;
5574
5605
  declare function wast(): Promise<typeof _codemirror_lang_wast>;
5575
5606
  declare function xml(): Promise<typeof _codemirror_lang_xml>;
5576
5607
 
5577
- export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, shell, showPanel, showTooltip, standardKeymap, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
5608
+ export { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, Command, Compartment, Completion, CompletionContext, CompletionResult, CompletionSource, Decoration, DecorationSet, EditorSelection, EditorState, EditorStateConfig, EditorView, Extension, Facet, GutterMarker, HighlightStyle, KeyBinding, LRParser, Language, LanguageSupport, Line$1 as Line, MatchDecorator, NodeProp, NodeSet, NodeType, Panel, Parser, Prec, Range, RangeSet, RangeSetBuilder, SelectionRange, StateEffect, StateEffectType, StateField, StreamLanguage, StreamParser, StringStream, StyleModule, SyntaxNode, Tag, TagStyle, Text, TextIterator, Tooltip, TooltipView, Transaction, TransactionSpec, Tree, TreeCursor, ViewPlugin, ViewUpdate, WidgetType, acceptCompletion, autocompletion, bracketMatching, clojure, closeBrackets, closeBracketsKeymap, closeCompletion, codeFolding, coffeescript, completeAnyWord, cpp, index_d$2 as css, currentCompletions, cursorMatchingBracket, cursorSubwordBackward, cursorSubwordForward, drawSelection, ensureSyntaxTree, foldGutter, foldKeymap, gutter, gutters, highlightSpecialChars, highlightTree, history, historyKeymap, index_d$1 as html, ifNotIn, indentLess, indentMore, indentOnInput, indentUnit, insertNewlineAndIndent, java, index_d as javascript, json, keymap, lineNumberMarkers, lineNumbers, markdown, php, placeholder, python, redo, redoSelection, scrollPastEnd, selectMatchingBracket, selectNextOccurrence, selectSubwordBackward, selectSubwordForward, selectedCompletion, shell, showPanel, showTooltip, standardKeymap, startCompletion, syntaxTree, tags, toggleComment, tooltips, undo, undoSelection, wast, xml };
@@ -1,2 +1,2 @@
1
- export{$ as insertNewlineAndIndent,_ as indentMore,A as java,a$ as StyleModule,a0 as selectMatchingBracket,a1 as selectSubwordBackward,a2 as selectSubwordForward,a3 as standardKeymap,a4 as toggleComment,a5 as codeFolding,a6 as foldGutter,a7 as foldKeymap,a8 as gutter,a9 as GutterMarker,a_ as TreeCursor,aA as ChangeDesc,aa as gutters,aB as ChangeSet,ab as lineNumberMarkers,aC as Compartment,ac as lineNumbers,aD as EditorState,ad as HighlightStyle,aE as Facet,ae as highlightTree,aF as SelectionRange,af as Tag,aG as StateEffect,ag as history,aH as StateEffectType,ah as historyKeymap,aI as StateField,ai as redo,aJ as Transaction,aj as redoSelection,aK as StreamLanguage,ak as undo,aL as StringStream,al as undoSelection,aM as Line,am as css,aN as Text,an as html,ao as javascript,aO as showTooltip,ap as ensureSyntaxTree,aP as tooltips,aQ as Decoration,aq as indentOnInput,aR as drawSelection,ar as indentUnit,aS as EditorView,as as bracketMatching,aT as highlightSpecialChars,at as showPanel,aU as MatchDecorator,au as Range,av as RangeSet,aV as placeholder,aw as RangeSetBuilder,aW as scrollPastEnd,aX as ViewPlugin,ax as selectNextOccurrence,ay as Annotation,aY as ViewUpdate,az as AnnotationType,aZ as WidgetType,B as json,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as completeAnyWord,o as keymap,P as Parser,Q as CompletionContext,R as currentCompletions,S as ifNotIn,T as Tree,t as tags,U as closeBrackets,V as closeBracketsKeymap,W as cursorMatchingBracket,x as clojure,X as cursorSubwordBackward,y as coffeescript,Y as cursorSubwordForward,z as cpp,Z as indentLess}from"./chunk/codemirror.js";
1
+ export{$ as cursorSubwordForward,_ as cursorSubwordBackward,A as java,a$ as ViewUpdate,a0 as indentLess,a1 as indentMore,a2 as insertNewlineAndIndent,a3 as selectMatchingBracket,a4 as selectSubwordBackward,a5 as selectSubwordForward,a6 as standardKeymap,a7 as toggleComment,a8 as codeFolding,a9 as foldGutter,a_ as ViewPlugin,aa as foldKeymap,aA as selectNextOccurrence,aB as Annotation,ab as gutter,aC as AnnotationType,ac as GutterMarker,aD as ChangeDesc,ad as gutters,aE as ChangeSet,ae as lineNumberMarkers,aF as Compartment,af as lineNumbers,aG as EditorState,ag as HighlightStyle,aH as Facet,ah as highlightTree,aI as SelectionRange,ai as Tag,aJ as StateEffect,aj as history,aK as StateEffectType,ak as historyKeymap,aL as StateField,al as redo,aM as Transaction,am as redoSelection,aN as StreamLanguage,an as undo,aO as StringStream,ao as undoSelection,aP as Line,ap as css,aQ as Text,aq as html,ar as javascript,aR as showTooltip,as as ensureSyntaxTree,aS as tooltips,aT as Decoration,at as indentOnInput,aU as drawSelection,au as indentUnit,aV as EditorView,av as bracketMatching,aW as highlightSpecialChars,aw as showPanel,aX as MatchDecorator,ax as Range,ay as RangeSet,aY as placeholder,az as RangeSetBuilder,aZ as scrollPastEnd,B as json,b0 as WidgetType,b1 as TreeCursor,b2 as StyleModule,D as markdown,e as LanguageSupport,F as php,g as NodeType,G as python,h as NodeSet,H as shell,I as wast,j as Language,J as xml,K as acceptCompletion,k as syntaxTree,L as LRParser,m as EditorSelection,M as autocompletion,N as NodeProp,n as Prec,O as closeCompletion,o as keymap,P as Parser,Q as completeAnyWord,R as CompletionContext,S as currentCompletions,T as Tree,t as tags,U as ifNotIn,V as selectedCompletion,W as startCompletion,x as clojure,X as closeBrackets,Y as closeBracketsKeymap,y as coffeescript,z as cpp,Z as cursorMatchingBracket}from"./chunk/codemirror.js";
2
2
 
@@ -3,7 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@codemirror/autocomplete": "0.19.5",
6
+ "@codemirror/autocomplete": "0.19.8",
7
7
  "@codemirror/closebrackets": "0.19.0",
8
8
  "@codemirror/commands": "0.19.5",
9
9
  "@codemirror/comment": "0.19.0",
@@ -28,11 +28,11 @@
28
28
  "@codemirror/panel": "0.19.0",
29
29
  "@codemirror/rangeset": "0.19.2",
30
30
  "@codemirror/search": "0.19.2",
31
- "@codemirror/state": "0.19.6",
31
+ "@codemirror/state": "0.19.5",
32
32
  "@codemirror/stream-parser": "0.19.2",
33
33
  "@codemirror/text": "0.19.5",
34
- "@codemirror/tooltip": "0.19.6",
35
- "@codemirror/view": "0.19.16",
34
+ "@codemirror/tooltip": "0.19.9",
35
+ "@codemirror/view": "0.19.20",
36
36
  "@lezer/common": "0.15.8",
37
37
  "@rollup/plugin-node-resolve": "^13.0.4",
38
38
  "rollup-plugin-dts": "^4.0.0",
@@ -68,7 +68,10 @@ export const tabMovesFocus = DynamicSetting.bool('textEditorTabMovesFocus', CM.k
68
68
  shift: (view: CM.EditorView): boolean => view.state.doc.length ? CM.indentLess(view) : false,
69
69
  }]));
70
70
 
71
- export const autocompletion = CM.autocompletion({icons: false});
71
+ export const autocompletion = CM.autocompletion({
72
+ icons: false,
73
+ optionClass: (option: CM.Completion): string => option.type === 'secondary' ? 'cm-secondaryCompletion' : '',
74
+ });
72
75
 
73
76
  export const sourcesAutocompletion = DynamicSetting.bool('textEditorAutocompletion', autocompletion);
74
77
 
@@ -185,7 +188,6 @@ const baseKeymap = CM.keymap.of([
185
188
  {key: 'Mod-d', run: CM.selectNextOccurrence},
186
189
  {key: 'Alt-ArrowLeft', mac: 'Ctrl-ArrowLeft', run: CM.cursorSubwordBackward, shift: CM.selectSubwordBackward},
187
190
  {key: 'Alt-ArrowRight', mac: 'Ctrl-ArrowRight', run: CM.cursorSubwordForward, shift: CM.selectSubwordForward},
188
- ...CM.closeBracketsKeymap,
189
191
  ...CM.standardKeymap,
190
192
  ...CM.historyKeymap,
191
193
  ]);
@@ -201,6 +203,15 @@ export function theme(): CM.Extension {
201
203
  return [editorTheme, themeIsDark() ? dummyDarkTheme : []];
202
204
  }
203
205
 
206
+ let sideBarElement: HTMLElement|null = null;
207
+
208
+ function getTooltipSpace(): DOMRect {
209
+ if (!sideBarElement) {
210
+ sideBarElement = document.querySelector('[slot="insertion-point-sidebar"]');
211
+ }
212
+ return (sideBarElement || document.body).getBoundingClientRect();
213
+ }
214
+
204
215
  export function baseConfiguration(text: string): CM.Extension {
205
216
  return [
206
217
  theme(),
@@ -210,7 +221,6 @@ export function baseConfiguration(text: string): CM.Extension {
210
221
  CM.EditorState.allowMultipleSelections.of(true),
211
222
  CM.indentOnInput(),
212
223
  CodeHighlighter.CodeHighlighter.highlightStyle,
213
- CM.closeBrackets(),
214
224
  baseKeymap,
215
225
  tabMovesFocus.instance(),
216
226
  bracketMatching.instance(),
@@ -218,10 +228,18 @@ export function baseConfiguration(text: string): CM.Extension {
218
228
  CM.Prec.lowest(CM.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.codeEditor)})),
219
229
  detectLineSeparator(text),
220
230
  autocompletion,
221
- CM.tooltips({parent: getTooltipHost() as unknown as HTMLElement}),
231
+ CM.tooltips({
232
+ parent: getTooltipHost() as unknown as HTMLElement,
233
+ tooltipSpace: getTooltipSpace,
234
+ }),
222
235
  ];
223
236
  }
224
237
 
238
+ export const closeBrackets: CM.Extension = [
239
+ CM.closeBrackets(),
240
+ CM.keymap.of(CM.closeBracketsKeymap),
241
+ ];
242
+
225
243
  // Root editor tooltips at the top of the document, creating a special
226
244
  // element with the editor styles mounted in it for them. This is
227
245
  // annoying, but necessary because a scrollable parent node clips them
@@ -287,12 +305,16 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
287
305
  }
288
306
 
289
307
  topCompletion(state: CM.EditorState): string|null {
290
- const completions = CM.currentCompletions(state);
291
- if (!completions.length) {
308
+ const completion = CM.selectedCompletion(state);
309
+ if (!completion) {
292
310
  return null;
293
311
  }
294
- const {label} = completions[0];
295
- if (label.length > 100 || label.indexOf('\n') > -1) {
312
+ let {label, apply} = completion;
313
+ if (typeof apply === 'string') {
314
+ label = apply;
315
+ apply = undefined;
316
+ }
317
+ if (apply || label.length > 100 || label.indexOf('\n') > -1 || completion.type === 'secondary') {
296
318
  return null;
297
319
  }
298
320
  const pos = state.selection.main.head;
@@ -300,13 +322,11 @@ export const showCompletionHint = CM.ViewPlugin.fromClass(class {
300
322
  if (pos !== lineBefore.to) {
301
323
  return null;
302
324
  }
303
- const textBefore = lineBefore.text.slice(0, pos - lineBefore.from);
304
- for (let i = label.length - 1; i > 0; i--) {
305
- if (textBefore.endsWith(label.slice(0, i)) && !/\w/.test(textBefore.charAt(textBefore.length - i - 1))) {
306
- return label.slice(i);
307
- }
325
+ const wordBefore = /[\w$]+$/.exec(lineBefore.text);
326
+ if (wordBefore && !label.startsWith(wordBefore[0])) {
327
+ return null;
308
328
  }
309
- return null;
329
+ return label.slice(wordBefore ? wordBefore[0].length : 0);
310
330
  }
311
331
  }, {decorations: p => p.decorations});
312
332
 
@@ -90,7 +90,7 @@ export const enum QueryType {
90
90
  PropertyExpression = 2,
91
91
  }
92
92
 
93
- export function getQueryType(tree: CodeMirror.Tree, pos: number): {
93
+ export function getQueryType(tree: CodeMirror.Tree, pos: number, doc: CodeMirror.Text): {
94
94
  type: QueryType,
95
95
  from?: number,
96
96
  relatedNode?: CodeMirror.SyntaxNode,
@@ -101,13 +101,15 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number): {
101
101
  return null;
102
102
  }
103
103
 
104
- if (node.name === 'VariableName') {
105
- return {type: QueryType.Expression, from: node.from};
106
- }
107
104
  if (node.name === 'PropertyName') {
108
105
  return parent?.name !== 'MemberExpression' ? null :
109
106
  {type: QueryType.PropertyName, from: node.from, relatedNode: parent};
110
107
  }
108
+ if (node.name === 'VariableName' ||
109
+ // Treat alphabetic keywords as variables
110
+ !node.firstChild && node.to - node.from < 20 && !/[^a-z]/.test(doc.sliceString(node.from, node.to))) {
111
+ return {type: QueryType.Expression, from: node.from};
112
+ }
111
113
  if (node.name === 'String') {
112
114
  const parent = node.parent;
113
115
  return parent?.name === 'MemberExpression' && parent.childBefore(node.from)?.name === '[' ?
@@ -134,8 +136,8 @@ export function getQueryType(tree: CodeMirror.Tree, pos: number): {
134
136
 
135
137
  export async function javascriptCompletionSource(cx: CodeMirror.CompletionContext):
136
138
  Promise<CodeMirror.CompletionResult|null> {
137
- const query = getQueryType(CodeMirror.syntaxTree(cx.state), cx.pos);
138
- if (!query || query.from === undefined && !cx.explicit) {
139
+ const query = getQueryType(CodeMirror.syntaxTree(cx.state), cx.pos, cx.state.doc);
140
+ if (!query || query.from === undefined && !cx.explicit && query.type === QueryType.Expression) {
139
141
  return null;
140
142
  }
141
143
 
@@ -162,7 +164,8 @@ export async function javascriptCompletionSource(cx: CodeMirror.CompletionContex
162
164
  if (!objectExpr) {
163
165
  return null;
164
166
  }
165
- result = await completeProperties(cx.state.sliceDoc(objectExpr.from, objectExpr.to), quote);
167
+ result = await completeProperties(
168
+ cx.state.sliceDoc(objectExpr.from, objectExpr.to), quote, cx.state.sliceDoc(cx.pos, cx.pos + 1) === ']');
166
169
  } else {
167
170
  return null;
168
171
  }
@@ -250,6 +253,7 @@ class PropertyCache {
250
253
  async function completeProperties(
251
254
  expression: string,
252
255
  quoted?: string,
256
+ hasBracket: boolean = false,
253
257
  ): Promise<CompletionSet> {
254
258
  const cache = PropertyCache.instance();
255
259
  if (!quoted) {
@@ -262,7 +266,7 @@ async function completeProperties(
262
266
  if (!context) {
263
267
  return new CompletionSet();
264
268
  }
265
- const result = completePropertiesInner(expression, context, quoted);
269
+ const result = completePropertiesInner(expression, context, quoted, hasBracket);
266
270
  if (!quoted) {
267
271
  cache.set(expression, result);
268
272
  }
@@ -275,6 +279,7 @@ async function completePropertiesInner(
275
279
  expression: string,
276
280
  context: SDK.RuntimeModel.ExecutionContext,
277
281
  quoted?: string,
282
+ hasBracket: boolean = false,
278
283
  ): Promise<CompletionSet> {
279
284
  const result = new CompletionSet();
280
285
  if (!context) {
@@ -313,7 +318,7 @@ async function completePropertiesInner(
313
318
  label,
314
319
  type: prop.value?.type === 'function' ? functionType : otherType,
315
320
  };
316
- if (quoted) {
321
+ if (quoted && !hasBracket) {
317
322
  completion.apply = label + ']';
318
323
  }
319
324
  if (!prop.isOwn) {
@@ -18,7 +18,7 @@ export const editorTheme = CM.EditorView.theme({
18
18
  fontSize: 'var(--source-code-font-size)',
19
19
  },
20
20
 
21
- '.cm-panels, .cm-tooltip': {
21
+ '.cm-panels': {
22
22
  backgroundColor: 'var(--color-background-elevation-1)',
23
23
  },
24
24
 
@@ -110,25 +110,50 @@ export const editorTheme = CM.EditorView.theme({
110
110
  color: 'var(--color-text-secondary)',
111
111
  },
112
112
 
113
+ '.cm-tooltip': {
114
+ boxShadow: 'var(--drop-shadow)',
115
+ backgroundColor: 'var(--color-background-elevation-1)',
116
+ },
117
+
113
118
  '.cm-argumentHints': {
114
119
  pointerEvents: 'none',
115
120
  padding: '0 4px',
116
121
  whiteSpace: 'nowrap',
117
122
  lineHeight: '20px',
118
123
  marginBottom: '4px',
119
- boxShadow: 'var(--drop-shadow)',
120
- backgroundColor: 'var(--color-background)',
121
124
  width: 'fit-content',
122
125
  },
123
126
 
124
127
  '.cm-tooltip.cm-tooltip-autocomplete > ul': {
128
+ backgroundColor: 'var(--color-background)',
125
129
  minWidth: '16em',
130
+ '& > li.cm-secondaryCompletion': {
131
+ display: 'flex',
132
+ backgroundColor: 'var(--color-background-elevation-1)',
133
+ justifyContent: 'space-between',
134
+ '&::before': {
135
+ content: '">"',
136
+ fontWeight: 'bold',
137
+ color: 'var(--color-primary-variant)',
138
+ marginRight: '5px',
139
+ },
140
+ },
141
+ '& > li:hover': {
142
+ backgroundColor: 'var(--item-hover-color)',
143
+ },
126
144
  '& > li[aria-selected]': {
127
145
  backgroundColor: 'var(--color-selected-option-background)',
128
- color: 'var(--color-selected-option)',
146
+ '&, &.cm-secondaryCompletion::before': {
147
+ color: 'var(--color-selected-option)',
148
+ },
129
149
  },
130
150
  },
131
151
 
152
+ '.cm-completionMatchedText': {
153
+ textDecoration: 'none',
154
+ fontWeight: 'bold',
155
+ },
156
+
132
157
  '.cm-highlightedLine': {
133
158
  animation: 'cm-fading-highlight 2s 0s',
134
159
  },
@@ -206,6 +206,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
206
206
  return [
207
207
  CodeMirror.EditorView.updateListener.of(update => this.dispatchEventToListeners(Events.EditorUpdate, update)),
208
208
  TextEditor.Config.baseConfiguration(doc),
209
+ TextEditor.Config.closeBrackets,
209
210
  TextEditor.Config.sourcesAutocompletion.instance(),
210
211
  TextEditor.Config.showWhitespace.instance(),
211
212
  TextEditor.Config.allowScrollPastEof.instance(),
@@ -184,17 +184,9 @@ export class Linkifier implements SDK.TargetManager.Observer {
184
184
  }
185
185
  info.liveLocation = null;
186
186
  Linkifier.unbindUILocation(anchor);
187
- const fallback = (info.fallback as HTMLElement | null);
187
+ const fallback = info.fallback;
188
188
  if (fallback) {
189
- // @ts-ignore
190
- anchor.href = fallback.href;
191
- UI.Tooltip.Tooltip.install(anchor, fallback.title);
192
- anchor.className = fallback.className;
193
- anchor.textContent = fallback.textContent;
194
- const fallbackInfo = infoByAnchor.get(fallback);
195
- if (fallbackInfo) {
196
- infoByAnchor.set(anchor, fallbackInfo);
197
- }
189
+ anchor.replaceWith(fallback);
198
190
  }
199
191
  }
200
192
  }
@@ -249,15 +241,11 @@ export class Linkifier implements SDK.TargetManager.Observer {
249
241
  // Not initialising the anchor element with 'zero width space' (\u200b) causes a crash
250
242
  // in the layout engine.
251
243
  // TODO(szuend): Remove comment and workaround once the crash is fixed.
252
- const anchor = Linkifier.createLink(
244
+ const {link, linkInfo} = Linkifier.createLink(
253
245
  fallbackAnchor && fallbackAnchor.textContent ? fallbackAnchor.textContent : '\u200b', className,
254
246
  createLinkOptions);
255
- const info = Linkifier.linkInfo(anchor);
256
- if (!info) {
257
- return fallbackAnchor;
258
- }
259
- info.enableDecorator = this.useLinkDecorator;
260
- info.fallback = fallbackAnchor;
247
+ linkInfo.enableDecorator = this.useLinkDecorator;
248
+ linkInfo.fallback = fallbackAnchor;
261
249
 
262
250
  const pool = this.locationPoolByTarget.get(rawLocation.debuggerModel.target());
263
251
  if (!pool) {
@@ -268,10 +256,10 @@ export class Linkifier implements SDK.TargetManager.Observer {
268
256
 
269
257
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
270
258
  Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
271
- .createLiveLocation(rawLocation, this.updateAnchor.bind(this, anchor, linkDisplayOptions), pool)
259
+ .createLiveLocation(rawLocation, this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
272
260
  .then(liveLocation => {
273
261
  if (liveLocation) {
274
- info.liveLocation = liveLocation;
262
+ linkInfo.liveLocation = liveLocation;
275
263
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
276
264
  // @ts-expect-error
277
265
  currentOnLiveLocationUpdate();
@@ -279,8 +267,8 @@ export class Linkifier implements SDK.TargetManager.Observer {
279
267
  });
280
268
 
281
269
  const anchors = (this.anchorsByTarget.get(rawLocation.debuggerModel.target()) as Element[]);
282
- anchors.push(anchor);
283
- return anchor;
270
+ anchors.push(link);
271
+ return link;
284
272
  }
285
273
 
286
274
  linkifyScriptLocation(
@@ -327,68 +315,61 @@ export class Linkifier implements SDK.TargetManager.Observer {
327
315
  target, callFrame.scriptId, callFrame.url, callFrame.lineNumber, linkifyOptions);
328
316
  }
329
317
 
330
- linkifyStackTraceTopFrame(target: SDK.Target.Target, stackTrace: Protocol.Runtime.StackTrace, classes?: string):
318
+ linkifyStackTraceTopFrame(target: SDK.Target.Target, stackTrace: Protocol.Runtime.StackTrace, className?: string):
331
319
  HTMLElement {
332
- console.assert(Boolean(stackTrace.callFrames) && Boolean(stackTrace.callFrames.length));
320
+ console.assert(stackTrace.callFrames.length > 0);
333
321
 
334
- const topFrame = stackTrace.callFrames[0];
335
- const fallbackAnchor = Linkifier.linkifyURL(topFrame.url, {
336
- className: classes,
337
- lineNumber: topFrame.lineNumber,
338
- columnNumber: topFrame.columnNumber,
322
+ const {url, lineNumber, columnNumber} = stackTrace.callFrames[0];
323
+ const fallbackAnchor = Linkifier.linkifyURL(url, {
324
+ className,
325
+ lineNumber,
326
+ columnNumber,
339
327
  showColumnNumber: false,
340
328
  inlineFrameIndex: 0,
341
329
  maxLength: this.maxLength,
342
330
  text: undefined,
343
- preventClick: undefined,
331
+ preventClick: true,
344
332
  tabStop: undefined,
345
333
  bypassURLTrimming: undefined,
346
334
  });
347
- if (target.isDisposed()) {
348
- return fallbackAnchor;
349
- }
350
335
 
351
- const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel);
352
- if (!debuggerModel) {
353
- return fallbackAnchor;
354
- }
355
- const rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTrace);
356
- if (rawLocations.length === 0) {
336
+ // The contract is that disposed targets don't have a LiveLocationPool
337
+ // associated, whereas all active targets have one such pool. This ensures
338
+ // that the fallbackAnchor is only ever used when the target was disposed.
339
+ const pool = this.locationPoolByTarget.get(target);
340
+ if (!pool) {
341
+ console.assert(target.isDisposed());
357
342
  return fallbackAnchor;
358
343
  }
344
+ console.assert(!target.isDisposed());
345
+
346
+ // All targets that can report stack traces also have a debugger model.
347
+ const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel) as SDK.DebuggerModel.DebuggerModel;
359
348
 
360
349
  // Not initialising the anchor element with 'zero width space' (\u200b) causes a crash
361
350
  // in the layout engine.
362
351
  // TODO(szuend): Remove comment and workaround once the crash is fixed.
363
- const anchor = Linkifier.createLink('\u200b', classes || '');
364
- const info = Linkifier.linkInfo(anchor);
365
- if (!info) {
366
- return fallbackAnchor;
367
- }
368
- info.enableDecorator = this.useLinkDecorator;
369
- info.fallback = fallbackAnchor;
370
-
371
- const pool = this.locationPoolByTarget.get(target);
372
- if (!pool) {
373
- return fallbackAnchor;
374
- }
352
+ const {link, linkInfo} = Linkifier.createLink('\u200b', className ?? '');
353
+ linkInfo.enableDecorator = this.useLinkDecorator;
354
+ linkInfo.fallback = fallbackAnchor;
375
355
 
376
356
  const linkDisplayOptions = {showColumnNumber: false};
377
357
 
378
358
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
379
359
  Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance()
380
360
  .createStackTraceTopFrameLiveLocation(
381
- rawLocations, this.updateAnchor.bind(this, anchor, linkDisplayOptions), pool)
361
+ debuggerModel.createRawLocationsByStackTrace(stackTrace),
362
+ this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
382
363
  .then(liveLocation => {
383
- info.liveLocation = liveLocation;
364
+ linkInfo.liveLocation = liveLocation;
384
365
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
385
366
  // @ts-expect-error
386
367
  currentOnLiveLocationUpdate();
387
368
  });
388
369
 
389
370
  const anchors = (this.anchorsByTarget.get(target) as Element[]);
390
- anchors.push(anchor);
391
- return anchor;
371
+ anchors.push(link);
372
+ return link;
392
373
  }
393
374
 
394
375
  linkifyCSSLocation(rawLocation: SDK.CSSModel.CSSLocation, classes?: string): Element {
@@ -403,33 +384,29 @@ export class Linkifier implements SDK.TargetManager.Observer {
403
384
  // Not initialising the anchor element with 'zero width space' (\u200b) causes a crash
404
385
  // in the layout engine.
405
386
  // TODO(szuend): Remove comment and workaround once the crash is fixed.
406
- const anchor = (Linkifier.createLink('\u200b', classes || '', createLinkOptions) as HTMLElement);
407
- const info = Linkifier.linkInfo(anchor);
408
- if (!info) {
409
- return anchor;
410
- }
411
- info.enableDecorator = this.useLinkDecorator;
387
+ const {link, linkInfo} = Linkifier.createLink('\u200b', classes || '', createLinkOptions);
388
+ linkInfo.enableDecorator = this.useLinkDecorator;
412
389
 
413
390
  const pool = this.locationPoolByTarget.get(rawLocation.cssModel().target());
414
391
  if (!pool) {
415
- return anchor;
392
+ return link;
416
393
  }
417
394
 
418
395
  const linkDisplayOptions = {showColumnNumber: false};
419
396
 
420
397
  const currentOnLiveLocationUpdate = this.onLiveLocationUpdate;
421
398
  Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance()
422
- .createLiveLocation(rawLocation, this.updateAnchor.bind(this, anchor, linkDisplayOptions), pool)
399
+ .createLiveLocation(rawLocation, this.updateAnchor.bind(this, link, linkDisplayOptions), pool)
423
400
  .then(liveLocation => {
424
- info.liveLocation = liveLocation;
401
+ linkInfo.liveLocation = liveLocation;
425
402
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
426
403
  // @ts-expect-error
427
404
  currentOnLiveLocationUpdate();
428
405
  });
429
406
 
430
407
  const anchors = (this.anchorsByTarget.get(rawLocation.cssModel().target()) as Element[]);
431
- anchors.push(anchor);
432
- return anchor;
408
+ anchors.push(link);
409
+ return link;
433
410
  }
434
411
 
435
412
  reset(): void {
@@ -557,16 +534,12 @@ export class Linkifier implements SDK.TargetManager.Observer {
557
534
  }
558
535
  const title = linkText !== url ? url : '';
559
536
  const linkOptions = {maxLength, title, href: url, preventClick, tabStop: options.tabStop, bypassURLTrimming};
560
- const link = Linkifier.createLink(linkText, className, linkOptions);
561
- const info = Linkifier.linkInfo(link);
562
- if (!info) {
563
- return link;
564
- }
537
+ const {link, linkInfo} = Linkifier.createLink(linkText, className, linkOptions);
565
538
  if (lineNumber) {
566
- info.lineNumber = lineNumber;
539
+ linkInfo.lineNumber = lineNumber;
567
540
  }
568
541
  if (columnNumber) {
569
- info.columnNumber = columnNumber;
542
+ linkInfo.columnNumber = columnNumber;
570
543
  }
571
544
  return link;
572
545
  }
@@ -582,16 +555,13 @@ export class Linkifier implements SDK.TargetManager.Observer {
582
555
  tabStop: undefined,
583
556
  bypassURLTrimming: undefined,
584
557
  };
585
- const link = Linkifier.createLink(text, className || '', createLinkOptions);
586
- const linkInfo = Linkifier.linkInfo(link);
587
- if (!linkInfo) {
588
- return link;
589
- }
558
+ const {link, linkInfo} = Linkifier.createLink(text, className || '', createLinkOptions);
590
559
  linkInfo.revealable = revealable;
591
560
  return link;
592
561
  }
593
562
 
594
- private static createLink(text: string|HTMLElement, className: string, options?: _CreateLinkOptions): HTMLElement {
563
+ private static createLink(text: string|HTMLElement, className: string, options?: _CreateLinkOptions):
564
+ {link: HTMLElement, linkInfo: _LinkInfo} {
595
565
  options = options || {
596
566
  maxLength: undefined,
597
567
  title: undefined,
@@ -654,7 +624,7 @@ export class Linkifier implements SDK.TargetManager.Observer {
654
624
  }
655
625
  UI.ARIAUtils.markAsLink(link);
656
626
  link.tabIndex = tabStop ? 0 : -1;
657
- return link;
627
+ return {link, linkInfo};
658
628
  }
659
629
 
660
630
  private static setTrimmedText(link: Element, text: string, maxLength?: number): void {
@@ -167,6 +167,7 @@
167
167
  --color-selected-option: #fff;
168
168
  --color-selected-option-background: #1a73e8;
169
169
  --color-highlighted-line: rgb(255 255 0 / 50%);
170
+ --color-completion-hover: rgb(56 121 217 / 10%);
170
171
  --color-search-match-border: rgb(128 128 128);
171
172
  --color-selected-search-match: var(--color-text-primary);
172
173
  --color-selected-search-match-background: rgb(241 234 0);
@@ -307,6 +308,7 @@
307
308
  --color-selected-option: #fff;
308
309
  --color-selected-option-background: #0e639c;
309
310
  --color-highlighted-line: hsl(133deg 100% 30% / 50%);
311
+ --color-completion-hover: rgb(56 121 217 / 10%);
310
312
  --color-search-match-border: rgb(128 128 128);
311
313
  --color-selected-search-match: #eee;
312
314
  --color-selected-search-match-background: hsl(133deg 100% 30%);
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
56
56
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
57
57
  },
58
- "version": "1.0.943986"
58
+ "version": "1.0.944427"
59
59
  }