Commit graph

4325 commits

Author SHA1 Message Date
Brian Wilkerson 38c1d4aaf8 Remove support for the deprecated dartfix tool
Change-Id: I848334cab0dbebe121198bc91ade3a8f68c5f7b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-02 18:30:24 +00:00
Danny Tuppeny 85d455fbad [analysis_server] Add source.fixAll source command for LSP
Change-Id: I2deac95e665a19065a7ef1d8c1f79485497c9de2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-01 17:56:47 +00:00
Danny Tuppeny dc66d5df62 [analysis_server] Include documentation URLs for diagnostic codes in LSP diagnostics
Fixes https://github.com/Dart-Code/Dart-Code/issues/3442

Change-Id: Iad741befd31eb1894ca0e45e65dc78902e8ed995
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205642
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-01 14:57:18 +00:00
Brian Wilkerson 0acfd2a6a1 Move bulk fix tests, part 3
This is the final CL in this set.

Disturbingly a couple of the bulk fix tests don't appear to have any
non-bulk test equivalents, just some assist tests. I'm assuming for the
time being that they're adequately tested by the assist tests.

Change-Id: I300558b3551061013e4cab8e97489597541d63bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205626
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-01 00:49:56 +00:00
Brian Wilkerson 98b466dd73 Move bulk fix tests, part 2
Change-Id: Id1506161381cc6194f47811fd059d776b2c23fad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205383
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-30 15:48:16 +00:00
Brian Wilkerson 47da8db2f6 Add a fix for the use_key_in_widget_constructors lint
Closes: https://github.com/dart-lang/sdk/issues/45931
Change-Id: I9b4b3275cd5d7f5ca7e1849f3ec5951f14be9cd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205040
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-28 21:07:20 +00:00
Brian Wilkerson aebde75dbf Cleanup invalid declarations of main, part 3
Change-Id: Iba6b4708a66034c9ac56d0b8910aad6d7f86b56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205064
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 18:14:21 +00:00
Brian Wilkerson 66aa132c84 Cleanup invalid declarations of main, part 2
Change-Id: Ic9626a500a8ceb4b9b0518e911658b96968d845f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205063
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 18:14:02 +00:00
Brian Wilkerson 69dd787ff0 Cleanup invalid declarations of main, part 1
The purpose of this CL is to clean up test code that references `main`
in a way that will be invalid when the tests are converted to analyze
the test code under null safety by default. This is the first of three
such CLs.

In all three I only touched test files that contained an invalid use of
`main`, but in any file I touched I removed any use of `main` where the
name of the function/method was not critical to the test.

Change-Id: Ib753302a4c3ffc7eb5f248e9c6000e80dc77fca9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 18:13:24 +00:00
Brian Wilkerson f5b28a83e8 Fix a bug in both add_missing_enum_case_clauses and add_missing_enum_like_case_clauses
We should rename ClassMemberLocation to reflect the wider usage, but I
thought it would be better to do that in a separate CL.

Closes: https://github.com/dart-lang/sdk/issues/38693
Change-Id: I657f7945022b09eb8deb89d8f2f5d43164fe53cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205061
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-28 18:04:52 +00:00
Danny Tuppeny 5dbf8992ed [analysis_server] Include file path in generated "part of" statements for unnamed libraries
Fixes https://github.com/Dart-Code/Dart-Code/issues/3268.

Change-Id: Ic681da09d0161e2e432959989db8c8002b1669a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 17:13:41 +00:00
Brian Wilkerson 0fc6f218bb Move bulk fix tests, part 1
Change-Id: I2b05dfbe5d26b9cd5534cc3971c0500ff11dc474
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205065
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 16:21:42 +00:00
Brian Wilkerson 86e3c1b231 Add a fix for the unnecessary_string_escapes lint
Closes: https://github.com/dart-lang/sdk/issues/45930
Change-Id: I7b50756256867174aa11adf7d29a67d2cb012839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-28 16:05:02 +00:00
Lasse R.H. Nielsen 43cff26365 Add supertype to enum classes.
TEST= language/enum/enum_test

Change-Id: I83b7fd1c29103c3aa4dc7ad3e41141fb8c62339e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203564
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-06-25 14:08:16 +00:00
Brian Wilkerson 10354d0aef Convert several of servers tests to be null safe by default
Sorry for the size of the CL. In reptrospect I should have changed the
defaults in any test class with failing tests and then converted them
one-by-one the way you did in analyzer. I'm happy to do anything I can
to make this easier to review.

