Commit Graph

7057 Commits

Author SHA1 Message Date
Danny Tuppeny 14796fafa8 [analysis_server] [lsp] Fix resolving completions with no insertText and stop using insertText entirely
Fixes https://github.com/Dart-Code/Dart-Code/issues/4027.

Change-Id: I60d4e9aabdd125771cd8f3e9f63367cf21eea5fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249489
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 17:03:35 +00:00
Danny Tuppeny d6215b7eb0 [analysis_server] [LSP] Prevent Getter<->Method refactors showing in invalid places
Fixes https://github.com/Dart-Code/Dart-Code/issues/4000.

Change-Id: I3b0b39b871b2d7176a1cbbe73064fce2586813ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249482
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 15:30:34 +00:00
Danny Tuppeny 77bf07a87f [analysis_server] Rename LSP Pattern alias to not conflict with Dart Pattern type
Change-Id: Ib3178eb2fd3f3e2d41844d5fb492775da7e3171a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249487
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 14:05:24 +00:00
Konstantin Shcheglov 16796fbbe0 Extract AnalyzerStatePrinter to prepare for using it in AnalysisDriver tests.
Change-Id: Ia788c2f9dcc537ce4631e4c2ab62f3f11f0602b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-21 21:59:36 +00:00
Brian Wilkerson 3b01def1a6 Add hooks for and start gathering some analysis context dependent analytics
Change-Id: I6d428c1bd55aae060a09b7cc039b92df38d09d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-21 19:47:24 +00:00
Keerti Parthasarathy 338d8299ef Modifiy remove/add mutliple parameters test to capture case where there is no trailing comma.
Change-Id: Icc3eb54ee1202ca22e187a2dc7e992cd02a56e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2022-06-21 17:04:14 +00:00
Konstantin Shcheglov e78399ac52 Issue 23067. Report HintCode.DEPRECATED_EXPORT_USE
It found a few cases for `BytesBuilder` exported from `dart:io`.
I fixed most of them in a separate CL.

But package:flutter (itself only) is clean.

There are a few violations in google3.
I will ignore most of them, and fix a few.

Bug: https://github.com/dart-lang/sdk/issues/23067
Change-Id: Ic89370ad84caa60fd49326c2bc60ad5d927e2264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-06-18 18:17:40 +00:00
Ahmed Ashour a60df664b3 [analyzer] Add a quick fix for avoid_renaming_method_parameters
Fixes #47126

Change-Id: Ic9ee97174504cf8e0c6a5fcc3224849c870714c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-17 16:16:59 +00:00
Danny Tuppeny cd43f3d08c [analysis_server] Use generated typedefs for LSP code
Change-Id: I242413db35b22d01965aa8ecf9851e47982ea41d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 22:02:00 +00:00
Konstantin Shcheglov 2ff7c7aa25 Make 'isGenerated' required, use it, remove 'from' constructor.
Change-Id: I470e0c02e75c65c73f57f3a6b5b1873fc0a8df4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 19:21:17 +00:00
Konstantin Shcheglov 31c49c4fd8 Use FileState from AnalysisDriver in Cider.
Change-Id: I3f6dc6f80845d24e555328d25f8355eb11e51883
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248709
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 17:48:49 +00:00
Danny Tuppeny a2f9ad4ba7 [analysis_server] Tweak navigation regions/targets for named constructors
+ fix an issue with constructor declarations not returning any matches at all for LSP which provides an offset.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4020.

Change-Id: Id59c83e32630c4ab947e3c3062b55989c78d1c61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248581
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 17:47:59 +00:00
Sam Rawlins 567b45fb1d Add the enable-experiment flag back to DAS
Bug: https://github.com/dart-lang/sdk/issues/48960
Change-Id: I6576f45e63e28902986db844df49a06a71385704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245202
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 16:26:39 +00:00
Danny Tuppeny 341b60796a [analysis_server] Generate typedefs for LSP params/result unions
Many params/result types are defined as unions without names in the spec. This gives them names so the handlers will be able to use names instead of the full EitherX<Y> type.

