Commit Graph

161 Commits

Author SHA1 Message Date
Brian Wilkerson 7e724e70b0 Sort non-generated files in analyis_server and add a test to ensure they stay that way
Change-Id: I6c7a38cefa69f46737bd50eefe2fbb88c127017b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-03-28 17:12:03 +00:00
Brian Wilkerson 5d7f3093fd Update the lsp generator to generate return types for all methods
Change-Id: Id1a90d770aa772327011ee8ccc7a13f0ca6f8de4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-30 21:43:43 +00:00
Brian Wilkerson 0d3571b52f Add return types to more methods in analysis_server
Change-Id: Ib61c92d65e6170a1b5cd3e3d24affb3a3fa16bb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-29 20:18:20 +00:00
Brian Wilkerson 5584c96fde Enable prefer_single_quotes in analysis_server
All of the changes except in the analysis options file are from dartfix.

Change-Id: Icd9bf02ad07f71d1fc365979c7dfe18a792dc595
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132624
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-21 17:52:52 +00:00
Brian Wilkerson 32ce9c7872 Enable prefer_collection_literals in three packages
Other than the following changes, all of the changes were made by dartfix:
- the analysis options files
- one line to enable the fix through dartfix (missed in an earlier CL)
- three places where a bug in the fix produced invalid code (issue and fix TBD)

Change-Id: If8660700792561805f4d1c96ccecd81abcebfeb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131209
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-11 20:39:02 +00:00
Sam Rawlins 327b1eb24f analysis_server: Make private fields final where possible
Change-Id: Ibdeb7e66f07bf81205d70ac5d1c4cb4aa5a97671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-01-08 22:08:02 +00:00
Danny Tuppeny c8c367bb10 Add valueRange field to LSP Flutter Outline attributes
Include range of values in LSP FlutterOutline notifications

Change-Id: I07cbe970d553f793dbdb4cb282807eec12720017
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-08 20:10:06 +00:00
Brian Wilkerson 8c6c27541e Disable a lint in the LSP generated code and re-run the generator
Turns out we aren't testing to ensure that the LSP generator has been
run as part of our test suite. Ideally we'd do so and we'd update the
generator to produce code that doesn't violate lints, but that's more
work than I can do today. Hence this stop-gap CL.

Change-Id: Ia9e5a35817fc4d08e2a4b87b9c2ef64725c822b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130004
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-02 04:55:46 +00:00
Brian Wilkerson 91d6e1a0a7 Enable annotate_overrides in several packages
Other than analysis_server/test/analysis/notification_overrides_test.dart,
which had a naming conflict, all of the changes were made using dartfix.

Change-Id: I911dd75dcdee00420caa48724125e86d47c8857d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130002
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-01-01 21:31:40 +00:00
Brian Wilkerson 7d41ae7d15 Enable unnecessary_this in several packages
Change-Id: I743066d66dbf1dff984e8f8bf5b7a472c9bc7ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129821
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-12-28 20:43:16 +00:00
Brian Wilkerson de57ff3b1d Remove one missed generated use of const in analysis_server
Change-Id: I6aac996b1cfe1c5d49d2cb68f7c7340893b79531
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-12-19 05:34:28 +00:00
Brian Wilkerson 4043a6fce3 Remove unnecessary uses of new in analysis_server
Other than analysis_options.yaml, all of the changes were from running
dartfix.

Change-Id: I92411642f12a00fc6bd0bfd24dd60fe67f0fed16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128845
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-12-18 19:01:51 +00:00
Danny Tuppeny 0addcc0c7d Update LSP spec URI and regenerate from spec
Change-Id: I361a7a6e10167e140bf4ba190f29a3c33c584f01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128720
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-18 15:08:21 +00:00
Brian Wilkerson c9d89d55a6 Stop generating unnecessary new and const in server generators
This doesn't remove other uses of new or const, only those that are
generated. I'll get the rest in other CLs.

Change-Id: I59c296da3d2da0f45789df156a682b9c37398087
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-12-18 05:15:25 +00:00
Danny Tuppeny 62e5531e36 Add a Flutter Outline Notification to the LSP server
Change-Id: Ifbff7d88df7e468cfba383fda89160c7d3d5ee33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128662
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-17 17:46:36 +00:00
Danny Tuppeny 7c5d83d170 Add explicit type to generated LSP classes == operators
Change-Id: I42f76c8d48329fed93821a17da71963eaa813d4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-12-12 18:42:20 +00:00
Danny Tuppeny 3739b80534 Add a publishOutline notification to the LSP server
Clients can opt-in by passing "outline: true" in initializationOptions.

Fix outline name

Change-Id: I3a302178c685b49afe50370aef8360105b9676fc

