Simon Zünd
2a9dd748cf
[formatter] Simplify AcornTokenzier for JavaScript formatting
...
The parser already produces a token stream, we don't need to tokenize
a second time (it also uses different options for some reason).
This greatly simplifies the logic in the AcornTokenzier, as we don't
need to sync a comment stream with a token stream. We can just dump
everything into a single array and iterate that.
The performance gains are negligable, but the code becomes much
simpler.
Drive-by: Remove tokenColumnStart as well, it was unused.
R=bmeurer@chromium.org
Bug: 333945853
Change-Id: Iea283c012765842c37e824740dd52ddab380bfed
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5465768
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org >
Commit-Queue: Simon Zünd <szuend@chromium.org >
2024-04-18 12:55:07 +00:00
Simon Zünd
10fa3cbf07
[formatter] Extract node.type into it's own variable in a hot function
...
Accessing 'type' of ESTree AST nodes is megamorphic. Doing this
repeatedly in an if-cascade in a hot loop is very costly.
This CL reduces the time it takes to parse and format two large
bundles (3.8MB and 11MB) from:
```
Formatting ./blitz.7dbe22a9.js (median): 1510.70 ms
Formatting ./workbench.web.main.js (median): 5784.81 ms
```
to
```
Formatting ./blitz.7dbe22a9.js (median): 1365.15 ms
Formatting ./workbench.web.main.js (median): 5023.51 ms
```
R=bmeurer@chromium.org
Bug: 333945853
Change-Id: If6b0ff55bc0f5ea2f1f1b7b1fc4523fbcd835952
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5463982
Commit-Queue: Simon Zünd <szuend@chromium.org >
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org >
2024-04-18 10:41:51 +00:00
Benedikt Meurer
4164e91fa6
[pretty-print] Don't insert additional spaces within template literals.
...
Fixed: chromium:1477210
Change-Id: I085c7a742a69ad8623af02e6cf1554e722c739c2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4987626
Commit-Queue: Simon Zünd <szuend@chromium.org >
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org >
Reviewed-by: Simon Zünd <szuend@chromium.org >
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org >
2023-10-30 09:53:58 +00:00
Benedikt Meurer
b1e60b7241
Correctly pretty-print top-level await.
...
Fixed: chromium:1381031
Also-By: alexrudenko@chromium.org
Change-Id: I758ce3c13b80299fc5cdeffba0a6f25dd2633238
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3998781
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org >
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org >
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org >
2022-11-03 09:16:30 +00:00
Jack Franklin
3a80260722
Inline type imports in front_end
...
This CL enables the `inline_type_imports` rule for devtools-frontend,
and is the result of running the auto-fixer to update all imports
accordingly.
Bug: 1319340
Change-Id: I303256476fd4e94f4505bbf4355c0070ac101aa9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3752799
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org >
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org >
2022-07-13 09:26:00 +00:00
Tim van der Lippe
12bcadba35
Migrate to private class members in entrypoints/
...
This also enables the ESLint rule for this folder
R=jacktfranklin@chromium.org
Bug: 1222126
Change-Id: I872ac654d4a37946aba75def17cc1f1aa8ad893c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3341610
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org >
Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org >
2021-12-16 10:31:28 +00:00
Tim van der Lippe
e343bdfafb
Migrate to private class fields in entrypoints/
...
R=szuend@chromium.org
Bug: 1222126
Change-Id: I6863d8180c6a44a0e607e860bbce89bf9d3642ca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3338351
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org >
Auto-Submit: Tim Van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Simon Zünd <szuend@chromium.org >
Commit-Queue: Simon Zünd <szuend@chromium.org >
2021-12-15 11:49:27 +00:00
Jan Scheffler
d5bf879558
[Underscore Migration] Migrate entrypoints
...
This patch is part of the underscore migration that adds the private
keyword to all properties that start with an underscore and removes the
underscore.
Bug:chromium:1207342
Change-Id: Iec114859ae3f46457bafa2d823e11add202c6eb2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3077887
Commit-Queue: Jan Scheffler <janscheffler@chromium.org >
Auto-Submit: Jan Scheffler <janscheffler@chromium.org >
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org >
2021-08-07 15:52:16 +00:00
Tim van der Lippe
c2cbf32af8
Remove no-unused-vars suppressions
...
We don't use this rule any longer. Therefore, any supression of
the rule is considered a no-op. (We use the typescript-eslint
version instead).
R=jacktfranklin@chromium.org
Bug: none
Change-Id: I13595fffc980db423ee8ad5d133fd187d0dbdbbb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3053746
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org >
Commit-Queue: Paul Lewis <aerotwist@chromium.org >
Reviewed-by: Paul Lewis <aerotwist@chromium.org >
2021-07-27 09:48:39 +00:00
Tim van der Lippe
877f04aa0e
Remove eslint-disable statements from type imports
...
We no longer use the no-unused-vars and instead use the version
of typescript-eslint. The latter can properly detect unused
type-import usages. Therefore, we can remove the eslint-disable
statements, which are essentially noops.
This CL is the result of replacing
```
import type (.*) // eslint-disable-line no-unused-vars
```
with
```
import type $1
```
R=jacktfranklin@chromium.org
Bug: none
Change-Id: I141edcb7125e414c405760af1e4058bfdc6e30f3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3048473
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org >
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org >
2021-07-26 12:53:27 +00:00
Tim van der Lippe
4965ccdd03
Update types packages
...
This includes the fixes for istanbul-reports and ESTree.
Some functional changes were required to make the type checker
happy again.
DISABLE_THIRD_PARTY_CHECK=Functional changes for types
R=jacktfranklin@chromium.org
Bug: none
Change-Id: I57964301d51b5e94cd6ca8a5453bdc51ca6d9758
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2933803
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org >
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org >
2021-06-02 16:36:54 +00:00
Tim van der Lippe
665f504502
Fix formatting for class definitions
...
The version of TypeScript we use now properly emits class field
definitions. Since this is an ES2022 feature, we need to bump
the version of Acorn to support parsing class field definitions.
Additionally, we need to update the formatter to handle the
spacing around the tokens in a class field definition.
We can revert the local patch to Acorn once
https://github.com/acornjs/acorn/pull/1041 is merged. I will
also work on updating the ESTree type definitions.
R=bmeurer@chromium.org
Bug: none
Change-Id: Id2232e6ce2d8a0a35002e87f181259bb60d26feb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2930379
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org >
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org >
2021-06-02 12:11:54 +00:00
Tim van der Lippe
c78a7193d7
Move ESTree types to acorn
...
Not every single ts_library invocation has (and should have) access
to the ESTree types. Therefore, re-export these types via Acorn,
which is the only user of these types.
This also improves the build performance, as we are no longer
rebuilding all of DevTools when these types change.
DISABLE_THIRD_PARTY_CHECK=Tsc cleanup
R=szuend@chromium.org
Bug: 1209844
Change-Id: Ib182ba4f7877d26eea844ac75180542ce2bac44a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2900444
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org >
Commit-Queue: Simon Zünd <szuend@chromium.org >
Reviewed-by: Simon Zünd <szuend@chromium.org >
2021-05-18 05:24:23 +00:00
Jack Franklin
a75ae7cbb3
Enforce import type when importing TS types.
...
Bug: none
Change-Id: I02ef1182143b7fe091ce92d59f04ac2188903e0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886925
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org >
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org >
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Mathias Bynens <mathias@chromium.org >
2021-05-11 14:00:22 +00:00
Tim van der Lippe
7256e5e754
Move formatter_worker to entrypoints/formatter_worker
...
R=aerotwist@chromium.org
Bug: 1187573
Change-Id: I12afe682c2781651ff7cdc1650843010e2c8cbfd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826294
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org >
Reviewed-by: Paul Lewis <aerotwist@chromium.org >
2021-04-15 10:30:32 +00:00