Commit Graph

2342 Commits

Author SHA1 Message Date
Konstantin Shcheglov cde2d81676 Check for name conflict in 'Extract Widget' refactoring.
R=brianwilkerson@google.com

Change-Id: Ifa620eafa32e4c2ce8b062328b562d6991ddfa0b
Reviewed-on: https://dart-review.googlesource.com/48442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-26 18:54:38 +00:00
Konstantin Shcheglov b0f3cd9022 'Extract Widget' should be available on the names of instance creation too.
R=brianwilkerson@google.com

Change-Id: I1a6c35a4d420da1663501d08e9032281c294c368
Reviewed-on: https://dart-review.googlesource.com/48341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-26 00:17:24 +00:00
Konstantin Shcheglov 633b2ccb38 Add 'isWidgetClass' and 'stateClassName' to FlutterOutline.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: Idf7a986a67321b3ed33bb5d3bd4c139fac995474
Reviewed-on: https://dart-review.googlesource.com/48260
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-25 20:22:26 +00:00
Brian Wilkerson d06dbb2ba8 Make most of the server Dart 2 safe
Change-Id: Ic9e8ea2557d01c05caedc126486778865af0396d
Reviewed-on: https://dart-review.googlesource.com/48262
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-24 15:33:53 +00:00
Brian Wilkerson 7e53bb0689 Add hint for optional new/const to hover
Change-Id: Id1df68e3446d24bceb96f13c92c721fafa63c859
Reviewed-on: https://dart-review.googlesource.com/48266
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-24 14:54:23 +00:00
Brian Wilkerson 39395f911b Send type parameters for functions in outlines
Change-Id: Ie11d739a41408903390ac2c1434d05fd7dccca0e
Reviewed-on: https://dart-review.googlesource.com/48267
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-24 14:54:13 +00:00
Konstantin Shcheglov 5be7955bb5 Expose 'Extract Widget' refactoring from Analysis Server.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/1250
Change-Id: Ieb91e876b4199440e7f3811c39a523b040ca14f0
Reviewed-on: https://dart-review.googlesource.com/48086
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-23 18:28:09 +00:00
Konstantin Shcheglov ea1d1d7621 Support for extracting methods with parameters.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/1250
Change-Id: I906e14feba246a7704fbbcdaa358730be5916a47
Reviewed-on: https://dart-review.googlesource.com/47945
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-23 00:26:45 +00:00
Konstantin Shcheglov 6bd38cc912 Analysis Server API for 'Extract Widget' refactoring.
R=brianwilkerson@google.com

Change-Id: Ie6b7c349d304785ab6829770ebd3504c0affe8df
Reviewed-on: https://dart-review.googlesource.com/47943
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-22 20:25:29 +00:00
Konstantin Shcheglov 696be0ae46 Initial support for extracting methods.
No support for method arguments and multiple invocations yet.

R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/1250
Change-Id: I11b817676e254b2a456d97d60d2ab45893a65e68
Reviewed-on: https://dart-review.googlesource.com/47940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 19:51:58 +00:00
Brian Wilkerson 26c06cdd82 Clean up Dart 2 type issues related to YAML support
Change-Id: Ic29054afca9773286aa899eecede287f7ecbca9a
Reviewed-on: https://dart-review.googlesource.com/47680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 17:06:40 +00:00
Brian Wilkerson 014bd821e6 Retry when fixes cannot be computed because of an inconsistent session (issue 32635)
Change-Id: I47df681dd16faa509d20440d90af0f35b158c299
Reviewed-on: https://dart-review.googlesource.com/47900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-22 16:41:17 +00:00
Brian Wilkerson dc5a8b2e91 Improve the fix to add an explicit cast
Change-Id: I748bd56265ea3072a3b7ed49fa77f6a9e91c3093
Reviewed-on: https://dart-review.googlesource.com/47242
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-22 15:27:27 +00:00
Konstantin Shcheglov 5430010395 Use writeFieldDeclaration() and writeFunctionDeclaration() to write extracted widget.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/1250
Change-Id: Ib0fad02ab4bae6681182101a15600096615f0e98
Reviewed-on: https://dart-review.googlesource.com/47663
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-21 22:58:44 +00:00
Konstantin Shcheglov 8658a7403e Check for references/writes to superclass members.
R=brianwilkerson@google.com

