On my Windows PC using the Flutter repo (running `dartdev fix` from source) I see significant improvements:
flutter/packages/flutter/: 45s -> 15s
flutter/: 5m 23s -> 33s
These projects are clean so have no fixable errors, the improvements may be smaller where there are fixable errors and a larger proportion of time is spent resolving libraries.
Change-Id: Ie48baaa4ff8916112dab6639ae4e824e5b646ea8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308060
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The new annotation is intended to be used on members of class, enum or mixin to opt out the @visibleForTemplate visibility restriction cascaded from class- / enum- / mixin- level.
1. Throw warning if the annotation is added to a invalid target.
2. Update @visibleForTemplate diagnostics logic to opt out members annotated with @visibleOutsideTemplate.
Change-Id: Iec546fc7785cd45f39a1b2a2cc8849ef1cf9d04a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304825
Reviewed-by: Marya Belanger <mbelanger@google.com>
Auto-Submit: Ludi Zhan <ludizhan@google.com>
Commit-Queue: Ludi Zhan <ludizhan@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Running the check for whether to prompt about "dart fix" in the LSP server with the whole Flutter repo open took around 45s before, and around 0.45s after. Almost all time was spent resolving libraries but now resolution is skipped for any libraries that don't contain fixable errors.
In my testing, "dart fix" (from source) didn't see any significant gains (around 46s down to around 43s for flutter/packages/flutter in my testing).
Fixes https://github.com/dart-lang/sdk/issues/52633
Change-Id: I0db63f5d54c7c262fe16aeb825f817cf526199c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
These tests can be quite slow (around 90 seconds on my machine, out of 4-5 mins for a test run) but aren't actually testing a lot. Opting out of them when running all tests repeatedly makes things much faster.
The default is still for them to run, you need to explicitly opt-out to skip them.
Change-Id: Id1aff44f48e71059f6ca44ff17acbf3f86427d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The check normalises newlines from "actualContents", but "expectedContents" could also contain \r\n on Windows (at least it does for me), so this just normalises both.
The additional await/async is to prevent "Test failed after it already completed" warnings because this code is inside the call to test() (and not wrapping it, like the other .main() calls in the file).
Change-Id: Iac034efaf1a8a6dad4a21dc67a2dfdb74092dd22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is just a refactor with no functional changes.
To simplify future work of supporting both protocols against a single server, this removes some common functionality out of each server into the base server (or in this case, some base callbacks that operate on the base server).
It's important when the server runs with both protocols that we don't accidentally duplicate any work, so stripping down the servers (and callbacks) to only the protocol-specific parts should make this easier.
Change-Id: I040368078b992d0c41bd8de10b09e38d3957f004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
So, we don't have to recompute it at every symbol search.
For Flutter repository, searching for 'ButtonStyle' is 40% faster.
SHA: 47fe150674
Description: before
[mean: 56.4][stdDev: 1.471][min: 54.0][max: 61.0]
Description: own files
[mean: 35.0][stdDev: 1.308][min: 33.0][max: 38.0]
Change-Id: Id497bf4117bdfafeeccd04601fd0198e22624c0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305843
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL adds a quick fix for `avoid_multiple_declarations_per_line`. This fix work for var/const/final/late variables, both typed and untyped. The declarations are also correctly indented and comments between the declarations are kept.
Change-Id: Ic614e264a199405cc0b9ceaea55a27c848970cfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Before this change, using fix-all-on-save in VS Code would also remove unused imports:
```
"editor.codeActionsOnSave": {
"source.fixAll": true
}
```
This behaviour was a little inconsistent without iterative fix-all (it would not remove the imports if other fixes were applied). Iterative fix-all made it consistent, but this behaviour is not what many users want (for example if they'd temporarily commented out code).
With this change, imports will not be touched when using fix-all if it was invoked automatically by save. However, it's possible to retain the original behaviour by invoked listing the original fix, or (more efficiently) `source.organizeImports`) to run on-save:
```
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
}
```
Fixes https://github.com/dart-lang/sdk/issues/52046
Fixes https://github.com/Dart-Code/Dart-Code/issues/4561
Change-Id: If68a5d13c2c1c9a494be61872c942fca8a4dd35c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
I'm not sure how to convert the doc tests. They're currently depending
on being able to set up some state in the server that I can't reach
from the new test framework. I'm guessing that I might be able to define
dartdoc comments that would populate the data structures in the same way,
but if you can think of an easier approach I'd love to hear about it.
Change-Id: I20afcf0865c1a45b682444f8bce8c4e3c7fdc45c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305782
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
In a future CL I'd like to filter out whole libraries depending
on whether they could have a match. At this point the search, filtering,
and matching become entangled too much to bind them with outside
code in the server. Instead, it all will be the analyzer's concern.
Change-Id: Iefdadbf92046218b3a2607fbeadd37494522112e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>