Commit Graph

193 Commits

Author SHA1 Message Date
Konstantin Shcheglov f5d991e6a1 Support extracting selected statements into a new Flutter widget.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2283
Change-Id: I778f5b06e0f995026219bee32c4a2253aa6595c5
Reviewed-on: https://dart-review.googlesource.com/57704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-31 19:41:26 +00:00
Konstantin Shcheglov 17afa8ef56 Give private parameters public names for constructor.
R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2284
Change-Id: I091c1f557266aa2442ad0fd047ca745996332f4d
Reviewed-on: https://dart-review.googlesource.com/57040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-29 19:34:36 +00:00
Konstantin Shcheglov 89df6b785d Issue 33181. Use RefactoringWorkspace in rename refactoring to determine when element being renamed is outside the workspace.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/33181
Change-Id: I01c9b275579cd961a581491d8cd25893b3bcc094
Reviewed-on: https://dart-review.googlesource.com/56039
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-22 15:28:23 +00:00
Konstantin Shcheglov 9696c9dcd0 Change analysis_server tests to use /project/test.dart as the test file.
Correspondingly all files that were referenced using relative URI(s)
also put into /project, which is the contextRoot for the test
AnalysisDriver.

This will let us (in a following CL) start checking that the element
being renamed is defined inside the current workspace (the set of
analysis roots). Currently the context root is hardcoded as /project.

R=brianwilkerson@google.com

Change-Id: I9dca3509af1be13c9016bf03d4a4b95d71bc9374
Reviewed-on: https://dart-review.googlesource.com/56031
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-22 00:31:22 +00:00
Danny Tuppeny a65dc90bd0 Improve error message for invalid characters
The order of checks has been swapped so invlaid characters (which give a more specific message) are returned over those for first letters.

Bug: https://github.com/dart-lang/sdk/issues/32678
Change-Id: I784191ea7a0e072cc8994bbb47b03421e33aa90e
Reviewed-on: https://dart-review.googlesource.com/54244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Danny Tuppeny <dantup@google.com>
2018-05-09 09:56:42 +00:00
Konstantin Shcheglov 179b31c157 Allow built-in identifiers for non-type entities, with a warning.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32893
Change-Id: I0d3d25b24d68e9cf30bfd69e6818aaa2a24b6f90
Reviewed-on: https://dart-review.googlesource.com/54100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-07 23:22:53 +00:00
Konstantin Shcheglov f62302b8ee Make extracted widgets follow Flutter style - const constructor and @required named parameters.
R=brianwilkerson@google.com, pquitslund@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2166
Change-Id: I28f548c8e814ac5b9585dd46fbb9a8f84f70f418
Reviewed-on: https://dart-review.googlesource.com/54066
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-07 20:59:04 +00:00
Konstantin Shcheglov f6a1f48450 Allow using pseudo keywords for names in refactorings.
The specification does not diallow them (actually does not say anything
at all).

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

Bug: https://github.com/dart-lang/sdk/issues/32893
Change-Id: I963b01aaf123bbf51d74dfcad6daf82cdb911bea
Reviewed-on: https://dart-review.googlesource.com/53841
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-04 23:23:16 +00:00
Konstantin Shcheglov b7d8ae30e2 Change 'Extract Widget' to generate named constructor parameters, with 'key'.
R=devoncarew@google.com, paulberry@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2166
Change-Id: Ie698dc27a1328b7e18e92f46583f84c22c84de57
Reviewed-on: https://dart-review.googlesource.com/53060
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-04-30 16:49:00 +00:00
Konstantin Shcheglov 8d1a0749b9 Create parameters only for unique referenced elements.
R=brianwilkerson@google.com