Change-Id: I9907df6d773923fe6801034208a21f17fc86178b
Reviewed-on: https://dart-review.googlesource.com/47581
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-21 19:42:25 +00:00
Konstantin Shcheglov a8986cf45a Support for parameters for extracted widget.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/1250
Change-Id: Iccb46976f3b92ed7dddac0e80f6ff48d905a495f
Reviewed-on: https://dart-review.googlesource.com/47542
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-21 18:51:13 +00:00
Konstantin Shcheglov 6469f4c78a Support for extracting widget from a function.
R=brianwilkerson@google.com

Change-Id: I2775ac681f14d26d96a872aae98c473062d47305
Reviewed-on: https://dart-review.googlesource.com/47380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-20 23:29:19 +00:00
Konstantin Shcheglov 8abeb56ebb Basic 'Extract Widget' refactoring.
Only a widget creation expression can be extracted.

Not exposed through Analysis Server API.

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

Change-Id: I6a47cc1851d69b54a2812bd6a5320c287d5b9eae
Reviewed-on: https://dart-review.googlesource.com/47360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 21:24:56 +00:00
Konstantin Shcheglov 965cb81c0f Add AnalysisSessionHelper and move getClass() into it.
R=brianwilkerson@google.com

Change-Id: I5d1f121ff86d1eea75d6f79663394bb79305c4ca
Reviewed-on: https://dart-review.googlesource.com/47187
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 19:05:24 +00:00
Konstantin Shcheglov ac322d0fb4 Move LibraryElement caching to AnalysisSession.
I need something similar for Extract Widget refactoring - get references
to some Flutter types, which are probably already available from the
resolved unit.

R=brianwilkerson@google.com

Change-Id: I8d9a9e6c35c9fe7ef8fba6547c560642f650d018
Reviewed-on: https://dart-review.googlesource.com/47184
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 22:26:47 +00:00
Brian Wilkerson 2047d44631 Handle the case where there is no selection(issue 32563)
Change-Id: I5f1981a89a5af438ccc0e0b4395083ed04cda180
Reviewed-on: https://dart-review.googlesource.com/47185
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 22:06:37 +00:00
Brian Wilkerson 9df1d66b57 Flip analyzer and server to preview-dart-2 by default
Change-Id: I5d009debf962ba49ae715a87aa117538f552fbdb
Reviewed-on: https://dart-review.googlesource.com/47122
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 20:57:17 +00:00
Konstantin Shcheglov 1d184ace7b Fixes for packages:args deprecated uses.
Mostly addOption() -> addMultiOption().

Change-Id: Iab40059aab45a371e0def89fbdfcd08bd1487d47
Reviewed-on: https://dart-review.googlesource.com/47121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 20:15:37 +00:00
Brian Wilkerson 746c2557a2 Correctly handle casts of Set in quick fix
Change-Id: I00067a03b41cc0ace16501fc21b990b91ea0af61
Reviewed-on: https://dart-review.googlesource.com/46944
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-17 14:55:38 +00:00
Konstantin Shcheglov 91d3c02d19 Rewrite relative URIs in instrumented Flutter outline code.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I33e73400643d77eb7c2b105eae918f4997e7d55d
Reviewed-on: https://dart-review.googlesource.com/46920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-16 16:52:40 +00:00
Brian Wilkerson f6f1327fbe Add a fix to add an explicit cast
Change-Id: Ib27b2609cce14ea6d7c1666388c653e757b82a64
Reviewed-on: https://dart-review.googlesource.com/46881
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-16 16:43:58 +00:00
Konstantin Shcheglov 2881ebcd78 Fix for lint non_constant_identifier_names.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32488
Change-Id: I76580a581845d8c6d3c8003b6b0f631a5fc40cdb
Reviewed-on: https://dart-review.googlesource.com/46822
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 22:44:44 +00:00
Konstantin Shcheglov 64e092d4a3 Add fields codeOffset/codeLength to FlutterOutline.
R=brianwilkerson@google.com

