Commit Graph

3080 Commits

Author SHA1 Message Date
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
Konstantin Shcheglov 143e5ef556 Revert 'Import Library' quick fix changes.
This basically reverts https://dart-review.googlesource.com/c/sdk/+/103921
because internally IntelliJ does not provide module dependencies yet.

Change-Id: I7717b2841bf3d6391b991875a594c6df9e246ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106482
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-06-18 17:31:56 +00:00
Danny Tuppeny e32a179922 Add LSP support for Extract Method refactor
Change-Id: Id5c9e0657648963d5f96469fbac9269dad4e32a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106348
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-18 15:40:10 +00:00
Danny Tuppeny 60fa066cd7 Filter LSP completion to exclude symbols already imported via another URI
Change-Id: I39d807ef88b939feffcba2b333dd76595257c768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105760
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-17 14:16:21 +00:00
Danny Tuppeny 06b28fc60f Filter TODOs out of LSP diagnostics
Change-Id: I4a089be3919e0a2ed6c1e54e712ba7f1c9d835aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-13 07:31:36 +00:00
Danny Tuppeny c177b4cc4c Make the ranges of constructors in hovers match those of methods/functions
Fixes https://github.com/dart-lang/sdk/issues/35386.

Change-Id: I66c0b1b9f47b8f037da9585453330d6eb1de3c4e
Bug: https://github.com/dart-lang/sdk/issues/35386
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-12 13:28:37 +00:00
Danny Tuppeny cbb1816177 Remove unnecessary LSP hover handling comment/code
Change-Id: I1609dd07dae57b6bac48492c64f7ac1a7fb82d5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105741
Auto-Submit: Danny Tuppeny <dantup@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-12 13:25:27 +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
Brian Wilkerson c41e9ae0e8 Fix wording in spec
Change-Id: I468d0afa21102fc6fe6f30aa1c7bd0d1c46d8f94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105464
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-10 17:24:35 +00:00
Paul Berry 51046368c5 Move NNBD migration tool to a fresh package.
This gives us more flexibility for how we want to publish and deploy
the tool.  We now have the option, for example, of making a command
line app that invokes the tool and does not depend on analysis_server.

Note that some testing infrastructure had to be duplicated.  I plan to
consolidate this infrastructure in follow-up CLs.

Change-Id: I046506bc2bb5c3e467e15885f198ee0632351ee9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105463
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-09 17:45:35 +00:00
Brian Wilkerson 6c358d3ba6 Permissive mode reports the exceptions that were thrown and ignored
Change-Id: I1876577acc43ba076ff4eec3b2891e329c109c24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105407
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-08 14:29:09 +00:00
Brian Wilkerson 065c42705c Added an errors field to allow permissive mode to display the exceptions that are being ignored
Change-Id: Id8fd27a7882c6dd20854d055477af25d17de3582
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105440
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-06-07 19:32:35 +00:00
Paul Berry 15a3df3c10 Migration: add support for cascade expressions.
Change-Id: Iae52bef6a18c9536db3187102566423bc2f1dba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105325
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-07 13:39:49 +00:00
Dan Rubel 41eea71a69 improve dartfix fix descriptions and add examples
Change-Id: I19c74bd9c55da29460ebe6f41b79e327429d6b22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105323
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-06 20:23:48 +00:00
Paul Berry c130384c71 Migration: support assignments to fields and setters.
Change-Id: I4dbf43878f5cbf0a16a041e0975880c3d844fa13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-06 19:52:37 +00:00
Brian Wilkerson 30390c6ba1 Prepare to compute the documentation URL for diagnostics
Change-Id: Ib1b7e4887e18b90c1552f3f8501948ee8d8d2c1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105260
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-06 16:41:46 +00:00
Konstantin Shcheglov 3bd2b03980 Issue 2972. Fix 'Wrap with...' for assignment.
R=brianwilkerson@google.com, pquitslund@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2972
Change-Id: I4dda6f73516d1715686884d55dc43405b36f3631
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-06-06 14:14:09 +00:00
Jaime Wren bbf0055a28 Follow up on recent computer_hover.dart changes, the containingLibraryName should not include relative paths from /.
Change-Id: I0fa25196e60eac694a09f3c71c36b2c09563c789
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-05 21:35:03 +00:00
Paul Berry 9a061448a5 Migration: support assignment to index expressions.
Change-Id: I7f295247d059f532cabd24518f5009f017a34fd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104946
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-05 19:58:07 +00:00
Danny Tuppeny 94968f9bae Correct LSP completion relevance to add maximum boost instead of all boosts
Equiv change to https://github.com/JetBrains/intellij-plugins/pull/660.

Change-Id: I93192588de11afc1828b1f26e8f14f9b836cfd19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-05 15:24:22 +00:00
Paul Berry 42688f9d28 Migration: add support for reads from fields.
Change-Id: Iaa74a0d5d730df0a5ad57de839de01f1b54c1240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104807
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-05 14:25:50 +00:00
Paul Berry 2cd86030a5 Fix return value in GraphBuilder.visitVariableDeclaration.
This method should return `null`, since it doesn't visit an expression.

