Commit Graph

6735 Commits

Author SHA1 Message Date
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 6de7ea7432 Don't remove overlays immediately, wait for the next watch event.
Change-Id: Ie3352bf70010de88874aea122d83a5533a00a1ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-14 17:21:28 +00:00
Danny Tuppeny b9a7f00a9a [analysis_server] Add server snippets for classes, and test/groups in test files
Change-Id: I72758dba2967c678d96adbc9f7bbd4bd307caf67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237083
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-14 16:43:38 +00:00
pq 0d130c3148 fix for unnecessary_null_aware_assignments
Fixes: https://github.com/dart-lang/lints/issues/66

Change-Id: Ib14902c76910d550fbf69161a257d59cd268be9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-03-14 16:04:40 +00:00
Brian Wilkerson 2ce7aa3b16 Add a fix for the use_enums lint
Change-Id: I6f3e7b1c3f9b8b4ce7a1737130e3f98896b2123c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236981
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-14 15:58:40 +00:00
Danny Tuppeny 4b0706aec7 [analysis_server] Support multi-group snippets in LSP CodeActions
Fixes https://github.com/Dart-Code/Dart-Code/issues/3869.

Change-Id: Ib1925cc090fe62815c9257c72823c0e84d93efd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-10 20:35:35 +00:00
Konstantin Shcheglov 2184481d93 Replace addProjectFile() with newFile() and explicit waitForSetWithUri().
Change-Id: Ie9d9afa66ace10fdb1d8cc5501cb9e777c60fe5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-10 20:08:35 +00:00
Konstantin Shcheglov 13c0a4c2c0 Enable 'macros' experiment in tests.
Change-Id: Ib5593b12f13c23cc9a703d80cf50bbec5608e53f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236702
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-03-10 20:08:21 +00:00
Konstantin Shcheglov 5fa65048c1 Use file_paths.pubspecYaml instead of 'pubspec.yaml' literal.
WDYT ?

Change-Id: I6677b2237e0558c74bb11073dcfb44d7b672323f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-10 19:03:55 +00:00
Danny Tuppeny 0de43ae5f7 [analysis_server] Make CompilationUnitElement.lineInfo non-nullable
Change-Id: Ia42e2a2fd153b5af167588b9d4d473d1f998a67b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-10 00:19:15 +00:00
Konstantin Shcheglov 1531030b42 Stop using newDotPackagesFile() in analysis_server/.
Change-Id: Iaa4e8657ee1d5f115ab62177570aa662494b9d9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-09 23:56:15 +00:00
Danny Tuppeny dd34c92da0 [analysis_server] Add snippets for for/for-in/while/do-while loops
Change-Id: Ie9f7a73ddf3e9661b91212cdafb95f34a9994cc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-09 21:44:05 +00:00
Konstantin Shcheglov 5ffba0a660 Remove unnecessary code for enum constants from AstBuilder, completion.
With https://github.com/dart-lang/sdk/issues/48380 fixed, we can simplify.

Change-Id: Ic453fe9e86af2f6cb437ff016a9b3786959b05d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236302
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-09 21:07:44 +00:00
Danny Tuppeny 13a6faf36c [analysis_server] Add snippets for if, if-else, switch, try-catch
Change-Id: I4146cf465817f46ffbec6e32630fd8425dcd0fd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-09 21:00:46 +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
Danny Tuppeny 4e9244cf25 [analysis_server] Fix error trying to compute ColorPresentations for files outside of analysis roots
Fixes https://github.com/Dart-Code/Dart-Code/issues/3864.

Change-Id: Ibfbcff12393e0944841954225b209c38dd43a79f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-09 17:08:04 +00:00
Danny Tuppeny da5670c677 [analysis_server] Fix end locations of navigation regions for code sample links
Fixes https://github.com/Dart-Code/Dart-Code/issues/3867.

Change-Id: Icdfc93c1b03fdd4c40e3ea4563045d993cb50c32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-09 16:40:25 +00:00
Danny Tuppeny 77c650433f [analysis_server] Add support for empty linked edits
Change-Id: I8e3a57732ecb36712e754549333d551bb0a47e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-09 16:38:25 +00:00
Konstantin Shcheglov 9dc81176ab [parser] Better recovery on empty named argument name
Fixes https://github.com/dart-lang/sdk/issues/48288

