Commit Graph

733 Commits

Author SHA1 Message Date
Brian Wilkerson b08d7756bd Prevent NPE in code completion when completing inside unnamed extension (issue 38798)
Change-Id: Ia7041b236bd3f64662b5e0167de7b7343cfcf68a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121147
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-10-10 21:32:22 +00:00
Ari Aye 4227933c3a Disallow model-only suggestions if static analysis suggests a named argument
Bug: https://github.com/dart-lang/sdk/issues/38404
Change-Id: I72b505cb5bee1f463c0ec6b0a1e9e60c5b7ea518
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117767
Commit-Queue: Ari Aye <ariaye@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-10-09 18:13:48 +00:00
pq 5f74cc1e59 test for eof comment completions
See: https://github.com/dart-lang/sdk/issues/36037

Change-Id: Ib41d9477322092c7003e982980cbfc0923baaf22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118645
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-09-25 18:29:41 +00:00
pq 7235115f36 statement completion for expression bodies
See: https://github.com/flutter/flutter-intellij/issues/3253

Change-Id: Ib892833ecfa4500b726f4f6df42f16f0618c994d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118663
Reviewed-by: Steve Messick <messick@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-09-25 17:56:45 +00:00
Brian Wilkerson 49de78b708 Convert tests so that they will continue to pass when extension methods are enabled by default
Change-Id: I58722f78c19d00842d98ebb238622e88c06468e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117009
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-12 19:12:12 +00:00
Brian Wilkerson 25edeb7ae1 Support completing the extension name locally
Change-Id: I49174918ca84f2aaafe4b47200e9396f2191a727
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-09-11 21:42:26 +00:00
Brian Wilkerson be93b04a7c Introduce a better diagnostic message for unqualified references to static members within extensions
Change-Id: Ie505bf86e510161bf5dece489292388039902f83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116748
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-11 19:02:56 +00:00
Brian Wilkerson 1b67cc79da Suggest completions for extensions in parts
Change-Id: I3aceaf24680ee7599a0beccd79dde1f790ec5ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-09-11 13:34:07 +00:00
Brian Wilkerson a90abd6cf7 Support completions of extensions imported with a prefix
Change-Id: I82a1fe85fef30f5e9e18cf0459ec0d70500c8d68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115002
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-29 21:54:33 +00:00
Brian Wilkerson aa0af27497 Support completion of static members defined in extensions
Change-Id: I4093a000b84e1f56d53f93201250d287662c7af3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114968
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-29 20:33:30 +00:00
pq ea09fbe45d switch case statement completions
follow-up from: https://dart-review.googlesource.com/c/sdk/+/114748

Change-Id: If92ac6e67298e8950d7da57c0d1892cb29ae8c7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114756
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-08-28 23:26:45 +00:00
pq 851701d2a4 add BREAK suggestions to switch cases
fixes: https://github.com/dart-lang/sdk/issues/36605

Change-Id: I29e3b6a46c542895995b5eedcc64262352bb49a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114748
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2019-08-28 20:27:51 +00:00
Brian Wilkerson 91400d6422 Guard against an NPE when computing completions (issue 38006)
Change-Id: Ica0a9cf3eecd765db8e9ebaab560f59275f3c345
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114622
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-27 21:21:53 +00:00
Paul Berry 51cd16ecf0 Flow analysis: support for and for-in elements in collections.
Change-Id: Ia73c68c2b8a57c62ce2b4984184cf8a712b554af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113944
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2019-08-21 21:57:54 +00:00
Paul Berry 4bf5a72ca0 Flow analysis: support functions whose bodies are expressions.
Change-Id: I01a66fb2c897e0cabbdfb4b7423cab53291b3adf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113947
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-08-21 20:41:13 +00:00
Brian Wilkerson b40b301564 Add more extension completion tests and fix a bug they uncovered
Change-Id: I3e89eed886e3100e2d1942e38b124f99bebd6b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113385
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-16 19:39:45 +00:00
Brian Wilkerson ba5c2a16bd Support completion of extension members
Change-Id: I78a59216add7ea612d77bae0d3e52a0185a682e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113281
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-16 14:30:37 +00:00
Brian Wilkerson 802937e5a6 Add support for completions inside extension (and mixin) bodies
Change-Id: I549e91ac7a8e293ea6592043988a67a2da680620
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113133
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-08-15 16:39:05 +00:00
Ari Aye 3cc20cd185 Remove quotes from suggestions coming out of model when completion is requested inside of quotes
There's an issue right now where accepting string literal model completions inside of quotes
will produce duplicate quotes.

