Commit Graph

543 Commits

Author SHA1 Message Date
Sam Rawlins bd700772ff analyzer: move testing utilities to analyzer_testing package
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: Iae062d95e5cf3b94b540496242b3627268ac2612
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428844
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-15 16:28:50 -07:00
Sam Rawlins eb03a1673d DAS: Use Diagnostic in place of deprecated AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0107a65580bc41d769c2a384319225b256df2fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-05 09:35:18 -07:00
Danny Tuppeny 59587b0e27 [analysis_server] Enable test newline normalization by default
+ fix several failing tests with this enabled.

See https://github.com/dart-lang/sdk/issues/60234

Change-Id: Ie71e1655bf2ab8ac651bfcf803884741863b42c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423801
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-22 10:23:12 -07:00
Sam Rawlins 5eef8e4ebe analyzer etc: move analysisOptionsContent function to be shared
This function was defined once in analyzer testing code, once in
linter testing code, and once in analysis_server testing code. In this
change, all three are combined into one function in analyzer_utilities.

Change-Id: Ib2daa7b3d14aae6ca2aa09f6f9bdeaf76bc72d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423068
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-21 13:01:36 -07:00
FMorschel f276d3c65b [cq] Using TestCode and normalizeSource for quick-fix tests
This change introduces `TestCode` and `normalizeSource` into the tests for quick fixes. The goal is to add these capabilities to `AbstractSingleUnitTest`, allowing a future update to replace offsets in tests with markers.

Bug: https://github.com/dart-lang/sdk/issues/60234
Change-Id: I760e6b5fb13b37d4e35278073a78f4d755deda64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415260
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-03-19 17:35:20 -07:00
Brian Wilkerson 38d8834c07 [cq] Reduce assignments to testCode to 1
The purpose for this change is to make it easier to use `TestCode` to
parse the code under test. This, in turn, will allow us to use the same
markdown in all of our test code, making it easier to write and read
our tests. This biggest blocker to that goal is the fact that we assign
to `testCode` in several places, and that's the problem solved by this
change.

Change-Id: Id88463925587ff0839fe75faf6a1d083a1b3320c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-15 07:34:29 -07:00
Brian Wilkerson e8e56ff2f5 Cleanup declarations in server with trailing digits
There are still lots of declarations whose name ends in a trailing
digit, but most of them are unrelated to the migration, and some
are required in order to not break internal code.

I'm happy to break this up into smaller CLs if it's hard to review.
Mostly it's just renaming some declarations, although there are one or
two places where I did a little more clean-up.

Change-Id: I50d32316e82e48c6a5a47aec630b4ffee2ead2c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410922
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-02-23 08:17:36 -08:00
Konstantin Shcheglov 2862fdfe1b Elements. Migrate test/services/correction/status_test.dart
Change-Id: Ie0afd64be7b90d68c81b05f2973557a5c562a431
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400165
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-12-12 07:23:48 -08:00
Brian Wilkerson 34d945cb7c Migrate more server tests
Change-Id: Iee3e6b6db9c58e9fcf790e2874f73c8eac6e660d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395404
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-15 21:57:47 +00:00
Sam Rawlins fbf331e0dd DAS: reformat source code with tall-style
Change-Id: I42b4a44fd6a2197e499e8623274b3cd1a4b5556f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394003
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 23:04:00 +00:00
Danny Tuppeny 97dafd74f5 [analysis_server] Consider sort_constructors_first lint when sorting
Fixes https://github.com/Dart-Code/Dart-Code/issues/4934

Change-Id: Ic6c739a2aaf6f62ecf0c2488a32f90c3f19738a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 20:04:49 +00:00
pq ecbf9ee568 [enhanced-parts] test "Sort Members" in a part w/ imports
Fixes: https://github.com/dart-lang/sdk/issues/56684

Change-Id: I259090327e82926d1c01dae1ce11b328e3f2e7cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384309
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-10 16:57:11 +00:00
Konstantin Shcheglov 2aa54ab42c Parts. Fix unnecessary_import before landing the reporting CL.
https://dart-review.googlesource.com/c/sdk/+/382901 will start
reporting it in more cases.