Change-Id: I0a729d0d07cc3083a9892cfb1ddc75a06ad8f0dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204748
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-24 04:05:39 +00:00
Brian Wilkerson 0e4c640451 Suggest void as a return type in existing generic function types
Change-Id: I88c37e5ce273de2e9598b182fc5fb61066c11740
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204600
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-23 14:04:21 +00:00
Brian Wilkerson 9b4ff5e5a6 Fix the extract method refactoring to correctly handle nullable return types
Change-Id: I2a885887a8d871f0c61afd6648843b914c59022d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204626
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-23 01:10:07 +00:00
Brian Wilkerson 56bf5230ca Enhance the AddTypeAnnotation fix to support prefer_typing_uninitialized_variables
When a local variable doesn't have an initializer we now look for
assignments to find a reasonable type. This will not only allow this
lint to be fixed but will increase the number of places the assist is
offered.

Change-Id: Ib278477d277557aff7d2ddbcca3230f2a0a144b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204521
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-06-22 22:50:37 +00:00
Brian Wilkerson e95c0b403a Code complete the type in a DeclaredIdentifier even if the name is already present
Change-Id: Ic48f2213b2e5cf3f13c2b0d881781a5eab0cd965
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204560
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-22 21:47:13 +00:00
Danny Tuppeny c073fb6257 [analysis_server] Switch to checking isSynthetic for argument lists in LSP completions
Change-Id: Ie57717baff1b20b6c9a9c17dd12723eecf4bfc6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204405
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-22 19:02:22 +00:00
Danny Tuppeny ad6c732663 [analysis_server] Support LSP SignatureHelp for type argument lists
See https://github.com/Dart-Code/Dart-Code/issues/2834.

Change-Id: Idce0d0b133b1f40c1953e5f1c5f4531701a68c56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204404
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-22 14:56:44 +00:00
Brian Wilkerson 9da9768992 Use the context type to determine whether to suggest functions returning void
Change-Id: I78dac1852cb08f01927ef7fc2603d7de0b3dd891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-19 20:46:24 +00:00
Brian Wilkerson 2afc8161f4 Add a fix for exhaustive_cases that adds cases for the missing constants
Closes: https://github.com/dart-lang/sdk/issues/45923
Change-Id: I641c016dc73153d521f43c9ce4d333b50b4a702c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-19 20:17:03 +00:00
Konstantin Shcheglov f398c9f3c1 Fix pre-existing HintCode.UNNECESSARY_TYPE_CHECK_TRUE in analyzer/ and friends.
Change-Id: I1019d9c083b825a9f3418bc56ed410e0ba5501fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204085
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-18 16:07:26 +00:00
Brian Wilkerson 9ecdfcc8f3 Improve the suggested keywords in formal parameters
Change-Id: Iea099dc140865b109309cd932735f2d0a65fcfd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204080
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-18 15:49:31 +00:00
Danny Tuppeny 75bcd5ca33 [analysis_server] Improve coloring of invalid/unresolved methods in LSP semantic tokens
See https://github.com/Dart-Code/Dart-Code/issues/3412.

Change-Id: Icc44ff0537122d6d2211d64037666ecb58a28bd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-17 20:15:21 +00:00
Brian Wilkerson e5735c7409 Fix the import_library tests on Windows
Change-Id: Ibf2b88be11c7a5d53d7c4ee7c997c334621289df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204002
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-17 19:20:31 +00:00
Danny Tuppeny 2e411e5957 [analysis_server] Add quick-fixes to ignore lints/hints for line/file
Change-Id: I773704cccffc7a7da169b3d759b80b07267c88ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-17 15:37:11 +00:00
Danny Tuppeny 244c8a5453 [analysis_server] Fix test flaking due to unwanted analysis notifications in results
Change-Id: I053bcfa7362b199896b4624a6ffded5f1c12ffe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-16 16:26:47 +00:00
Danny Tuppeny f4b4882f48 [analysis_server] Add highlights/semantic token support for conditional imports/exports
Fixes https://github.com/Dart-Code/Dart-Code/issues/3395.