Bug: https://github.com/dart-lang/sdk/issues/37820
Change-Id: I7c2f280c8050bd583c4ab49bf97f86fec3df6d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112749
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-13 18:54:40 +00:00
lambdabaa d19a590687 Extract the lexeme from included suggestion tags when correlating with model results
Make sure that we're comparing model lexeme to analyzer lexeme since https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart#L226.

Change-Id: I01d93623fb09ecc169be92674b58a91ef0bf56ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112263
Commit-Queue: Ari Aye <ariaye@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-08-07 20:40:55 +00:00
Brian Wilkerson f8f77eb4c0 Add keyword completion suggestions
Change-Id: I2ec6de7a68397aa9e43b155db52c5473e3d7035d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111667
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-02 15:09:01 +00:00
Brian Wilkerson 86bdb3e3fa Clean up some warnings in analysis server code
This also sorts the content of these files. The analyzer team uses the Sort Members function on all of the source code in our packages.

Change-Id: Id0700954aefe63f6c7d2e43df021997f95ad7e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111663
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-08-01 21:24:00 +00:00
lambdabaa 8f0b6c89e2 Fix uri of dart_completion_ranking_internal_test.dart import
Change-Id: Iafaff006e6b2d52b88498d3674e854fe284ae927
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-30 00:44:04 +00:00
Ari Aye 752f06fff5 Make sure to import and run completion_ranking_test_internal.dart in test_all.dart
Change-Id: I410521737c7c7c2bd45377408769b3b6cbcb8425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
2019-07-29 20:41:43 +00:00
Ari Aye a650cb67f7 Make sure that completion_ranking_test.dart is loaded in test_all.dart
Change-Id: I9933282a9e137c8a3014d1698bfaf50914b72cc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
2019-07-29 17:01:52 +00:00
lambdabaa fc82ed2286 Isolate-based CompletionRanking
Screenshots: https://i.imgur.com/IOLKOCU.png, https://i.imgur.com/dM9VsNr.png

Change-Id: Ieae0f9066b7a349bb4adff6b327b67bcae49aab2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-29 13:45:23 +00:00
Konstantin Shcheglov ec5bf35152 Update analysis_server and analyzer_plugin to stop using DartType.isSubtypeOf().
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: If7365bd82b97bd692af9508697307976ea7c69e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110881
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-29 00:19:37 +00:00
lambdabaa a9ebb5c3c8 Enable running language model unit tests on windows
Change-Id: I63457934fcd23510f6a2848fbb00361ebb40a40f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Ari Aye <ariaye@google.com>
2019-07-27 20:57:59 +00:00
Brian Wilkerson 6241ea1788 Disable running a test from test_all that breaks when run from a parent directory
Change-Id: I08c45f2e54c483e0cbe4bc46a9759c019c8d3f17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110743
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ari Aye <ariaye@google.com>
2019-07-26 18:22:39 +00:00
Brian Wilkerson 8b81bb8115 Remove some unused imports
Change-Id: I516b544b3bdff07e67f444024789093907369959
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110760
Reviewed-by: Ari Aye <ariaye@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-07-26 16:32:01 +00:00
Ari Aye 5d5a0c0164 Check in token-level language model via tflite ffi
Local test run after running `gclient sync`:

ariaye@ariaye1:~/sdk/sdk$ dart pkg/analysis_server/test/services/completion/dart/language_model_test.dart
00:00 +0: calculates lookback
INFO: Initialized TensorFlow Lite runtime.
00:00 +1: predict with defaults
00:01 +2: predict with confidence scores
00:03 +3: predict when no previous tokens
00:04 +4: All tests passed!


