Commit Graph

55 Commits

Author SHA1 Message Date
Ilya Yanok d1717197ec Revert "analyzer: Remove unnecessary FixContributor and DartFixContributor classes"
This reverts commit c69f4321e6.

Reason for revert: `DartFixContributor` is used by Dart LSC tool, see b/318016861

Original change's description:
> analyzer: Remove unnecessary FixContributor and DartFixContributor classes
>
> I'm not sure what purpose they used to have or why they
> "are long-lived". But today they only serve as unnecessary object
> allocations.
>
> Change-Id: Icf73ddd42f540ae956dfeeb676de2f04bfca39d5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343240
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>

Change-Id: Ic71e337399e263b899b0ffcbe388986d6011f6f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344000
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-12-29 09:47:08 +00:00
Sam Rawlins c69f4321e6 analyzer: Remove unnecessary FixContributor and DartFixContributor classes
I'm not sure what purpose they used to have or why they
"are long-lived". But today they only serve as unnecessary object
allocations.

Change-Id: Icf73ddd42f540ae956dfeeb676de2f04bfca39d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/343240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-12-27 23:48:32 +00:00
Danny Tuppeny 6229694c74 [analysis_server] Don't remove unused parameters when running fix-all-on-save
Fixes https://github.com/Dart-Code/Dart-Code/issues/4655

Change-Id: I09269766124f7b77fde7c499c6f69a09989d1766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317684
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-09 15:49:06 +00:00
Josh Soref ba15a61271 Spelling build
Closes https://github.com/dart-lang/sdk/pull/50859

GitOrigin-RevId: 7b056018c2925745701bdecdd7da325d9458204d
Change-Id: Iff037d773713bf73efde6951599becfd7297b921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277740
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-23 08:56:14 +00:00
Brian Wilkerson e0820bb508 Enable the prefer_function_declarations_over_variables lint in the analysis server
Change-Id: I53a6cd3c5d3be1c66173f52a7f01d8df63fd9350
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249727
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-06-27 18:27:23 +00:00
Konstantin Shcheglov 30ea5d1167 Return variable to either getter or setter.
Change-Id: I412b1747f95505c37812a4f72f5f1e0fe6fff81f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-13 16:29:53 +00:00
Konstantin Shcheglov 979f3ea79e Use LibraryElement(s) to find extensions for 'Import Library' quick fix.
So, we don't need ExtensionCache anymore.

This fixes the issue with importing a library from lib/src sometimes.

Bug: https://github.com/dart-lang/sdk/issues/47842
Change-Id: I9a28fb2e1e14ab96a58c3ef72daa87562f1bccd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223441
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-12 17:39:22 +00:00
Konstantin Shcheglov e0752585f2 Use available files and element models for 'Import Library' quick fix.
We still use `ExtensionCache` to fix members.
I will try to change this next.

Change-Id: I047250b0fc9187673fcc88e80b1d40fc421db475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222542
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-12-10 20:35:40 +00:00
Danny Tuppeny 00ca3283c0 [analysis_server] Correct sorting of fixes, inverting priorities to maintain order
Fixes https://github.com/Dart-Code/Dart-Code/issues/3646.

Change-Id: I9784bbda8aa62d3506810fc7768d58a4cd2bf064
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219706
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-08 19:55:02 +00:00
Brian Wilkerson 25b71e07e7 Add a quick fix to import extensions when members are referenced
Change-Id: Ic7f85cecdc06e255264441db7add6bd4a9bda5d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-01 23:28:25 +00:00
Konstantin Shcheglov 4757152a0b Migrate a few random analysis_server libraries.
Mostly no-ops.

Change-Id: Ia538aed657576203ec104bd849862bcc87025bef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-04-05 16:06:36 +00:00
Brian Wilkerson 34873853d8 Migrate some of the plugin support in server
Change-Id: I1294a33725ff0d0c3d2eb981c23211a8576f60f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194023
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-04 00:23:39 +00:00
Konstantin Shcheglov e97f1bdbf0 Switch analysis_server to language 2.12, so null safety, but opt-out files.
This should allow doing partial migration, specifically protocol files,
which are imported by other libraries, but are a small library cycle
that does not import much outside of it.