Change-Id: I917a780704882fcd7537a9334febc21098aabd4f
Reviewed-on: https://dart-review.googlesource.com/46579
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-15 21:01:14 +00:00
Konstantin Shcheglov 693390a776 Index and search implicit references to optional positional parameters.
R=brianwilkerson@google.com

Change-Id: Icf5f48118aeccbc137f125f9e730c9fe84200063
Reviewed-on: https://dart-review.googlesource.com/45922
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 23:23:49 +00:00
Devon Carew 80a571d546 Take the --preview-dart-2 defaults from the context and options classes, not the cli tool defaults.
Also, allow --no-preview-dart-2 from dartanalyzer.

Change-Id: Ic304a29e640bbddb50892c28712a131a2b306930
Reviewed-on: https://dart-review.googlesource.com/45881
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-09 22:30:24 +00:00
Brian Wilkerson 8d47a6e86f Add a fix for lints that recommend using final (issue 32473)
Change-Id: I9ba38998e99c6102c0b69a2a3f8427416d087f2e
Reviewed-on: https://dart-review.googlesource.com/45900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-09 22:09:18 +00:00
Konstantin Shcheglov e1909cb52a Update Outline protocol - change offset/length, add codeOffset/codeLength.
R=brianwilkerson@google.com

Change-Id: I4b5c03a21254f7c497adc4c043641b18599c5c39
Reviewed-on: https://dart-review.googlesource.com/45764
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-09 01:52:57 +00:00
Brian Wilkerson 602a8c2a7b Clean up usage of deprecated constants
Change-Id: I9005ba6e94529e15d8f7b21322591f4a9dabec47
Reviewed-on: https://dart-review.googlesource.com/45763
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-09 01:02:49 +00:00
Konstantin Shcheglov eea08cfabe Add optional 'file' for getElementDeclarations.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32461
Change-Id: I0fa5ab2165e24f5b17ecc20ad8f97471389c8b8f
Reviewed-on: https://dart-review.googlesource.com/45761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-08 19:10:47 +00:00
Konstantin Shcheglov 50ba330a04 Fix for suggesting both class and its default constructor.
R=brianwilkerson@google.com, devoncarew@google.com

Bug: https://github.com/dart-lang/sdk/issues/32456
Change-Id: Ie4d8b38ad78b1d8ac72f95e71ec29f081d9a9ee8
Reviewed-on: https://dart-review.googlesource.com/45584
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-08 07:27:46 +00:00
Konstantin Shcheglov 6b44182344 Only widgets in libraries can be rendered.
Technically we could eventually implement rendering widgets in parts,
but this is probably rare situation, and IntelliJ plugin does not
handle this case yet.

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

Change-Id: I734eb5f5b26c386780a776f652366bd4d21125f9
Reviewed-on: https://dart-review.googlesource.com/45361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-06 18:02:39 +00:00
Konstantin Shcheglov be87175fee Implement Flutter Outline rendering API.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I7cbb4c0be7656ba1e684e8864348e6f1af54efae
Reviewed-on: https://dart-review.googlesource.com/45140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-06 16:33:34 +00:00
Konstantin Shcheglov 6189b9a360 Change Flutter Outline API to provide full instrumented code instead of edits.
This solves potential consistency problem between Analysis Server and IDE.

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