Change-Id: Ic5b9adbb4f92e5fd59c6f09dddd1e0b1b827d5c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-15 16:29:12 +00:00
Danny Tuppeny f00812b5ce [analysis_server] Set CompletionSuggestionKind for extension members
Change-Id: Ie5589ae1c3794fd8b2d335192009e65f2129a0d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-15 16:26:02 +00:00
Brian Wilkerson f06f09246e Suggest void in a type declaration list to support function types
Change-Id: I2514cfd80cec6cbec7703009ba5a12df4640c560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203663
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-15 00:49:03 +00:00
Brian Wilkerson cbdb20d417 Erase nullability after a null-aware operator when matching extensions
Change-Id: I6852f6acc4fb27bdfa3686b214c7c34d40c18bfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203664
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-15 00:41:09 +00:00
Danny Tuppeny 5c0b3877e3 [analysis_server] Prevent extension methods showing in completion in comments
Fixes https://github.com/dart-lang/sdk/issues/46351.

Change-Id: I762ccccceb0ec0fa453f5acb727e8c94472ac45d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-14 15:30:33 +00:00
Danny Tuppeny d75becf4ac [analysis_server] Enable multiline element descriptions for all hovers
Change-Id: I5521cb09172b5eee639a4d3e9e21eb5871d6a86f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202971
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-13 15:50:32 +00:00
Brian Wilkerson d5d1d6e6f6 Suggest void after equals in typedef
Change-Id: If85a55e15b6a98d754453860bb82d85b6fa613f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-11 17:47:37 +00:00
Konstantin Shcheglov 4936904e9a Prepare for -1 as nameOffset of synthetic PropertyAccessorElement(s).
Change-Id: Ia8f2760475e2bc465329c1bcdc08732d1a338ecc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203295
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-06-11 16:38:06 +00:00
Brian Wilkerson b11e0de9f7 Suggest extension members inside extensions
Also suggest 'dynamic' after 'as' in a type cast.

Change-Id: I1e9f9f3a894e2c094aa4a6785fcdcfc60fb34260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203289
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-11 13:45:36 +00:00
Brian Wilkerson d84e261527 Suggest methods and functions returning void in more places
Change-Id: Iab95508b8b6e486bc65d8914e3e4b9fe898a0c48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203282
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-10 19:43:23 +00:00
Konstantin Shcheglov 810c34a076 Use Element.nonSynthetic, fix enum constant navigation.
Change-Id: Id48a89d3d4f000e4a9b6b9022ce7158f6630d9d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-10 18:27:20 +00:00
Konstantin Shcheglov fe35fdd2c5 Use newAnalysisOptionsYamlFile() where possible.
Change-Id: I4b550cac941b6686738722cbcd3d04dfaabe5cdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203081
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-09 23:57:29 +00:00
Danny Tuppeny 419fd676d2 [analyzer] Enable create-file fix for export directives
Fixes https://github.com/Dart-Code/Dart-Code/issues/3269.

Change-Id: Ieced8751291a9c6b98508c708104915dc011cd2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202966
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-09 19:06:22 +00:00
Danny Tuppeny 5a04c08c43 [analyzer] Format signatures in LSP hovers over multiple lines
Fixes https://github.com/Dart-Code/Dart-Code/issues/3357.

Change-Id: I999ca8d3ffb7311ea4f60586e75160ae87292a77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-09 19:02:12 +00:00
Danny Tuppeny 3690f549b0 [analyzer] Mark void keyword with a modifier for LSP semantic tokens
Fixes https://github.com/Dart-Code/Dart-Code/issues/3308.

Change-Id: I2395caa7b52fe690621cb31d87136f236f0efed1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202965
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-09 18:50:42 +00:00
Konstantin Shcheglov faa0528eef Use newDotPackagesFile() where possible.
Change-Id: I74fc911e7da7ebfb9e1341791258d8c9a40d7324
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203020
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-09 18:07:12 +00:00
Danny Tuppeny 6d763b4565 [analyzer] Include analyzed context in include_file_not_found errors
May fix https://github.com/Dart-Code/Dart-Code/issues/3259.