Change-Id: I1aad38c68454016846601b861432695eb6632242
Reviewed-on: https://dart-review.googlesource.com/48444
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-26 19:17:18 +00:00
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 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 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
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 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
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
Danny Tuppeny e7d57c8535 Fix RenameClassMemberTest on Windows
Bug: https://github.com/dart-lang/sdk/issues/32226
Change-Id: I57804f6c168cccdbfee62f8fa6b60b40f260015b
Reviewed-on: https://dart-review.googlesource.com/42946
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-22 16:17:33 +00:00
Danny Tuppeny 04830ac262 Fix RenameUnitMemberTest on Windows
Bug: https://github.com/dart-lang/sdk/issues/32226
Change-Id: I98f2c5025615adf52919ea87d637a47ee50fe760
Reviewed-on: https://dart-review.googlesource.com/42942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-22 16:11:53 +00:00
Danny Tuppeny d66e6b1c6e Fix refactoring tests on Windows
This hand-built JSON fails on Windows because the paths being inserted
only have a single slash ("C:\test.dart") but in the real results the
JSON is encoded correctly and hhas two paths.

This works around the issue by JSON-encoding the filename but really the
whole object should be serialised to JSON properly.

Bug: https://github.com/dart-lang/sdk/issues/32226
Change-Id: I8aa418e8e3e6377ed01fe3bbecc3242f3a012629
Reviewed-on: https://dart-review.googlesource.com/42742
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-21 18:49:12 +00:00
Danny Tuppeny 40e3f9addc Convert paths for mock SDK libraries to fix tests on Windows
The other lines on this method are calling `provider.convertPath` around their paths but these ones do not, which is causing almost all analysis server tests to fail on Windows (for me - I can't explain them not
failing builds). This causes the hard-coded paths like `/lib/core/core.dart` to be fixed up to `C:\lib\core\core.dart` which is what the server is looking for (because at the other end the paths *have* been fixed up).

See #32226.

Closes #32230
https://github.com/dart-lang/sdk/pull/32230

GitOrigin-RevId: 1adeee23f8ac8efc8acf61caf5f769e4ec44c030
Change-Id: Id9bf195967db0912c6f4b67bd79d504e627b8aab
Reviewed-on: https://dart-review.googlesource.com/42300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-02-20 18:55:38 +00:00
Konstantin Shcheglov 425e07d721 If selection in 'Extract Method' does not cover any node, extract the smallest covering expression.
Two comments.

1. We need also to change the Dart plugin for IntelliJ to not select
   the whole line when selection if empty. The whole line is almost
   never a good choice for Flutter.

2. This is not fully consistent with "Extract Lolal" where we give the
   client the list of possible expressions to extract and the user can
   then choose. Here we use just the smallest one. If we want to make
   it consistent, we will need to enchance the protocol and the plugin.

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

Change-Id: I87a752234d9c825d78a6d787d2b21d1b252166c2
Reviewed-on: https://dart-review.googlesource.com/41520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-14 20:43:13 +00:00
Konstantin Shcheglov c16575c1f2 Issue 30884. Index MethodInvocation type arguments.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/30884
Change-Id: I0597d56d72fbff804ecf1a2f435815d02678eba6
Reviewed-on: https://dart-review.googlesource.com/38784
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-05 19:34:46 +00:00
Brian Wilkerson c492dc1084 Add a test for issue 30884
Change-Id: I79c999965aa4dcdc49b94ea09f7863e75f2dc07e
Reviewed-on: https://dart-review.googlesource.com/38484
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-02-05 17:12:27 +00:00
Konstantin Shcheglov b0e5ff1a76 Add a test for a field rename that potentially conflicts with a parameter with null visible range.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/31497
Change-Id: I8293612a3dde1f794e871cf7b5a9384db3574c91
Reviewed-on: https://dart-review.googlesource.com/38100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-01 18:47:38 +00:00
Brian Wilkerson 8e7781ea9e Convert remaining tests to use ResourceProviderMixin
Change-Id: I7bd0941a415737bd3c9c55e9650f2a982937f777
Reviewed-on: https://dart-review.googlesource.com/31961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-02 16:33:14 +00:00
Konstantin Shcheglov e925eb125c Fix type code for typedefs after switching to GenericTypeAliasElement.
https://dart-review.googlesource.com/c/sdk/+/9421

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