Change-Id: I3f96b48e5e70c86814724edc3fec4fc7f76534de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248801
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 16:11:21 +00:00
Danny Tuppeny b46a2d3039 [analysis_server] Preserve type aliases from the LSP spec as typedefs in generated code
+ improve the use of LSPAny/LSPObject where

LSPAny = anything, including null or undefined
LSPObject = any object (equiv of non-null Map<String, Object?>)

Change-Id: I335b299aad8e58b1cb4ee33cf27dc0dd887ec916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 14:15:41 +00:00
Danny Tuppeny 8038192b9d [analysis_server] Fix names of canParse functions for nested generics
Change-Id: I4f641d8cb4cc2aadfd38c5fc0b06fd11445c4165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248587
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 19:29:48 +00:00
pq d2e006eefa quick-fix to wrap in unawaited
Fixes: https://github.com/dart-lang/sdk/issues/49262

See also: https://github.com/dart-lang/linter/issues/3429

Change-Id: I0d3bf6c72ae1cf3e08f50b4deda10aba52e25eb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-06-15 18:03:08 +00:00
Brian Wilkerson c44bb947eb Capture initializationOptions from initialize
Change-Id: Ib9bf4361b97d284e5e1f96edc2c4540a0551b349
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248340
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 16:37:49 +00:00
Konstantin Shcheglov 0aed38d52a Make ByteStore similar to CiderByteStore and switch Cider to it.
Change-Id: Ic05df27da094fdd5671eb45d66ab3533b0f0d844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248445
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-15 16:05:34 +00:00
Danny Tuppeny e787255915 [analysis_server] Remove unused type args in LSP interfaces
The new JSON model doesn't have/support type args (the original Markdown/TS spec had one instance where the type arg added no value) so this cleans up the code slightly.

Change-Id: I773d2acb38f95d78d2d5f73e1c9bd39468fbcad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 16:00:01 +00:00
Danny Tuppeny 28d5347d8e [analysis_server] Allow running server from source in tests with an env variable
Change-Id: I70b974b094b6d6c87831a80245a0c741abb12d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248584
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 15:57:32 +00:00
Ahmed Ashour 07f7e455fa [analysis_server] use single function per type for canParse
Fixes #49229

Change-Id: I87d2dea79f8786b826162d132a63c69a2ebaba67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248009
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 14:31:38 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Keerti Parthasarathy 744d14470a Fix a bug when replacing a single parameter with multiple in Flutter code.
Change-Id: I87c2fdbe5e74a725463942693016e83da952718c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2022-06-15 06:12:58 +00:00
pq 08d6d8f88d add quick-fix for discarded_futures
See: https://github.com/dart-lang/linter/issues/2923

Also: https://github.com/dart-lang/sdk/issues/49262

Change-Id: I57336d792b91b5bfaf8bcf4e28d8d592716b3999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248444
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 21:48:16 +00:00
Danny Tuppeny 7df87288d8 [analysis_server] Update + simplify LSP methods table
Change-Id: Ia89e4bf2b65effe7ea98bd0081873f6a749eade6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248145
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 17:28:32 +00:00
Danny Tuppeny 40e25ebad0 [analysis_server] Always provide textEdit for LSP completions
Not providing textEdit means that the client will use insertText and compute its own range for what needs to be replaced. This may be incorrect if the name includes symbols that VS Code doesn't realise are part of the identifier.

To fix this, we should _always_ supply the range. This will result in a slightly larger payload, although an upcoming change to use itemDefaults will remove that for supporting clients.

Fixes https://github.com/Dart-Code/Dart-Code/issues/3943.

Change-Id: Ifd3f38ef96fecc6c745e00f511eb0bdbbd0d4a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248143
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 16:00:47 +00:00
Danny Tuppeny d6e5a0fc49 [analysis_server] Support Flutter's "wrap" assists in variable declarations
See https://github.com/emacs-lsp/lsp-dart/issues/141.