Change-Id: I3ae1d407f37a317f33cb98977b0e6eb08de75065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383221
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-09-03 03:51:29 +00:00
Sam Rawlins 1b400ed68d DAS plugins: Move CorrectionUtils to analysis_server_plugin
* Move the only 3 files from server_plugin to analysis_server_plugin.
* Copy some test infra into analysis_server_plugin. This is temporary,
  as we need some shared test infra location.

Change-Id: If2b41d436c9d3051e590f60ae2eb7ab31e529321
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364161
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-24 14:12:24 +00:00
Sam Rawlins 5c79627e08 Move CorrectionUtils addLibraryImports to ExtractMethod
`_getInsertionLocationTop` and `addLibraryImports` are each moved to
extract_method.dart, as the only location where they were used.

We get to delete the `_InsertionLocation` class.

The tests are also moved, unchanged, and CorrectionUtilsTest is very
much simplified.

Bug: https://github.com/dart-lang/sdk/issues/53402
Change-Id: Ia410f04a837d85a0e06ec523d156c6c6c8bf6a3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363402
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-17 22:12:28 +00:00
Konstantin Shcheglov 5c07c89a35 Enable 'unnecessary_final' in analysis_server/.
Change-Id: I71ee934b915d4aff924cf5925f87bcc9adc6c015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 20:04:15 +00:00
Sam Rawlins a8a42cffd2 Simplify some CorrectionUtils code
The big one is `getIndent`, which I think can be simpler, and also used a handwritten implementation of `String.operator *`. It turns out:

* > 90% of calls to `getIndent` were `getIndent(1)`, which can be
  replaced with a constant `'  '`.
* Then 4 calls to `getIndent` were `getIndent(2)`, which can be replaced
  with a constant `'  ' + '  '`.
* Then one last call, in CorrectionUtils itself, used a variable number
  of indents which can be replaced with `'  ' * n`. This is in the
  `indentRight` function.

Also:

* Privatize `getInsertionLocationTop`, `isClassWithEmptyBody`, `isJustWhitespaceOrComment`, `skipEmptyLinesLeft`
* Rewrite CorrectionUtils.findSimplePrintInvocation as an extension
  method on AstNode; does not need the `_buffer`.

Change-Id: I15c19b8c0cc354adcd4ffea5803b3a182cf28336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 17:05:49 +00:00
Konstantin Shcheglov 8968e5500a CQ. Enable avoid_redundant_argument_values in analysis_server/
Change-Id: If9c09f81bdbac890553573a8491ca27cb4f22dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353805
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-26 19:51:41 +00:00
pq 440ea59ee0 enable flutter_style_todos in server
Change-Id: I4921d538e1498e66c8cab2d84dfcad21d1a7b555
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335952
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-14 21:08:12 +00:00
Sam Rawlins 73ab31b98a analyzer: Move the Source class to be public API.
Deprecate accessing LineInfo, Source, or SourceRange via the
old library (pkg/analyzer/lib/src/generated/source.dart).
Migrate all SDK code to the new library.

Fixes https://github.com/dart-lang/sdk/issues/46420

Change-Id: Ic7c98a5820415c92a457f9fa2756351b05520cd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-14 17:10:37 +00:00
Danny Tuppeny cf78037c5b [analysis_server] Change default leading/trailing behaviour for replaceSourceIndent
Makes behaviour of changing leading indent or trailing newlines opt-in.

There are only slightly more uses of this method that don't want this (now opt-in) behaviour, although I think this is slightly less surprising (for example the trailing newline behaviour was to "add a trailing newline only if it didn't already exist" which I don't think was obvious).

Mostly this was just changing the defaults and all of the call sites. However, some call sites were getting the old behaviour (inc leading/trailing whitespace), but then calling `.trim()`, so I didn't add the opt-in there because it would then be removed (they won't show up in the diff because they didn't actually get any changes).

Change-Id: I2f05b3a6266aaad5ee510ce2a8bf269b26d42d5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-10-06 23:32:22 +00:00
Danny Tuppeny 7dfd97ba99 [analysis_server] Improve re-indenting of fixes/assists + add additional switch expression fix for Wrap
The original goal of this change was to add the `switchExpression` test in `flutter_wrap_center_test.dart`, but it failed on Windows and exposed a bug that affected a number of assists/fixes.