Change-Id: I4181bea09cf8fec74d03bba4f83cd26dac818f30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109662
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-25 18:39:51 +00:00
pq c2ff2ca16d collection API use de-linting
Change-Id: I8879f48d484830ff594295b983363b7e3245f092
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108668
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-10 22:49:10 +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
Brian Wilkerson ea0e48a118 Guard against an NPE in completion code (issue 36788)
Change-Id: I05fc48ac7ad495820c5e3f7efdb6db2096108e54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107306
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-06-25 17:13:12 +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
Brian Wilkerson 2e51423c3d Convert the way function types are displayed to better match the syntax of Dart
Change-Id: Id5068bd52b3a35c70cb0d2ccc735469e2f8a0d3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103701
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2019-05-28 20:48:51 +00:00
Jaime Wren 454b98c490 Some additional tests in variable_name_contributor_test.dart to cover all the doIncludePrivateVersion cases
Change-Id: I8ec2a14e8ba4cc3a1ca4228c5455ab7cb6a2138c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101924
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2019-05-08 23:10:49 +00:00
Jaime Wren 2ee973102c Add some additional tests for variable name completions for variable naming inside of for-statements
Change-Id: Ifbc06485a7378f917770ec41e8f0f602bbc2bd1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101624
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-07 20:06:55 +00:00
Brian Wilkerson 2f06696655 Include the keyword required when printing elements, with additional cleanup
Change-Id: If252711ece4ed92bb52b9285704d91944a482c4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-29 17:51:50 +00:00
Brian Wilkerson 000a3eb3f7 Add completion support for late and required
Change-Id: I418aaa3aea9e6da6bcaf02e00c7e329e91175bbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100467
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-04-25 13:24:50 +00:00
Brian Wilkerson 8e550f6a4c Support super completions from superclass constraints in a mixin
Change-Id: Iea4a540989113be85abf98f69cb63843da310a15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-15 13:21:54 +00:00
Brian Wilkerson ed9e70c771 Add completion support for the ui-as-code features
Change-Id: I7835e7169fc702f69f01db0dd1f598a663dff196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96223
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-03-09 17:37:16 +00:00
Konstantin Shcheglov 266ce73e28 Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet.
R=brianwilkerson@google.com

Context: https://github.com/JetBrains/intellij-plugins/pull/633#issuecomment-465725310
Change-Id: I03a1b7e7ec7cc0a5b0797dc960b72ca314a32132
Reviewed-on: https://dart-review.googlesource.com/c/93745
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 21:34:18 +00:00
Konstantin Shcheglov 5e2529c82e Remove 'importUri' from CompletionSuggestion.
R=brianwilkerson@google.com

Change-Id: I1c06f7e6d84d5c2dd0eee7fa80f2e4bca3959513
Reviewed-on: https://dart-review.googlesource.com/c/93379
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-20 18:14:45 +00:00
Konstantin Shcheglov 273856c6e3 Issue 3204. Support for local mixins as types.
However this is not what the issue is about.
But still a bug.

R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/3204
Change-Id: I743e1684f84844422bdfc8fcb30c2b3a051f4580
Reviewed-on: https://dart-review.googlesource.com/c/93376
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-20 03:28:01 +00:00
Konstantin Shcheglov 5f02f3cac2 Remove tests for removed ARGUMENT_LIST suggestions.
It was removed for https://github.com/dart-lang/sdk/issues/25197

This CL though does not remove it everywhere though.
There are 41 other references in tests, doing:
assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);

Maybe we should remove these as well?

R=brianwilkerson@google.com

Change-Id: I812a2d6900e8430e5808a5a5cd8285b32d1517d6
Reviewed-on: https://dart-review.googlesource.com/c/92620
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-11 17:55:00 +00:00
Konstantin Shcheglov 8c891ec25e Include type parameters into suggested code completions.
R=brianwilkerson@google.com

Bug: https://buganizer.corp.google.com/issues/120659839
Change-Id: I51ec6142b97b079c4db55ef1f2081354ee16dda5
Reviewed-on: https://dart-review.googlesource.com/c/91858
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-04 05:37:37 +00:00
Konstantin Shcheglov 133d83eede Protect against override completion outside workspace.
R=brianwilkerson@google.com

Bug: https://buganizer.corp.google.com/issues/123774694
Change-Id: I9f5aa93a86c0d1a0c496cd77853314a23a1aedbe
Reviewed-on: https://dart-review.googlesource.com/c/91853
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-02-03 17:27:16 +00:00
Konstantin Shcheglov 931051814c Partial implementation of the 'available suggestion sets' protocol.
R=brianwilkerson@google.com

Change-Id: I856b6a39c2464caf6750e0b0abb0cfa29311e97c
Reviewed-on: https://dart-review.googlesource.com/c/91769
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-02-01 17:55:27 +00:00
Konstantin Shcheglov 485a41bb12 Include superclass constraints into mixin type suggestions.
R=brianwilkerson@google.com

Bug: https://buganizer.corp.google.com/issues/123231336
Change-Id: I0e1ce9a332f47211ef2614ae73009433d1839ba0
Reviewed-on: https://dart-review.googlesource.com/c/91691
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2019-01-31 15:12:15 +00:00