Bug:
Change-Id: I25d60ff904f15e6eeefff97b08ba9870d69733db
Reviewed-on: https://dart-review.googlesource.com/9460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-09-29 04:27:53 +00:00
Konstantin Shcheglov d4dec4e1a4 Create GenericTypeAliasElement for both FunctionTypeAlias and GenericTypeAlias nodes.
Some pain points are:

1. It is a breaking change. I think I will break it even more by removing
   FunctionTypeAliasElement altogether.

2. We lose ability to keep track that this FunctionType is instantiation
   of a typedef. Just like in Kernel.

3. We sometimes have to look up to see if the GenericFunctionTypeElement
   is a function in a named GenericTypeAliasElement.

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

Bug:
Change-Id: Ib250cc446a0ed5b8969f16f7cc6293ef4acf01a8
Reviewed-on: https://dart-review.googlesource.com/9421
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-09-29 00:39:05 +00:00
Konstantin Shcheglov 90121b528a Remove the 'Move File' refactoring.
It has been broken since we switched to Analysis Driver.
Given that IDEA does not use it, there is little incentive to fix it.

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

Review-Url: https://codereview.chromium.org/2983783003 .
2017-07-18 17:59:20 -07:00
Konstantin Shcheglov 00d5012906 Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt.
...instead of mixing formatting with actual changes in many CLs.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2975253002 .
2017-07-13 16:28:18 -07:00
Konstantin Shcheglov a673395664 Don't depend on visiting local functions.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2970403002 .
2017-07-07 13:01:23 -07:00
Brian Wilkerson 62f43f663b Fix a bug in inline method refactoring
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2973673002 .
2017-07-05 09:35:48 -07:00
Konstantin Shcheglov 238894eb76 Stop using ExecutableElement.localVariables in RenameClassMemberRefactoringImpl.
This is the only / last usage in Analysis Server.
And this change fixes 3 failing tests.

R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2961363003 .
2017-06-30 11:58:15 -07:00
Konstantin Shcheglov 911263f240 Remove the old index.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2963773003 .
2017-06-28 13:44:05 -07:00
Brian Wilkerson 53e01faa43 Remove unused implementation of SearchEngine and rename the driver-based implementation
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2949823002 .
2017-06-21 09:33:51 -07:00
Brian Wilkerson 4337a3aeee Cleanup some unused code in some of the tests
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2942433002 .
2017-06-13 14:01:17 -07:00
Brian Wilkerson 4da8380881 Convert more tests to use the new driver
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2939803002 .
2017-06-13 12:04:25 -07:00
Brian Wilkerson 1e9ae646ff Clean up some hints
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2939723002 .
2017-06-13 09:24:50 -07:00
Brian Wilkerson 65d05524ce Remove some unnecessary tests for non-driver mode
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2935733003 .
2017-06-12 11:31:09 -07:00
Konstantin Shcheglov 9737664106 [Extract Method] When no selection, check for implicitly selected closure.
R=brianwilkerson@google.com, devoncarew@google.com
BUG=

Review-Url: https://codereview.chromium.org/2907213002 .
2017-05-30 11:11:46 -07:00
Konstantin Shcheglov ab9ee72a34 Switch server tests to strong mode.
R=brianwilkerson@google.com
BUG=

Review-Url: https://codereview.chromium.org/2903523003 .
2017-05-23 14:58:53 -07:00
Brian Wilkerson 7d26ff6d4f Remove some more library directives
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2884233004 .
2017-05-17 08:02:08 -07:00
Brian Wilkerson fb982f5476 Make server use the common protocol classes
R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2879273002 .
2017-05-15 09:35:46 -07:00
Brian Wilkerson 6b8a56cd7f Switch the default from non-driver to driver in several tests
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2864813002 .
2017-05-07 08:34:16 -07:00
Brian Wilkerson 863bd921e1 Remove the non-driver versions of several tests
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2863593004 .
2017-05-05 13:46:03 -07:00
Brian Wilkerson e55812a3f2 Unify the server and plugin versions of the generators
R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2844273003 .
2017-04-28 07:46:29 -07:00
Dan Rubel 99aefce48c do not allow built-in keywords to specified when refactoring
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2802433002 .
2017-04-04 17:13:42 -04:00