Change-Id: I018241c0d2e9b9f00bfe293352cf2707551c81e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-05 14:24:20 +00:00
Paul Berry 79989d2627 Migration: recognize /*?*/ as expressing nullability.
Change-Id: I132d15775bb55ca4772a7b48f6a85c12c930a498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104880
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-05 12:41:41 +00:00
Paul Berry 4402fbe672 Migration: support index expressions.
Change-Id: Ie43b5045df75b325a74243a8ae8801387c73c64a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-05 11:49:52 +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 2f0c9904ee Remove docs from LSP (suggestion set) completions and provide during resolve
Change-Id: I1e3c99e3076e829822b418ffaf19dcb891e93f81
Bug: https://github.com/dart-lang/sdk/issues/37163
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-05 06:47:51 +00:00
Danny Tuppeny 91b3281531 Reduce LSP completion JSON by removing optional fields set to defaults
This addresses some of the things mentioned in https://github.com/dart-lang/sdk/issues/37163 but doesn't entirely solve the issue (for example it doesn't touch docs yet).

Change-Id: Ib0a094695905120ac5e222dae52165b9a5f9a825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-05 06:47:51 +00:00
Brian Wilkerson 6031ca4116 Remove an unused import from the LSP support
Change-Id: I7fc72f249c18688cd8262f73ccd9c14aea45f908
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104943
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Danny Tuppeny <dantup@google.com>
2019-06-05 06:47:21 +00:00
Konstantin Shcheglov 37b714401d Add AvailableSuggestion.declaringLibraryUri
We need this to support existingImports filtering, because filtering
is done on suggestion basis, not on the whole suggestion set basic,
because of re-exports.

R=brianwilkerson@google.com

Change-Id: Id97cb122fa6e3c5c62e367098e1917eba997a76f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104808
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-05 01:20:51 +00:00
Brian Wilkerson f7526daebd Fix a hint in the migration engine
Change-Id: I119c44b30a1d3c6fb0d725ddb546cd3dcb31dab1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104809
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2019-06-04 22:18:43 +00:00
Paul Berry fa19cd7bb8 Migration: handle simple assignment expressions (x = y).
Change-Id: I580b902e83325a7a0a85686ebf7393993e531446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104803
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-04 17:12:01 +00:00
Paul Berry 74b7165cc8 Migration: support references to local variables.
Change-Id: I43c4e2882c003b9cb219406c2aaac507b7f63979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104802
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-04 17:03:56 +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
Paul Berry 15c0315e8e Migration: add support for local variable declarations.
Change-Id: Ifead9354c583a070a7240d158823eafe1be3d875
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104840
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-04 15:53:25 +00:00
Paul Berry 46dd19609e Migration: recognize /*!*/ as expressing non-null intent.
Change-Id: Ic9f0b3f560df00adf5e7cbab71b3380f6c43c0aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-06-04 14:54:29 +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 0200a1e7b2 Extract LSP initializationOptions into a class
Change-Id: I50402bb75f51a771931d9b5255b7b9207d0f316b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2019-06-04 13:35:17 +00:00
Konstantin Shcheglov d24b407568 Add --use-summary2 flag to AnalysisServer.
So that we can start dogfooding it.

I noticed that we logged too much data, so I reworked what we
log in LibraryContext.

Currently performance will be subpar, due to using content hash as
file's API signature. So, any change to a file, even in a method
body will cause the whole library cycle (and everything that depends
on it) invalidation. I will implement computing API signatures for
parsed unit (hopefully reusing something already existing) in a
following CL.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ifb77e29188484b6784edbaa6a6d5daca6800ef2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104603
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-06-04 02:58:29 +00:00
Konstantin Shcheglov d63466041c Issue 131596231. Suggest names for SimpleFormalParameter(s).
R=brianwilkerson@google.com, jwren@google.com

Change-Id: I9074ef1a5aaeee32303dcf247c2be86f9c173d14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104460
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2019-06-03 17:34:18 +00:00
Paul Berry 578629ad26 Add migration support for property accesses.
Also made some minor improvements to the handling of method calls.

Change-Id: I8728a7901cfe61f88563b71e290e9d5b303afda1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104486
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-03 14:51:34 +00:00
Paul Berry b1e28691d1 Only create hard edges for local variable/parameter references.
Exception: also create hard edges for the relation between a type
argument and the corresponding type parameter bound, because that
can't be fixed by a null check.
Change-Id: I71b21ddb11c1bb1060cb6f13efde13855770e2b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104485
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-03 14:51:34 +00:00
Paul Berry 8776bdbf42 Rename migration visitors to reflect terminology in the design doc
Change-Id: I9e554356032700bbbac93df4e754fa1fc1c67041
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104484
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-03 14:51:34 +00:00
Paul Berry e31af09992 Remove NullabilityMigrationAssumptions class.
This was a lot of bookkeeping for very little added value.  If we want
to experiment with changing the behavior of the migration tool in the
future, we should experimentally change it and see whether the quality
of the migration improves; it's not worth speculatively keeping
multiple behaviors around while the tool is being developed.

Change-Id: I9a59e2626be7e9e84a937e287421abcdc971aba5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104482
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-03 02:20:26 +00:00
Paul Berry 709df79404 Clean up logic to decide whether to create hard edges
Previously we were creating hard edges for the default values of
optional parameters.  This was incorrect; we don't want a hard edge
because we don't want evidence of non-nullability to propagate
upstream from an optional parameter to the const expression that sets
its default value.

Change-Id: I44e12ae96987fd7a9defc538b0704cf76262473f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104500
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-03 02:20:26 +00:00
Paul Berry 01694dcca1 Handle nullability nodes for dynamic types more cleanly.
Rather than use an edge from `always` to ensure that these nodes are
nullable (which is error prone since it could be overridden by an
assertion), we simply place these nodes in the ordinary nullable state
at the time they are created.

As a side effect we can reduce the amount of code we have to plumb the
nullability graph through.

Change-Id: I46cf5b2026aeb2917cb35a7ad0d36a0a0562ecc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104481
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-06-03 02:20:26 +00:00