Add test that outline comes through after change

Change-Id: If36344d485ea11c4b25d57e1e1fb43b575e8188f

Initial work on supplying Outline data over LSP

Change-Id: I74670b5c43a41af49195712bcc4be8e120e5b4ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128141
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-12-12 18:42:20 +00:00
????? 6546460461 chore(doc): fix typo
Closes #39128
https://github.com/dart-lang/sdk/pull/39128

GitOrigin-RevId: f03a58d8dd0a486021eb0d5e51e01383cef48f6e
Change-Id: Iedc2caca99963b26c73b43f65e32be59e750bca7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123061
Reviewed-by: Michael Thomsen <mit@google.com>
2019-11-20 11:27:58 +00:00
Sam Rawlins 680a880c10 Move string utils from services/correction to utilities; more generally used
Change-Id: Idb81b54fe380e6af00af5ddee3977705ff58c741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121912
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2019-10-17 15:04:00 +00:00
Brian Wilkerson 61b4c0f770 Cleanup hints and lints in analyzer packages
Change-Id: I7f1a6ad1ed3610da9616683576ebfb5efd543fd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119164
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-27 16:12:44 +00:00
Danny Tuppeny c44c2f1b68 Update LSP readme with instructions for shipped SDKs instead of source
Change-Id: I5ea6584adec083f423098a8d0601d45d7b66e576
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-08-21 13:41:07 +00:00
Danny Tuppeny 1e79aa6b7e Update LSP readme to link to dart-vim instructions
Change-Id: Ie36803aa3012035acb3cf9dca012e55ad2ec4d79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113696
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-08-20 14:18:00 +00:00
pq 52abcd3dd2 apply prefer_equal_for_default_values
Change-Id: I9b6fd3ee18ec834a5db3d0d25455b6db9ea4fbe2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108664
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-07-10 19:31:40 +00:00
Danny Tuppeny 855830f324 Update LSP spec
The spec has un-deprecated insertText which we'll use soon.

Change-Id: I2aa6dc8b3392867ecec0d0764b8635453a896a1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108412
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-07-09 16:48:39 +00:00
Danny Tuppeny 1aa89591e3 Add LSP support for Extract Widget
Change-Id: I0d7068ab48eff2a27a00fad5e821e819c816a253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106351
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-19 06:56:22 +00:00
Danny Tuppeny 1ba9ed7a35 Improve LSP JSON error when an expected object is not an object
Change-Id: I79632ceca51a5288f9b742f78483a6c2117f58d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105588
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 9d5b4491b2 Remove redundant null checks from LSP validation
Change-Id: Ie978b598ecec85455628263d0e3cf2f6f8f71253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105587
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny ca3320e3bd Tweak LSP JSON validation error messages
Change-Id: I732d0020a68256632ee8ba823a0a31eb4a5360d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105586
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 972ea07459 Simplify LSP json error reporter with push/pop fields
Change-Id: I5186eb2de3cf956ada04237ac7ff90fc2d01b79b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 530a2f5681 Make a null LSP error reporter to avoid so many null checks
Change-Id: I08f9259ba5aca52c61dd6820a3cc54bf40a30c92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105584
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny 9fb2842fce Improve the error messages reported in LSP when params are not valid
Change-Id: I305955a22d687e8338138db48dff4e32589bbc6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 19:07:29 +00:00
Danny Tuppeny a684f2051b Reduce JSON for LSP completions by moving edits to resolve
See https://github.com/dart-lang/sdk/issues/37163.

Change-Id: I336245590560f7b30315a1dbda59ea56e5e9e043
Bug: https://github.com/dart-lang/sdk/issues/37163
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-05 06:47:51 +00:00
Danny Tuppeny 64a9253763 Add LSP method to fetch super method/class for a position
Change-Id: If8f28a708312113916cc9cecd75e768f7fec393b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-04 16:05:15 +00:00
Danny Tuppeny 9a3478ac20 Add support + tests for closing labels
Change-Id: I415a352010044d3b4aeb156d9d11dbbd94e86461
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104782
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-04 13:35:57 +00:00
Danny Tuppeny fca2c82be0 Add support for cancelling requests in LSP server
Change-Id: I2a651b1e4f8509c7f10d245b2369aab842d08041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103845
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-29 14:52:40 +00:00
Danny Tuppeny e4362612b0 Add support for dynamic registration for LSP
Change-Id: I55c7b2f7d683acab0f6aa4bdbcba3b155d2de32c


Change-Id: I6a0b13856053bd86e77637b9664c7fe41194c5f3