Change-Id: I831b4870ba7dc69436f68e1ef84e0cdf258073a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234289
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-09 09:55:44 +00:00
pq 75e03d7875 linter 1.19.2
Change-Id: Ied72b70663dee8cb91ebc18204464baa2a9644b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-03-08 23:34:54 +00:00
Danny Tuppeny 9c0689a887 [analysis_server] Add code snippet for main functions
Change-Id: Ie74f92ab321d426897163f7f33b94828c9e0f99a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-08 20:18:04 +00:00
Konstantin Shcheglov 25f8786fb3 Deprecate and replace more sync methods of AnalysisDriver.
Change-Id: I5e10b7233841a9601315a6f04c1620d90daf6f67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-07 23:53:23 +00:00
Konstantin Shcheglov d72934449f Deprecate 'Resource.parent2', use 'parent' instead.
Change-Id: Icf3cefa8061543a3965e1eedab4b57bb6c67c920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-07 22:11:23 +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 bf40bf4ebb Move / rewrite a few other analysis domain tests.
Change-Id: I4e86f5b9cdb8f84c3e3ed897599157918133ccfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-07 17:21:53 +00:00
Konstantin Shcheglov 5f0afa0ac4 Switch _AnalysisDomainTest to PubPackageAnalysisServerTest.
Change-Id: I65404b3ff29cd5155ce67e4827f4337aef7183f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-06 22:06:23 +00:00
Konstantin Shcheglov 641255b292 Don't suggest from internal 'dart:' libraries.
Change-Id: Idb84a248b14b50fb38ad02e420ad48dea70a6f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-04 20:17:40 +00:00
Jaime Wren b63550cb85 Change reference from .packages to .dart_tool/package_config.json in the analysis server spec_input.html
Bug: https://github.com/dart-lang/sdk/issues/48272
Change-Id: Ica02829fbf9309327210e67d059d4606bb58b528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235282
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2022-03-04 00:02:01 +00:00
Sam Rawlins 3e423cdc33 Quick fix for unnecessary_late
Change-Id: I2cc2851d150570761e1e8a278b3fef15c2f18056
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-03 22:21:00 +00:00
Sam Rawlins e610c17ddb Quick fix for no_leading_underscores_for_library_prefixes
Change-Id: If1e0235a0704e349cc1aa9e732644cbfe49f2565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235166
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-03-03 22:05:54 +00:00
Danny Tuppeny 1e9fb81697 [analysis_server] Make CompilationUnit.lineInfo non-nullable
Change-Id: Ib628751a14dc3257cf7325432ab20f2bdb9d6f3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234290
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-03 06:59:00 +00:00
Konstantin Shcheglov 7b108fb226 Move code locations computing when supportsLocationLink into DefinitionHandler.
The main reason to do this is that we add navigation regions while
visiting AST, so we will not able to call the async method to parse
a file.

An accidental improvement is also that we will not parse files
multiple times when the same element is referenced multiple times.
Although if different elements of the same file are referenced, we
don't have any improvement here.

Change-Id: Ic4d914e89515af31f2dc3c4f842f0313cc89fac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-03 00:47:39 +00:00
Konstantin Shcheglov 30f285efa6 Fix an enum rename test after merge.
TBR

Change-Id: Ifb379c1beaab977239070c2bb87f3bedf276c770
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-03 00:46:49 +00:00
Konstantin Shcheglov 366ad77ee2 Report NON_FINAL_FIELD_IN_ENUM.
Change-Id: I6b481cd5cd02d4dbfdb213fe25aae0423c1b06ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234913
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 23:52:30 +00:00
Konstantin Shcheglov 601b5379a8 Tests for hover and enums.
Change-Id: I633d6aaf8e0ff425aeb4b461677d6aaff187f85f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234911
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 23:36:31 +00:00
Konstantin Shcheglov e133fe8102 Tests for type hierarchy and enum.
Change-Id: I4992176e8ff1481502364ec3f6dcce28bc2abcde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234910
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 23:36:03 +00:00
Konstantin Shcheglov 7516925fef Tests for extract and inline methods for enums.
Change-Id: I02da04feb4143c7793f17fe627b4c831c8ce98ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234909
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 23:28:29 +00:00
Konstantin Shcheglov 79a58d6a7f Tests for renaming class members in enums.
Change-Id: Ie63dbe3606f9601e3052e9d4af85d2a52066b89b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234906
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 21:50:09 +00:00
Konstantin Shcheglov 3cf37db274 Use ClassElement.allSupertypes instead of getSuperClasses()
Change-Id: I43b8801ba90caa63545571dddfefc4d0cdcfb06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234865
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-02 16:46:09 +00:00
Danny Tuppeny f5bd632abe [analysis_server] Ensure imports are always added before other code being inserted in DartFileEditBuilder
Change-Id: I390f24ac10f7f061e79c9bfed616e9bcc908d240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234604
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-02 16:37:26 +00:00
Danny Tuppeny f029873fa1 [analysis_server] Fix path in Snippets tests for Windows
Change-Id: I013767ecf66b55760debde9b05874e39e851047e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234783
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-01 19:10:19 +00:00
Brian Wilkerson 1d89666641 Add a test for the error_fix_status file
Change-Id: Ib5f23999b581a7440fc066019b0860fc8c6839b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234801
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-01 18:50:08 +00:00
Danny Tuppeny 5ae1838569 [analysis_server] Don't insert trailing commas when editing named argument labels
Change-Id: I691b19eebd8d01796b5763c066573de52192a8a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-01 16:53:38 +00:00
Paul Berry 59b6e9dcd0 Sort files in nnbd_migration package.
Also add a test to ensure that they don't get out of order again.

Change-Id: Ia847b2b21d24de49c2ce74bbc9f2652642b45f38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234663
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-01 14:24:38 +00:00
Sam Rawlins 3c0f5603fb Update error_fix_status for package:lints candidates
Change-Id: If7b3d197c67a767fd7d12aa2439e2094da463b78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-01 03:19:07 +00:00
Sam Rawlins 19d579723f Reduce AST-walking in rename_camel_case
Change-Id: I56d6553920c577a3d112b5391728240c6e565656
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-03-01 03:18:47 +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
Brian Wilkerson 40757e679e Update the error_fix_status document
Change-Id: Ie78fceb96c4c2cc5e0919f40c60b1a81307dc811
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234540
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-28 23:33:37 +00:00
Konstantin Shcheglov d9b88111af Remove debug print(s).
R=brianwilkerson@google.com

Change-Id: I9bcdf1d3006e2d846d7b22e6e8eb3155278b0fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-28 22:01:27 +00:00
Sam Rawlins 8b48d28226 Add quick fix for null_check_on_nullable_type_parameter
Change-Id: Idb4f617880ceac0972edb8c4f04feb23fd97145b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-02-28 21:06:17 +00:00