Change-Id: Ib5f3cbcf67ad70582ff257900f35beac61746380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248125
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 14:11:47 +00:00
Devon Carew 295898343a [pkg/analysis_server] remove some references to package:html
Change-Id: I5995c1281103e632bd98e180929cb170b2a87ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-06-13 20:00:28 +00:00
Brian Wilkerson d876b2b48d Prepare to collect data about workspace folders
Let me know if there are other parameters that we should collect
information about. I thought about open/close, to correspond to the
number of priority files tracked for the legacy protocol, but I thought
it would be too noisy. Happy to discuss if you think otherwise.

Change-Id: Id1b8bc043052570c706dc19ea31c33c2b19177ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-13 15:23:49 +00:00
Phil Quitslund 9a48d1b82f Reland "[data driven] support moving symbols across packages"
This reverts commit f111a2df54.

Reason for revert: this change was mistakenly associated w/ a windows bot breakage (https://github.com/flutter/flutter/issues/105641)

Original change's description:
> Revert "[data driven] support moving symbols across packages"
>
> This reverts commit 3290d7a137.
>
> Reason for revert: flutter engine breakage (https://github.com/flutter/flutter/issues/105641)
>
> Original change's description:
> > [data driven] support moving symbols across packages
> >
> > See: https://github.com/dart-lang/sdk/issues/48997
> >
> > Change-Id: Iad16b9eae0523bc4bc14537af642b05efa75b6f7
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246663
> > Commit-Queue: Phil Quitslund <pquitslund@google.com>
> > Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: I4a83d50497d6208b7f518ca1b381ece3aab192ad
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247606
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Keerti Parthasarathy <keertip@google.com>
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I769dec0d85fc0a41048b21deec0724d8509ef8e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-06-13 14:45:06 +00:00
Konstantin Shcheglov 1b9554d481 Add 'textToMatchOverride' for 'setState' completion.
Bug: https://github.com/dart-lang/sdk/issues/49233
Change-Id: I74fd86fc7f49c932e6698e474842078ff823f3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247933
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-13 00:54:16 +00:00
Ahmed Ashour 503e7232ab [analysis_server] have a single function for union
Bug: #49229
Change-Id: I6141c48e48fbe88812c10d7fcc3541af28ec36c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247966
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:31:57 +00:00
Ahmed Ashour 57b192f3a6 [analyzer] RemoveTypeAnnotation to handle type arguments
Fixes #49227

Change-Id: I0f754d84e3e4e89800abdec26925229587202bca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247968
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:24:06 +00:00
Ahmed Ashour 4ecc7ff67e [analysis_server] AddAwait to handle NON_BOOL_CONDITION
Fixes #49114

Change-Id: Id6b345a946ec124e4518c7bb526c510ae0cb92c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:23:55 +00:00
Ahmed Ashour 8bb3a10e40 Fix typos
Fixes #49228

TEST=ci

Change-Id: Idcc625554bcf07807bae9791ea37b73ae9394b87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-10 15:48:54 +00:00
Konstantin Shcheglov c5e725578a Revert "Add AnalysisDriver.contextRoot, deprecate configure()."
This reverts commit 3b111d5e0d.

Reason for revert: Wrong design, will rework.

Original change's description:
> Add AnalysisDriver.contextRoot, deprecate configure().
>
> In the future AnalysisDriver.analysisContext will be removed, and
> AnalysisDriver will implement AnalysisContext. At the same time we
> will remove DriverBasedAnalysisContext.
>
> Google3 looks green.
> https://fusion2.corp.google.com/presubmit/tap/453818030
>
> Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: I2eb567c6343636d3affd48bb4bfb0b4b1aa788b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-06-09 20:53:03 +00:00
Ahmed Ashour eda47496d7 [analysis_server] Removing ignoring hash_and_equals lint
Bug: #48785
Change-Id: I9007eb2388adac3f5f33ae81346e4bc0485a405f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247556
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-06-09 19:36:43 +00:00
Ahmed Ashour a3d8800c9d [analyzer] ChangeTo to handle SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED
Fixes #48480

Change-Id: I234ccb0cd170a78f5686048a294536d434e84eb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 19:20:13 +00:00
Daco Harkes a855030120 [vm/ffi] Allow struct nesting with looser packing
C compilers don't enforce nesting rules. `dart:ffi` was enforcing these
rules causing issues for binding to C libraries having looser packing
for nested structs than outer structs.

This CL completely removes the error from the analyzer and CFE.
(As an alternative we could have kept a hint/lint, but this might create
more noise than value.)

TEST=pkg/analyzer/test/src/diagnostics/packed_nesting_non_packed_test.dart

Closes: https://github.com/dart-lang/sdk/issues/46644
Change-Id: Iae2d5c885546f7799bc6dea2f8cd7dd508216a0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247382
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 19:08:43 +00:00
Ahmed Ashour e11d6b4a62 [analysis_server] simplify generated equals
Fixes #49222

Change-Id: I430ff02a4721d7d937b701bf0137096f314a6860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247557
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 18:30:33 +00:00
Ahmed Ashour e86635968d [analyzer] AddNullCheck to handle non nullable target
Fixes #49152

Change-Id: I010755baa441a213f927a963972fed108f861baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247555
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 17:44:03 +00:00
Konstantin Shcheglov 3b111d5e0d Add AnalysisDriver.contextRoot, deprecate configure().
In the future AnalysisDriver.analysisContext will be removed, and
AnalysisDriver will implement AnalysisContext. At the same time we
will remove DriverBasedAnalysisContext.

Google3 looks green.
https://fusion2.corp.google.com/presubmit/tap/453818030

Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-09 17:24:14 +00:00
Danny Tuppeny 5b3bfe4137 [analysis_server] Add snippet for function definitions
Fixes https://github.com/Dart-Code/Dart-Code/issues/4017.

Change-Id: I1017be3abe73a8cfcd6354f1c2ca99ad729dcf47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247553
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 16:07:43 +00:00
Danny Tuppeny a5d2b9156e [analysis_server] Enable updating imports for folder renames via LSP
Change-Id: Idbc1745570f19e372eee17089ebdc7db0d0b4fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247548
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 21:57:19 +00:00
Phil Quitslund f111a2df54 Revert "[data driven] support moving symbols across packages"
This reverts commit 3290d7a137.

Reason for revert: flutter engine breakage (https://github.com/flutter/flutter/issues/105641)

Original change's description:
> [data driven] support moving symbols across packages
>
> See: https://github.com/dart-lang/sdk/issues/48997
>
> Change-Id: Iad16b9eae0523bc4bc14537af642b05efa75b6f7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246663
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I4a83d50497d6208b7f518ca1b381ece3aab192ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247606
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 21:35:22 +00:00
Devon Carew ca205612d6 [deps] remove the dep on package:charcode
Change-Id: I0880f16db5bf62e6e7c91352c2f8e57f66ad7022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247500
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-08 19:49:22 +00:00
Janice Collins e63e4937e9 Add a fix for HintCode.UNUSED_ELEMENT_PARAMETER.
This repurposes an existing lint CorrectionProducer to handle both
the lint and the hint.

Bug: https://github.com/dart-lang/sdk/issues/49074
Change-Id: Iacd597ca2151cdb80be9ddae0847128b4cc700a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246989
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2022-06-08 16:57:02 +00:00
Danny Tuppeny 88c2f888ea [analysis_server] Support dart.updateImportsOnRename setting for updating directives on renames
This setting is already supported in VS Code but accidentally stopped working in the switch to LSP. This change prevents/removes the registration for willRenameFiles so that a client won't call the server when files are renamed if this setting is `false`.

Change-Id: Ia7b22b9fc2f119d0e7f98f4e2c5f0bac994a28af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 16:06:52 +00:00
Danny Tuppeny 8b40a7bb2a [analysis_server] Make Sort Members + Organize Imports fail silently if invoked automatically
Previously, Organise Imports always failed silently (since it was often run on-save). Sort Members had not been given the same treatment (but often now runs on-save).

This uses a new LSP 3.17 field to know when the command was run automatically, so both are now consistent, showing errors if invoked manually and failing silently if run automatically.

Change-Id: I48e8380fcee4e54d0f4dc3c177c9ae2362627efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247542
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 14:11:42 +00:00