Change-Id: I4a81acd9186efacc90584c756fc9aef224378c65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202964
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-09 17:59:07 +00:00
Devon Carew 1acb443145 [analyzer] cleanup references to the .analysis_options file
Change-Id: I08f491b06925a420069019b77177839e8310843c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202868
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-09 15:52:31 +00:00
Danny Tuppeny eb2836872a [analyzer] Check conditional directive URIs are within the requested range
Change-Id: Icec5f864484a67dc3a64ace06704d8266d88c12b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202772
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-08 20:32:09 +00:00
Brian Wilkerson 7d2ffd78de Make correction producers know whether they can be bulk applied
This change makes sense to me for a couple of reasons. First, when
editing a correction producer the information about whether it can be
bulk applied will be easier to find. Second, the information doesn't
need to be duplicated when the producer can be applied to multiple
error codes. And third, because the information is in one place we can't
enable a producer in one place and miss enabling it in other places.

This does have the unfortunate consequence that an extra producer needs
to be created for bulk application in order to determine whether it
should be applied at all, and can't be re-used because producers
maintain state. We could consider storing a 'generator' object rather
than a generator function in the map and have the `newInstance` methods
produce those objects, but I'm not convinced that it's worthwhile given
how short lived the extra producer is.

There was also one subtle change that you probably won't see by looking
at the changes, which is that one of the producers was enabled for bulk
application for a lint but not enabled for several non-lint cases. It is
now enabled everywhere. I remember thinking at the time that it should
be fine, but I've forgotten which producer it was, so I can't easily
tell you. If you want to confirm that change I'll be happy to do the
work of figuring out which producer it is and which error codes were
impacted by the change.

Change-Id: I2010d777f727472c0d307a6948b84d37491e2b17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-06 16:07:31 +00:00
Brian Wilkerson 18446a6560 References to synthetic fields in enums should navigate to the declaration of the enum
Closes: https://github.com/dart-lang/sdk/issues/46253
Change-Id: Id38f63cb8e32c22d4fe70a5aba675c7c0067bbd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-04 23:14:07 +00:00
Brian Wilkerson 75c9f63da0 Fix completion for redirecting constructors
Change-Id: Ia082b04ab90a9541b1eeec12c6c5f7f8379d3af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202541
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-04 20:16:47 +00:00
Keerti Parthasarathy e1f37f6029 Also return lineInfo and oldName from canRename
Change-Id: I5ae683cdfe3a82d8dea72745d77d8dcb435c0759
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202280
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-03 20:49:42 +00:00
Konstantin Shcheglov 40856c14c1 Remove most trailing spaces in analysis_server/
Change-Id: Ib03564c09af974b74be893ea2d6fdf1f6669d99b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-06-02 21:50:24 +00:00
Brian Wilkerson 4aef907927 Suggest void and other keywords inside the first token of a parameter declaration
We suggest user-defined identifier anywhere inside the first token, so I
think we should be consistent and suggest keywords there as well. As a
bonus, this will increase the accuracy of our completion metrics.

Change-Id: I88daf6b3b047ccfacd06cf25184d8bbbf42c682b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202064
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-02 18:38:44 +00:00
Brian Wilkerson 25b71e07e7 Add a quick fix to import extensions when members are referenced
Change-Id: Ic7f85cecdc06e255264441db7add6bd4a9bda5d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-01 23:28:25 +00:00
Keerti Parthasarathy 8580370162 Start of rename support for Cider
Change-Id: I50a47dafc9e41518a0d15f5c279a57db966afbb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201620
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-06-01 18:40:04 +00:00
Danny Tuppeny 10b83a4882 [analyzer] Tag constructor names as methods instead of classes in LSP semantic tokens
Fixes https://github.com/Dart-Code/Dart-Code/issues/3374.

Change-Id: Icb6e6b01e3abd77aa9da02ac9d9c9d62b77e2c21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201831
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-01 15:22:23 +00:00
Brian Wilkerson 9556697681 Suggest functions returning void as tearoffs where a void returning function is expected
Closes: https://github.com/dart-lang/sdk/issues/23984
Change-Id: I8291687d962a5d2885e5fa811167ca7e12aedc1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201286
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-26 04:23:11 +00:00
Brian Wilkerson bb1ec0869a Fix a bug in the quick fix to replace string concatenation with interpolation
Closes: https://github.com/dart-lang/sdk/issues/46130
Change-Id: Ia58116e538737be121eb753b40f2db155a4a12f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201283
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-05-25 19:39:41 +00:00
Brian Wilkerson 22a1b93fff Suggest extension members for an implicit target in extension members
I added one test for this case and several other tests for already
passing cases. I think that some of these cases were failing before the
switch away from using available suggestions for imported libraries and
was originally trying to write a test for a different reported problem,
but the test passed.

