Getting the line number from the clicked-on element is problematic with
pretty printed code where overly long lines get wrap and get "-" line
numbers. This CL just uses CodeMirror's gutterContextMenu instead to get
the proper line number.
Fixed: chromium:1143723
Change-Id: I86fdb5118bdf371a703c8553dfafbf66e5a61473
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2550688
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
This change advances the stream by manually setting the stream position to the next occurrence of the matched pattern.
Before this fix, the stream advanced by calling the codemirror api, stream.next(), which advances position by 1 every call. For longer patterns, this causes the debugger to slow down significantly or even freeze.
Fixed: 1127708
Change-Id: I5572b79216c8231d4c5b9148b991307684f1b4d5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2530735
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
This was disabled in response to a bug being filed against the Elements
panel after clicking 'Edit As HTML' on an element. When editing an
element as HTML, the window that appears doesn't look like an editor
and users probably aren't expecting 'editor-like' shortcuts like this.
(crbug.com/470435)
The sources panel is an editor (and looks like one) so we restore the
ctrl-x or ctrl-c behavior there, which is to cut or copy the current
line when there is no selection and the shortcut is used. These shorcuts
work the same way in VS Code.
Bug: chromium:1066415
Fixed: chromium:800028
Change-Id: I1a5f16705900c9caf14099d079dca2154bbb0ec6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2204101
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
This CL changes references to self.Common.settings (the global
instance of SDK.Common.Settings) over to
Common.Settings.Settings.instance(). To keep both TypeScript and
Closure happy we must make a method on the Settings class itself,
since it only allows private constructors to be accessed by static
methods on the class.
Bug: 1058320
Change-Id: I04afc8caf64acf29cdda13ef03ad05cfff4786a1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091450
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
This CL makes several improvements to the Infobar component.
Most notably, action(s) can now be taken directly from the Infobar
itself. Clients of the Infobar component can pass any number of action
buttons during construction depending on the context.
Infobar has three uses presently in DevTools;
two of those use cases are actionable and have been upgraded with
this new experience:
- "Pretty print this minified file?" now has a "Pretty-print" button
where users can directly pretty-print the file.
- "This script is blackboxed in the debugger" now has an "Unblackbox"
button, plus a "Configure" button that opens Blackboxing settings.
The layout has been updated to reflow responsively for narrow
window widths and high zoom. Accessibility considerations include:
- Keyboard navigation: Infobar itself can now gain focus and be
dismissed by pressing the Esc key. Pressing the Enter key will
open the Learn More section.
- Screen reader support: Infobar contents are read aloud in a natural
and predictable fashion. The ARIA "alert" role is used on the Infobar
text content.
- High contrast support: Infobar text and buttons are visible in high
contrast view. Note, the icons are not high-contrast compliant;
HC icon updates throughout DevTools is a future task.
Demo: https://i.imgur.com/kNjI4pA.gif
Bug: 1056348
Change-Id: Id2e695af367fb8f5a1c489fa8d3d94c8974458fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1981175
Commit-Queue: Brian Cui <brcui@microsoft.com>
Reviewed-by: Fabio Rocha <fabio.rocha@microsoft.com>
NOTE: this is a reupload of CL 1838270, targeting the new separate
DevTools repository.
https://chromium-review.googlesource.com/c/chromium/src/+/1838270
This PR addresses customer feedback received regarding scrolling
behavior for files viewed in the Sources tab. Currently, users are able
to scroll beyond the end of file, for all files at least two lines or
more in length. However, for extra-small files, this behavior is awkward
as the entire file fits inside the editor and scrolling is not needed.
As it turns out, this behavior is a feature. It is also present in
some other text editors, like VSCode. The purpose of scrolling past EOF
is to enable developers to scroll lines to the top of the file, even if
those lines are near the end of the file. After an informal discussion
with my peers, some prefer this feature, while others find it
unintuitive and distracting (myself included).
This change adds a new checkbox toggle option to the Sources setting:
"Allow scrolling past end of file"
When enabled (by default), the behavior is the same as it is now: users
may scroll beyond the end of file for all files >2 lines in length.
When disabled, the user may only scroll to the last line in the file,
and a scrollbar does NOT appear if the entire file fits inside the
editor. (When the editor is resized, a scrollbar appears as needed).
Animated GIF demo: https://i.imgur.com/zJytuf1.gif
Remark: the scroll past EoF feature is not native to CodeMirror and is
a Chromium specific customization for the Sources tab.
Bug: 998270
Change-Id: I79d11cf68c105aabe407269819f0495adfba44b7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1872878
Reviewed-by: Fabio Rocha <fabio.rocha@microsoft.com>
Reviewed-by: Robert Paveza <Rob.Paveza@microsoft.com>
Commit-Queue: Brian Cui <brcui@microsoft.com>
The Chromium/Google style guides does not enforce curly braces for
single-line if-statements, but does strongly recommend doing so. Adding
braces will improve code readability, by visually separating code
blocks. This will also prevent issues where accidental additions are
pushed to the "else"-clause instead of in the if-block.
This CL also updates the presubmit `eslint` to run the fix with the
correct configuration. It will now fix all issues it can fix.
Change-Id: I4b616f21a99393f168dec743c0bcbdc7f5db04a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821526
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jeff Fisher <jeffish@microsoft.com>
Cr-Original-Commit-Position: refs/heads/master@{#701070}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 7e0bdbe2d7f9fc2386bfaefda3cc29c66ccc18f9
The previous CL's CSS hack incorrectly cut off breakpoints, caused the
gutter to be transparent when scrolling code horizontally, and made
closed folding triangles invisible.
Bug: 328431
Change-Id: Iba9482efd4bfd13d750580746f5507dadd0c73b2
Reviewed-on: https://chromium-review.googlesource.com/c/1380557
Reviewed-by: Erik Luo <luoe@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#617362}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 87b1e4b4c4908281cb602c44f4a757fd653ec4b4