The issue was that indentation was being rewritten using a regex:

src.replaceAll(RegExp('^$indentOld', multiLine: true), indentNew)

On Windows, when `indentOld` is an empty string, both `\r` and `\n` are matched individually, resulting in indentation being inserted between them:

foo\r    \n    bar

To fix this, I changed all places using a regex for replacement like this to call the existing `CorrectionUtils.replaceSourceIndent` method which did not have this problem. However, it made two different assumptions:

1. Indentation should always be updated on the first line (which if `indentOld` is an empty string, results in extra unwanted indentation being prepended to the string)
2. A new EOL should always be added at the end of the new code

To handle this, I added two new parameters and kept the original behaviour the same (although, I'm not sure if defaulting to adding a newline makes a lot of sense).

Change-Id: Ifa714da62c2541ba54a5376aa67149c90396dec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328220
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-27 22:25:52 +00:00
Konstantin Shcheglov f722afcf0c Extension types. Support for sorting.
Change-Id: I632b05f9e02283eca663e68d6087230182003e97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323425
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-30 18:55:31 +00:00
Keerti Parthasarathy ab884b7d7f Refactors to allow for parse only mode for lints and fixes.
- Make CorrectionProducer as base class for {Parsed/Resolved}CorrectionProducer.
- Use ParsedCorrectionProducer for ConvertDocumentationIntoLine
- Move sort imports test to used ParsedUnitResult
- Add getter to LintRule to indicate that rule can be run using just parsed AST


Change-Id: Id11466c445e6e505ea752d097b57143f18c47060
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-06-22 18:20:15 +00:00
Konstantin Shcheglov fdd628b831 Use getResolvedUnit(File) in AbstractContextTest.
Change-Id: Ic6237185b8a8c8b62de470490873703672a203e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-11 23:59:39 +00:00
Konstantin Shcheglov 6055524426 Use File instead of String path in AbstractContextTest.
Change-Id: I30ea3f08f8954e4d642aaf070e0da313013ad153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308162
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-08 19:21:31 +00:00
Konstantin Shcheglov 25dc2147bb Separate testFile and testFilePath in server tests.
Change-Id: Icc11f0c7f1642471cc01a0046e2a04801efba084
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307967
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-06-07 23:56:09 +00:00
Brian Wilkerson 71d4e1478e Clean up some tests to make conversion of contributor tests easier
Change-Id: I801970b4b88b883b2219badcefb7e1c84517d592
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-04-24 17:35:27 +00:00
Konstantin Shcheglov dc34fe9f86 Deprecate IfElement/IfStatement.condition, use 'expression'.
Change-Id: If43b4b71a21fd256ce8d1367d4b233e1cff764b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-19 17:17:28 +00:00
Ahmed Ashour b33058488c [analyzer] UNNECESSARY_NULL_COMPARISON
to handle implicitly null assigned variables.

Fixes #51093

Change-Id: Iab04292656f16a1085d39bdcd9efa27b55a2ecbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279709
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-02-11 16:09:39 +00:00
Ahmed Ashour 1be1780b79 [analyzer] add CAST_FROM_NULLABLE_ALWAYS_FAILS hint
Fixes #50309

Change-Id: Iaf19f46e7d3632d048a7db2e5194d59e933a69a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-11 21:12:48 +00:00
Danny Tuppeny ffe4a8c864 [analysis_server] Prevent convert method<->getter refactors on SDK/external package files
Fixes https://github.com/Dart-Code/Dart-Code/issues/4221.

Change-Id: I1a017f098d3d72bc19c91cead4c68b2666c5fe01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-10-18 16:24:16 +00:00
Ahmed Ashour 4f42058b4f [analyzer] use preferred quote-style for edit.importElements
Bug: #49559
Change-Id: Ic9c272c78f15599c5f3c985466f815cec82ad62b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-23 19:59:59 +00:00
Konstantin Shcheglov 6f0fe880c4 Breaking changes for analyzer version 5.0.0
Reland of https://dart-review.googlesource.com/c/sdk/+/243164

Change-Id: I5167844ea1001f026cf8d9b82465a79f560d188d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257267
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-07 16:27:18 +00:00
Konstantin Shcheglov ff8024fc78 Revert "Breaking changes for analyzer version 5.0.0"
This reverts commit d8df88cbe4.

Reason for revert: breaks Flutter HHH, requires updates to linter

Original change's description:
> Breaking changes for analyzer version 5.0.0
>
> Change-Id: Id9f27b6c41829249f6b2e7b93ad396643193fc78
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243164
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=scheglov@google.com,brianwilkerson@google.com

Change-Id: I6ca213427189c169ddacbd89f60d463efa2c38f2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-31 21:05:19 +00:00
Konstantin Shcheglov d8df88cbe4 Breaking changes for analyzer version 5.0.0
Change-Id: Id9f27b6c41829249f6b2e7b93ad396643193fc78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243164
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-31 05:08:50 +00:00
Danny Tuppeny 5741f11f7b [analysis_server] Remove unnecessary imports when organizing imports
Change-Id: I7a39a9b07adbacc7d3fd5abb3b165b47668e7938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 15:10:55 +00:00
Danny Tuppeny 210af2940f [analysis_server] Fix loss of comments containing newlines when sorting imports
Change-Id: Ie264c16d4ec8254ba0394691625a161598e73f5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 21:23:55 +00:00
Janice Collins be13f8b89a Add a fix to remove print expression statements for avoid_print.
Bug: https://github.com/dart-lang/sdk/issues/45921
Change-Id: I9dc1726e19fdd592d42bc3d7eb6aa6a1b1944279
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246051
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-02 18:30:57 +00:00
Brian Wilkerson 748ee46cf4 Stop using main in test code in more places, part 4
This is the last set of changes in the analysis_server package.

Change-Id: I0cffd41118ba985fc1d90cc3ae25447abb62a212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243934
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-05-08 14:32:41 +00:00
Brian Wilkerson 477b3a1cbd Stop using main in test code in more places, part 2
Change-Id: Ifbcdd950f2643349dfd645c1f4a26c3ee0c916e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243682
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-05-05 17:16:15 +00:00
Konstantin Shcheglov 20b560226e Rename newFile2() to newFile().
Change-Id: I1c2a4f15dee607a0a6241dfaf2d764a7d284389b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241510
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-19 02:59:57 +00:00
Konstantin Shcheglov 3d69c3c0c4 Restore sync file methods in AnalysisSession.
There are clients, like `built_value` that cannot be updated.

Change-Id: I27371018039f22cd7ca2cb82b30ec33469aa6e4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-21 23:27:57 +00:00
Konstantin Shcheglov 41b3e0abcc Make 'content' required in ResourceProviderMixin.newFile()
Change-Id: Id697b0736b95a913c31247a66425027852f1ddc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236800
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-14 17:31:48 +00:00
Konstantin Shcheglov 1693908268 Apply file changes between (not during) other operations.
This would be a breaking change, so for now it is disabled, but
the method `applyPendingFileChanges()` can be added, and the clients
will call it to be ready for the switching the flag.

Only clients that call methods like `changeFile` have to await applying
the file changes. Other clients can continue using synchronous
`currentSession`.

Change-Id: I0f8d4cc874f485776f611790f6c80fd7e07c8051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-09 18:16:45 +00:00
Konstantin Shcheglov 0b7b70b758 Deprecate synchronous methods in AnalysisSession.
Change-Id: I9bd3bf2d3d6dbc74ffefde1c06f83e9200b0f552
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-03-07 18:17:41 +00:00
Konstantin Shcheglov 06a34d98d1 Sort members in enums.
Change-Id: Ied55e119e24e51042c65ec5bc222bbafbbec6c46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-01 01:33:08 +00:00
Konstantin Shcheglov c9e7e317c6 Remove unnecessary duplicate test for mixin sorting.
Change-Id: I5171f629a05467c8143dcee1583fb5df7450ad34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225049
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-21 01:11:43 +00:00
Konstantin Shcheglov 36c051687c Sort extension members.
Change-Id: I61b746f648573f27273135675364f0bcc257d51f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-20 20:40:32 +00:00
Danny Tuppeny e94799ad01 [analysis_server] Keep trailing comments when sorting members
Change-Id: I7c6a2bf2ac5bcc5ff1079818d1c8a5ab768de946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222463
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-12-09 20:23:30 +00:00