Change-Id: I989d8419506c59b883fe5b52168e15fd7d68787c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-25 17:35:41 +00:00
Danny Tuppeny 3cf34d172f [analyzer] Prevent failure invoking signature help in missing constructors
Change-Id: I926b6bd5b939e52d33eb2d4be7fcac9ee3483d55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-25 16:39:41 +00:00
Danny Tuppeny 899654d515 [analyzer] Check sort_constructors_first lint when inserting constructors
Fixes https://github.com/Dart-Code/Dart-Code/issues/2937.

Change-Id: I5a0a4675cf78fd512a1dd728d25b31a8d5357d9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-24 17:26:40 +00:00
Danny Tuppeny d3082bcb3e [analyzer] Add folding regions for parameters
Fixes https://github.com/Dart-Code/Dart-Code/issues/1201.

Change-Id: I2865337861397ae15d2c4515b009fa22c678b5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-24 17:13:35 +00:00
Brian Wilkerson 93670dacc1 Add a fix for avoid_returning_null_for_void
Change-Id: Ia38d0115157a914fc8f19d6e026e34c4752207de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201102
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-23 15:13:00 +00:00
Brian Wilkerson f56f9e8f34 Add some validation tests for quick fixes and fix a violation
Change-Id: I3e9d049938140600a4dbd9669c9781c50a0c2c75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201041
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-05-22 17:05:49 +00:00
Brian Wilkerson 3cc518b3cc Stop using available suggestions for already imported libraries
This is a re-do of https://dart-review.googlesource.com/c/sdk/+/197880
that removes the support for Cider. We might try using this for Cider at
some future date, but I didn't want that support to prevent us from
getting this to users sooner.

Change-Id: Ia5c06a8a3d7366770dedb4f51153c2f4004bb89e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-21 19:43:55 +00:00
Brian Wilkerson 813c4ab6d4 Add tests and enable bulk fixes for invalid_null_aware_operator
Closes: https://github.com/dart-lang/sdk/issues/46013
Change-Id: If7fad2ba8f859897e08bb78046ce45bd57ad0289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200883
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-05-21 16:19:42 +00:00
Devon Carew 29f69657e5 update the links to analyzer diagnostics
Change-Id: I293ee9bfe0e7c148a59d0cbb1b927c1edbbd15ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-05-20 17:05:45 +00:00
MrBirb 5051d4b991 Convert private widget to Stateful without extra underscore.
Bug: https://github.com/Dart-Code/Dart-Code/issues/3343

Change-Id: Ica188ab06e24b4d0708bdc1e23aefeebb53bcab2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-20 16:17:56 +00:00
Danny Tuppeny 590284e0f7 [analyzer] Add semantic token type/modifier for interpolated expressions
This allows https://github.com/Dart-Code/Dart-Code/issues/3318 to be fixed by giving clients something they can use to reset coloring and preventing inheriting from other highlighting they may apply.

Change-Id: I3f1ba2c15d64634b203064d1451fb4fef040eb60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-20 15:38:52 +00:00
Sam Rawlins cf00cad458 analysis_server: Check for prefer_relative_imports when fixing with new imports
If the `prefer_relative_imports` lint is enabled, then suggest relative
import URIs before absolute ones.

Also bring the relevant code in line with Effective Dart:
* DO capitalize acronyms and abbreviations longer than two letters like words. ("Uri" vs "URI")
* AVOID lines longer than 80 characters. (in doc comments)
* DO separate the first sentence of a doc comment into its own paragraph.
* PREFER starting function or method comments with third-person verbs.

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

Change-Id: I2e235cc84bd93e5593a96456eb9b0c615811e268
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200660
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-05-19 22:07:42 +00:00
Danny Tuppeny cc67085501 [analyzer] Add support for LSP textDocument/selectionRanges
This is used to support "expand selection" functionality in editors.

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

Change-Id: I27929b152ef618fb8b57c43e6c6f6e21fe0966dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200427
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-19 16:34:47 +00:00
Sam Rawlins 2bcc415510 analyzer: Report unnecessary import directives.
In a given library, every import directive has a set of "used
elements," the subset of elements provided by the import which are
used in the library. In a given library, an import directive is
"unnecessary" if there exists at least one other import directive
with the same prefix as the aforementioned import directive, and a
"used elements" set which is a proper superset of the
aforementioned import directive's "used elements" set.