Change-Id: I904c05d6d5b444ee9a9dbd1f7ada12aabdcc5165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-30 23:39:37 +00:00
pq 94f6b6ec94 migrate multi-fixes to unique fix kinds
Change-Id: If28b89ebeab3be8120cb9189d7c54eb1393beb6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186741
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-02-25 00:24:35 +00:00
Brian Wilkerson 87cb3ede9e Report conflicting edit exceptions
Change-Id: I2b76b79a7b741c0d587fd24f8eaa30f1f0f8c657
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171285
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-10 18:22:04 +00:00
Mike Fairhurst 1134a0f17c [analysis_server] Remove unused dart:async imports
Change-Id: I764ee78cb9e31bdb3abaa36ca4754e1fed180311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161447
Auto-Submit: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-09-02 17:29:52 +00:00
Brian Wilkerson f60536c194 Enable slash_for_doc_comments in analysis_server
Change-Id: Id2734d4c9ce591c5746bb9aa55810c78183db38f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-02-14 17:17:17 +00:00
Konstantin Shcheglov 6a4d805df4 Implement 'Import Library' quick fix using DeclarationsTracker.
This reverts commit 143e5ef556.

Change-Id: I3c575ff690fd8c8d93a90e50a451a6ec993c4164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111305
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-07-31 22:14:21 +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
Konstantin Shcheglov a332c414f1 Switch server to using DeclarationsTracker for 'Import Library' quick fixes.
We need this to stop using UnlinkedUnit with summary2.

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

Change-Id: Iaca2f19e6a168818e171f09e6eeda71a75854232
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-05-29 16:45:32 +00:00
Brian Wilkerson 47e988b781 Clean up the remaining copyright notices in analysis_server
Change-Id: Iee3110f92ab0f24312ddd1eff407d2229f895321
Reviewed-on: https://dart-review.googlesource.com/c/89101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2019-01-11 15:38:56 +00:00
Konstantin Shcheglov c91a245e30 Use ChangeWorkspace to limit where DartChangeBuilder(s) can edit.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/35402
Change-Id: If5f78b44b69f01d9ddc235401f70cc4aefd3ca37
Reviewed-on: https://dart-review.googlesource.com/c/87382
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-14 22:32:35 +00:00
Brian Wilkerson 298d22f4ab remove async parse method
Change-Id: I7a2e633b43283221790fb88a12065fed3dcdabb7
Reviewed-on: https://dart-review.googlesource.com/c/82120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 19:26:00 +00:00
Konstantin Shcheglov 5b1641432d Create CorrectionUtils only for ResolveResult.
So, it is always self-consistent, never ask AnalysisContext for the
unit file content.

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

Change-Id: I93e71f7f8fa577b8e123c91252f3038a50cdccef
Reviewed-on: https://dart-review.googlesource.com/c/81580
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 14:04:12 +00:00
Konstantin Shcheglov 20d81452e5 Remove AstProvider, use AnalysisSessionHelper.
This is a step toward making CorrectionUtils constructor accept full
ResolveResult, instead of partial (and potentially inconsistent) unit
and AnalysisContext.

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