Change-Id: I7472cf93efc29585ccbcbd1e6c7b9f703872b3c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103532
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-27 17:36:20 +00:00
Danny Tuppeny 022adc5bc3 Implement using suggestion sets for LSP completions
Change-Id: I66d725c09492040be5e621d80270b12a21bb8192
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102704
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 0f24e4b277 Wire up LSP completion resolution provider + sendWorkspaceEdit command
Change-Id: I424b4d9bbc64f6fea7a4d9b06e2180b3fbd21f86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102703
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 7be23977f1 Minor LSP tweaks in preperation for included suggestionSets
Change-Id: I9dff56139754b8a182e906d64dd0bcc009c4b6fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-20 10:09:41 +00:00
Danny Tuppeny 6805bb52ea Add implementation/tests for textDocument/Implementation
Fixes https://github.com/dart-lang/sdk/issues/36896

Change-Id: Ie450c6c5257ac13aa3c7b48343aa8b015b1dc4d8

Tweak tests to require all, plus fix empty classes

Change-Id: Iefff7e24c6b965f0a1bc5abf8adbac26ad38e3a0

Add implementation/tests for textDocument/Implementation

Change-Id: I640379d83aeb9baa73d04d98d39147e2b748d6c3
Bug: https://github.com/dart-lang/sdk/issues/36896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102366
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-15 09:08:28 +00:00
Danny Tuppeny cdcc387084 Add LSP custom notifications for analyzing status
Change-Id: I0d26d274c9ccc472da81e45d0c9170104bbd9414
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102370
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-05-15 06:35:48 +00:00
Danny Tuppeny a779db0813 Update LSP spec to latest
Change-Id: I6f7ff3c6707f992aa618ad172e81857153b75795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102360
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-13 15:11:15 +00:00
Danny Tuppeny 53438199a4 Tweak version numbers in LSP readme
Change-Id: I9dfa1165d41115ef6f30fd0718c75c058e8c968a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95380
Auto-Submit: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-03-05 18:16:31 +00:00
Danny Tuppeny 0e9d97498c Add some notes on using Dart LSP with Vim
Change-Id: I5b77243e8d725ca9802db56b59692b6e8a847d9c
Reviewed-on: https://dart-review.googlesource.com/c/94207
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 12:08:32 +00:00
Danny Tuppeny f484e1b05e Call canParse() for all LSP requests before passing to handlers
Any requests with params that don't pass canParse() will result in an InvalidParams error being returned without the handler being invoked.

Change-Id: Ic3e84b9259a467179baa2309fb58ee207f1225fa
Reviewed-on: https://dart-review.googlesource.com/c/94298
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny 0e54ce3b2d Fix a canParse method that would overflow the stack
This method is (accidentally) not currently being called, but it will be soon. The codegen wasn't using the resolved base-type for the enum when writing the type check.

Change-Id: I025ed5109c70d8916f800295350a3f4eaf8f16f2
Reviewed-on: https://dart-review.googlesource.com/c/94294
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny 8fb52650e5 Ensure LSP canParse type-checks optional values
Previously we were only outputting the validation code if the value was required. This changes it to also validate in the case it's not required, but only if it's not-null.

Without this change, the test that parses `'overwrite': 1` fails (a boolean is expected), but with it, it passes.

Change-Id: Ic4afe1f6a8f78add2385831907b226022b7ecaec
Reviewed-on: https://dart-review.googlesource.com/c/94293
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny d1876531f2 Fix LSP canParse to allow nulls where the spec allows
Change-Id: I8a34fbf03e45c85a70d44a54b1715b87f84f9c3b
Reviewed-on: https://dart-review.googlesource.com/c/94290
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-27 08:12:02 +00:00
Danny Tuppeny a52ac7d27b Correct LSP canParse functions for classes containing restricted enums
This fixes a mistake where enum classes were resolved to their base types (string, num) before being output in canParse methods of their containing class. This meant for "restricted" enum types (those that should not allow any value), canParse would incorrectly return true for out-of-bound values as long as they were the correct type.

Change-Id: I44e37a60b49287cf7202d5a578ee9c08cf898078
Reviewed-on: https://dart-review.googlesource.com/c/94280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-26 07:38:12 +00:00
Danny Tuppeny bf0568c548 Document restrictions on LSP refactors/code fixes
We only provide fixes/refactors/assists to clients that support returning literal CodeActions (not just Commands). CodeActions allow us to return a WorkspaceEdit directly without having to encode the action into a command/argument set that is tround-tripped to the client. Supporting CodeActions on the client is relatively straight forward (since it just removes a round-trip and applies the edit directly).

Change-Id: I7f5a8c22e66ac23bcde6d5782bc2eaa6aeb283da
Reviewed-on: https://dart-review.googlesource.com/c/94221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-02-25 17:45:34 +00:00