https://github.com/dart-lang/sdk/issues/44569

Change-Id: I4da43be36837cdafb07a0ab67a94e644f351e593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177221
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-05-17 20:23:12 +00:00
Danny Tuppeny eb2e8698bc [analyzer] Escape function names used in LSP snippet completions
Fixes https://github.com/dart-lang/sdk/issues/46019.

Change-Id: Ie4413fe013d7251e579f548e61674a8a4fc1d5df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200185
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-17 15:15:20 +00:00
Brian Wilkerson 4e4f07eb22 Unify two tables mapping error codes to fix generators
This doesn't change the way any of the fixes can be applied, nor the set
of fixes associated with any code. It merely finishes a re-organization
task that was started earlier.

Change-Id: I911961fe5ec2aea211a6f0a51db24a4c4b32be26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200061
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-15 17:07:29 +00:00
Brian Wilkerson 11bbea8797 Generate a name for closure parameters when the argument parameter has no name
Change-Id: I75e860a2ead6296c87cd3ea0b3775f455f78eeea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200042
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-05-15 04:51:19 +00:00
Danny Tuppeny f6c91128be [analyzer] Add an LSP semantic token modifier to escape sequences
Work to support https://github.com/Dart-Code/Dart-Code/issues/3329.

Change-Id: I160c0f350213cd8bfb44319ad39551c84f0007ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199483
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-12 21:02:50 +00:00
Konstantin Shcheglov 0f8e17083b Generate State<MyWidget> as 'createState()'.
Bug: https://github.com/flutter/flutter/pull/81578
Change-Id: I4128f5473287983c2837a83462261050e72239df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-05-09 19:55:08 +00:00
Brian Wilkerson 454e633461 Fix a bug in the convert_into_expression_body fix
Change-Id: Ieed0452eb1ec89b294e6d567df758b533ac4062f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-07 04:53:44 +00:00
Brian Wilkerson 484c999f12 Add a quick fix for avoid_function_literals_in_foreach_calls
Change-Id: I8f209dc884ef2eb19cc12a7f10f52621237c7964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-06 18:35:43 +00:00
Brian Wilkerson f25fc4287c Improve the code completion metrics tool
Added user tags for profiling and started tracking the distribution of
completion times.

Change-Id: I57153aa550787535ee955359a810cabbdee1941b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198360
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-05 16:48:25 +00:00
Danny Tuppeny c3683c79a2 [analyzer] Ensure the error message for LSP CodeActions requests with invalid positions is clear
See https://github.com/dart-lang/sdk/issues/42786

Change-Id: I37c5b2cd7620bcb605d4e51c20493a2a505d3d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-04 16:55:11 +00:00
Danny Tuppeny b3993c9349 [analyzer] Map all LSP integer/uintegers on to Dart's int type
Change-Id: I714bafdf378b8a29ba847c8d39ebe96977fc977e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198043
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-04 15:37:41 +00:00
Michal Terepeta 9ff5ac12c6 React when Bazel/Blaze prefix changes
Previously if no Bazel/Blaze symlinks were present, we defaulted to the
`bazel-*` ones and never checked if that assumption was accurate. This
change starts watching the symlinks and recreates the analysis contexts
if a symlink gets added. This way we'll run the `BazelWorkspace` code
again and use the correct paths.

This is quite important since `bazel/blaze clean` does remove the
symlinks so if the analysis server starts at such a point, we would
never find any generated files if the workspaced turned out to be a
Blaze one.

Bug: http://b/175087705
Change-Id: If7bb21c7d69a3092832c18004691d56949e5af54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-05-03 07:35:58 +00:00
Danny Tuppeny 9d015feeaf [analyzer] Add a "constructor" modifier for LSP semantic tokens
Fixes https://github.com/dart-lang/sdk/issues/45861.

Change-Id: Ib97e14d6e23dfd0c48e1ad8abb18b42a4c2f9cb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-30 17:04:26 +00:00
Danny Tuppeny a89fccb482 [analyzer] Support "Inline Method" refactor in LSP
Fixes https://github.com/Dart-Code/Dart-Code/issues/547.