Change-Id: I1403af1c90d7fec2ff18ffdb862f2209b19e548e
Reviewed-on: https://dart-review.googlesource.com/45124
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 22:46:19 +00:00
Brian Wilkerson 1d159e7c23 Rename annotation testing methods in Element
Change-Id: I0f60b9abd3de350e62d89eac0d690a1db40316b7
Reviewed-on: https://dart-review.googlesource.com/45080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 17:23:48 +00:00
Brian Wilkerson 5fd560f96b Add getters to replace ParameterKind
Change-Id: I0886c8d032e963857b8054e894ed3343a235b5c2
Reviewed-on: https://dart-review.googlesource.com/44921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-05 14:22:52 +00:00
Danny Tuppeny 9b1679c52d Don't send modifications for files that should not be analyzed
Bug: https://github.com/dart-lang/sdk/issues/31564
Change-Id: I91b952cf8f47e5c8b8d12ef137cc2ef1575372d3
Reviewed-on: https://dart-review.googlesource.com/44421
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-01 18:00:39 +00:00
Konstantin Shcheglov 3a5be046bb Update FlutterOutline API to provide widgets instrumentation.
So, this is alternative approach - the plan is to instrument in Analysis
Server, then generate the entry point and instrumented code in Flutter
plugin, and run flutter_tester also from the plugin.

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

Change-Id: I6b2bb0fea6494df6b9f6b3e69e7548d03af7e94b
Reviewed-on: https://dart-review.googlesource.com/44382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-28 23:02:53 +00:00
Danny Tuppeny 7ca10a7adf Fix file completion for absolute paths on Windows + related tests
Bug: https://github.com/dart-lang/sdk/issues/32226
Bug: https://github.com/dart-lang/sdk/issues/32277
Change-Id: Ie78423dc4a99efd25976b49ec7642362ed61a3c6
Reviewed-on: https://dart-review.googlesource.com/43961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
2018-02-27 17:20:49 +00:00
Konstantin Shcheglov 75858ec680 Add optional 'parameters' field to ElementDeclaration.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/29510
Change-Id: I6b8e4417e7a7bc32537fdcbaa8fd04caf18da052
Reviewed-on: https://dart-review.googlesource.com/43885
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-27 01:27:37 +00:00
Konstantin Shcheglov 199206a735 Implement support for 'pattern' and 'maxResults' in getEElementDeclarations().
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/29510
Change-Id: I38a53c44016d01e2012b2e20173e0ae07cc658e2
Reviewed-on: https://dart-review.googlesource.com/43883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-26 22:48:20 +00:00
Konstantin Shcheglov 586c183904 Add code range to ElementDeclaration.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/29510
Change-Id: I6e7afe3b8ea8191d737c717b753d55d2a7945a81
Reviewed-on: https://dart-review.googlesource.com/43840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-26 20:37:44 +00:00
Mike Fairhurst 69474f23c2 Fix the 'pub' command in plugins on Windows -- '.bat' required.
Change-Id: Ibcf212902454dd8d9eb442e9633a193163d5bcae
Reviewed-on: https://dart-review.googlesource.com/43620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-02-25 03:33:23 +00:00
Brian Wilkerson 716daa3b0d Add assists to convert between literal string styles
Change-Id: I691ff29d0bdc5a01cef6736f403025d1eee912d0
Reviewed-on: https://dart-review.googlesource.com/43580
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-02-24 21:45:32 +00:00
Konstantin Shcheglov 9567305bd6 Set selection position for Flutter move widget up/down assists.
This requires also changes to Dart plugin for IntelliJ, because currently
we use exit position only when there are linked edits. I attempted to
implement it myself, it mostly works, but there are race condition
complications.

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

Change-Id: Iff1a79ebb0cb7e0eabfe59e45d8dde7559c60a0f
Reviewed-on: https://dart-review.googlesource.com/43600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-24 17:14:30 +00:00
Konstantin Shcheglov 316af55593 Suggest enum constants for imported enums.
So, you can complete `Column(crossAxisAlignment: ^)` and get all of
the CrossAxisAlignment right away for selection. Or you can start
typing `center` and by the time when you typed first letters, you get
several completion suggestions. There are several enums with `center`,
but because we give compatible types higher relevance, the correct
one is always the first.

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

Bug: https://github.com/flutter/flutter-intellij/issues/998
Change-Id: I6c2082668c6b25bf23e070915b5df03081ff0d5c
Reviewed-on: https://dart-review.googlesource.com/43485
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-23 19:26:36 +00:00