Change-Id: Ic386d48af2d00ecaf9ef13b8480e7e78c7d52efc
Reviewed-on: https://dart-review.googlesource.com/c/81382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-25 19:09:11 +00:00
Brian Wilkerson b35e717fae Clean up the fix processor hierarchy
Change-Id: I2ca593397f061aa1cb0d91c98874451c8f53a206
Reviewed-on: https://dart-review.googlesource.com/c/80841
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-19 16:21:23 +00:00
danrubel 5c1a40837e Update analyzer fix sorting by priority
Change-Id: I23dd4c8125c47de9e0c16cde1c43908f18649e6e
Reviewed-on: https://dart-review.googlesource.com/c/79601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-17 02:16:02 +00:00
Brian Wilkerson ce8a5ffab2 Remove remaining definitions of EMPTY_LIST in server
Change-Id: Ia7a9286f2fc7e151f99091169635b71fde88649a
Reviewed-on: https://dart-review.googlesource.com/77421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-01 15:42:55 +00:00
Brian Wilkerson f6d2c2378a Add awaits in async methods to restore previous semantics
Change-Id: I7711cd878a31df0fb0c92572e2256c0a26923640
Reviewed-on: https://dart-review.googlesource.com/59480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-06-08 19:58:07 +00:00
Jaime Wren ca7d545df8 Follow up on initial fix-all fixes PR, https://dart-review.googlesource.com/c/sdk/+/56220, adding some assertions and a test.
Change-Id: I6e22f8537f616ce2d09247f90bb81fff17eb1b66
Reviewed-on: https://dart-review.googlesource.com/56601
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-24 22:29:45 +00:00
Jaime Wren 351d70674d Initial new union of Dart Analysis Fixes, the initial fix is to remove all unused imports in a file.
Change-Id: I259e796b2603234955a1950b2c886e6f08a697bc
Reviewed-on: https://dart-review.googlesource.com/56220
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-24 15:23:40 +00:00
Brian Wilkerson 9a7168a2bf Clean up dead code in quick assist support
Change-Id: I983c78a9ad131e5ae35a83abf2f455608b3ae835
Reviewed-on: https://dart-review.googlesource.com/52060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-20 14:23:29 +00:00
Konstantin Shcheglov 2cd992663e Sort assists and fixes by relevance and then by name.
We used to get away with sorting just by relevance because the order
of assists and fixes was correct. I think it is time to switch to
sorting. I still would like to keep 'Surround with XXX' ordered in
a specific way, so I'm changing relevance for these assists.

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

Change-Id: I77f77ec732d70b31c32164759a3ac62dc790e469
Reviewed-on: https://dart-review.googlesource.com/40880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-02-13 18:18:59 +00:00
Brian Wilkerson b941f148a7 Remove uses of the old plugin model from the analysis server
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/3001413002 .
2017-08-23 07:42:13 -07:00
Brian Wilkerson 7bd9e6c443 Add a mixin for assists similar to that for fixes
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2956353002 .
2017-06-28 11:44:22 -07:00
Brian Wilkerson 6248e7cab2 Add support code to make fixes easier in plugins
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2962903002 .
2017-06-28 10:52:06 -07:00
Brian Wilkerson 0929b7736e Convert quick assist support to use AnalysisDriver
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2899843002 .
2017-05-22 13:45:55 -07:00
Brian Wilkerson 7e47a24c8a Convert quick fix support to use AnalysisDriver
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894403003 .
2017-05-22 10:41:57 -07:00
Brian Wilkerson a6214b3129 Remove more libraries directives from server
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894883002 .
2017-05-19 08:42:30 -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 d2bbfb4f77 Make an AstProvider available to AssistProcessors
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2862143003 .
2017-05-05 09:24:30 -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
Konstantin Shcheglov f600f5f9de Stop using Element.computeNode() in refactorings and fixes.
R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2669353002 .
2017-02-02 17:24:31 -08:00
Konstantin Shcheglov 57c3002ede Implement 'Import Library' Quick Fix for project libraries using TopLevelDeclarationInSource.
Only the current implementation is done.

Implementation for the new analysis driver is not linked yet.

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

Review URL: https://codereview.chromium.org/2554113003 .
2016-12-06 14:24:22 -08:00
Brian Wilkerson ecc84b26a4 Break up another large file
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2342733002 .
2016-09-15 07:49:27 -07:00
Brian Wilkerson 8c22a5f807 Format code in analysis_server
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1838933003 .
2016-03-29 08:27:14 -07:00
Brian Wilkerson 7d72c6e1f5 Deprecate the generated AST library and clean up imports
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1788223002 .
2016-03-12 08:50:48 -08:00
Konstantin Shcheglov 1c5e2fd0fb Use getResolvedCompilationUnit2() instead of resolveCompilationUnit2() in QuickAssist and QuickFix contributors.
R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org/1582613010 .
2016-01-15 12:15:45 -08:00
Brian Wilkerson 86216e5154 Consistently use implements when one interface inherits from another interface
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1481273002 .
2015-11-30 07:58:10 -08:00
Brian Wilkerson 0a64b0694c Make change builder provisional API
R=scheglov@google.com

Review URL: https://codereview.chromium.org/1468133002 .
2015-11-23 10:18:58 -08:00