Change-Id: I02f905673820ef22b5b10055f32710d660beaa2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-29 15:52:45 +00:00
Danny Tuppeny dbd48c3b0c [analyzer] Add tests for non-project files in Bazel workspaces
Change-Id: Ib674d7d422c7a3bbf7f2e3c67944b1067477ade6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196669
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-04-28 16:35:43 +00:00
Ivan Inozemtsev 0914948979 Use workspace.getPackageFor to get analysis roots from open files
Using ContextRoot.root locations directly leads to analyzing the whole
workspace for Bazel workspaces.

Change-Id: I44a31a5bc6043eaaea0e9c83f6261d54443ad7a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196494
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-04-28 06:20:52 +00:00
Danny Tuppeny 8f2c0e9bb8 [analyzer] Suppress insertion of completion parens/arg placeholders when they already exist
Fixes https://github.com/Dart-Code/Dart-Code/issues/3303.

Change-Id: I284608ba850b5ed2008b8cdd707bc1becc73872d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197045
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-27 18:28:10 +00:00
Danny Tuppeny 115a758d87 [analyzer] Include null postfix operator in display strings for code completion, signature help, etc
Change-Id: Iffeda6b3efa3d2bcd4c09a63ab8870b69bc155aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-27 18:27:48 +00:00
Danny Tuppeny 8ae2eb94ff [analyzer] Support "Inline Local Variable" refactor in LSP
Fixes https://github.com/Dart-Code/Dart-Code/issues/545.

Change-Id: Ibee992ab1e5ff13b849d6e1151e21d9229087d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197046
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-27 15:56:08 +00:00
Danny Tuppeny bb8b26596b [analyzer] Support folding enum declarations
Fixes https://github.com/Dart-Code/Dart-Code/issues/3225.

Change-Id: I90aae85c2aaaa034b8190c5bfe1ab66fe6fc0e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197044
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-27 15:45:38 +00:00
Danny Tuppeny 1e51549fab [analyzer] Don't show duplicate code completions for items imported via multiple libraries
Fixes https://github.com/Dart-Code/Dart-Code/issues/3227.

Change-Id: Iac5704fea4f00470040b6b94bbf508dd916ed234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196923
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-26 16:48:28 +00:00
Brian Wilkerson eb1ce5d640 Remove some unnecessary null checks
These were found using the unnecessary-null-checks lint. It has a bug
that prevents us from enabling it at the moment, but we should consider
enabling it once the bug has been fixed.

Change-Id: Ice250b5a6a8723c5f08dec5b07ae738e17c842cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196550
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:22:43 +00:00
Danny Tuppeny 8a0897c165 [analyzer] Fix a bug with completion ranking for items with 0 relevance in LSP
Change-Id: Ic4ef390ba4bdc627e075ae9dade8ced5a307a8ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196667
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:13:32 +00:00
Brian Wilkerson 1ad68b9b16 Make local variables that hide fields be final (analysis_server)
As per our earlier conversation, I looked for places where a local
variable was introduced to overcome field promotion and has the same
name as the field. Where possible I made them final; where not possible
I changed the name.

Change-Id: Iad3d2139693ca66f1eb22a3926c3b84a4115f13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196552
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:12:07 +00:00
Brian Wilkerson 30d27c6f61 Migrate all remaining server libraries except the library in bin
Change-Id: I2041763971a85fb8e9530b64ef30d106091c9739
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196547
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-04-24 04:19:22 +00:00
Paul Berry b10a592341 Add a url field to DiagnosticMessage.
This paves the way for allowing analyzer and analysis server clients
to format diagnostic message URLs in a special way (e.g. to make them
clickable).

Note that DiagnosticMessage is part of the public API of the analyzer,
so I've retained the old behavior in a deprecated fashion to avoid
breaking clients that don't yet handle diagnostic messages containing
URLs.

See
https://dart-review.googlesource.com/c/sdk/+/193749/comment/86d1ce4b_77a60b1e/
for additional discussion.

Change-Id: Iae9d43a2be7dbc67cb7cb82afe0a7824043d6113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196101
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-23 20:34:32 +00:00
Danny Tuppeny a808d5ca20 [analyzer] Update LSP fix-all tests based on new server implementation
Change-Id: Iccc71d67c77eb2a372293e746ca12984f67a0579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196285
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-21 19:48:00 +00:00
Danny Tuppeny a1f0f1b700 [analyzer] Migrate LSP integration tests to null-safe
Change-Id: I0fff9271ef796bc9b3f8316080068d667183f1b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195991
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-21 16:49:30 +00:00