Commit Graph

2966 Commits

Author SHA1 Message Date
Brian Wilkerson 22408c6dee Remove references to previewDart2
Change-Id: Id382dd95d3ae90d483467741b5b6d3dbc6c31ea1
Reviewed-on: https://dart-review.googlesource.com/c/83300
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-07 14:52:37 +00:00
danrubel 7e6a39fd91 Generate analysis server notification handler
... and generate the analysis server protocol version

Change-Id: I585e50cc854d5ae1aa7440a14f856c983bbfc93a
Reviewed-on: https://dart-review.googlesource.com/c/83180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-06 23:04:53 +00:00
Paul Berry 2aa4b1a4f4 Convert analysis_server.dart to triple-slash comment style.
Change-Id: I49ca2b705ad0b59d9a01615b6426fc76db99f77b
Reviewed-on: https://dart-review.googlesource.com/c/82948
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-06 15:07:13 +00:00
Paul Berry 85d225e3f6 Move parameter context into NodeLintRule and make it required.
This is a breaking change, so the analyzer major version number is
bumped.  However, we don't need to publish a new analyzer yet so we
use a "-dev" version number.

This breaking change requires upgrading to the latest version of the
linter package.

Change-Id: I90637068acee646c41613e7b7f7d66496bb260e9
Reviewed-on: https://dart-review.googlesource.com/c/82946
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-05 23:32:47 +00:00
Konstantin Shcheglov 3166d6bf25 Replace ResolvedUnitCache with AnalysisSessionHelper.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: Ie19de8feaf82e97065d1068d0c1a06bdf3654e1d
Reviewed-on: https://dart-review.googlesource.com/c/82940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-05 20:49:44 +00:00
Brian Wilkerson 1215f239c8 Remove references to ContentCache from analysis_server
Change-Id: Ie1e107467f639e9a005c7b16055541d235ac38d8
Reviewed-on: https://dart-review.googlesource.com/c/82921
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-05 18:17:57 +00:00
Paul Berry 40dee8da38 Merge commit '11707cab410906df65b72e94fd59b2f51690c9e7' into analyzer 2018-11-05 10:00:59 -08:00
Dan Rubel 40de40f904 Update edit.dartfix to handle InconsistentAnalysisException
Fix https://github.com/dart-lang/sdk/issues/35055

Change-Id: I20e8bd6400fdd5e26573d2e9273025acfa6b0b88
Reviewed-on: https://dart-review.googlesource.com/c/82882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-05 17:28:02 +00:00
Dan Rubel c7e6cdf81c Update RemoveTypeArguments priority for edit.dartfix
Change-Id: I2b3b52916a4eb08a47f40e1adc2ce21985649ba3
Reviewed-on: https://dart-review.googlesource.com/c/82880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-05 16:31:10 +00:00
Brian Wilkerson dff53c12d0 Remove more uses of package:analyzer/analyzer.dart
Change-Id: I4b8abf72994d7a60b09529a740bd16b591813807
Reviewed-on: https://dart-review.googlesource.com/c/82800
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-11-04 19:36:36 +00:00
Konstantin Shcheglov 3f431de188 Implement AnalysisSessionHelper.getElementDeclaration() using AnalysisSession.
Also adds parsedUnit / resolvedUnit to ElementDeclarationResult, because
Analysis Server use case shows that we need them.

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

Change-Id: I845e85f658bec8fdaf3378f879e3d986a0bc01eb
Reviewed-on: https://dart-review.googlesource.com/c/82712
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-02 22:52:49 +00:00
Konstantin Shcheglov 2784473939 Fixes and tests for quick fixes in mixins.
I hit an exception in Analysis Server, so looked at it and related places.

R=brianwilkerson@google.com

Change-Id: Ife9bac50f8ea16aa0a092de0fdbc74c0c1534b23
Reviewed-on: https://dart-review.googlesource.com/c/82700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 18:56:49 +00:00
Paul Berry 73a58c81d4 Merge commit '31d0896a8b8c7d2a8c0496c9d8d817356ef897ad' into analyzer 2018-11-02 10:44:56 -07:00
Paul Berry 31d0896a8b Introduce API so that the linter can be migrated away from Element.context.
The API change requires adding a "context" parameter to
NodeLintRule.registerNodeProcessors.  If we did this naively it would
be a breaking change since the existing linter code overrides this
method with an implementation that doesn't accept such a parameter.
So to avoid making this a breaking change, we introduce a new
interface NodeLintRuleWithContext that extends NodeLintRule, and adds
the context to the registerNodeProcessors method as an optional
parameter.  The analyzer will only pass in the new parameter if the
lint rule implements the new interface; otherwise it will call the
method in the old way.  This will allow the linter to be migrated to
use the new API at its pace.

The next breaking change version of the analyzer will change both
NodeLintRule and NodeLintRuleWithContext so that the context parameter
is required, and will pass in a context unconditionally.  At a later
date, after the linter has been fully migrated to the new analyzer
version, we will be able to switch back to NodeLintRule and deprecate
NodeLintRuleWithContext.

Change-Id: I75ada0e94e26f831d6f2cb82cddfa706100eb185
Reviewed-on: https://dart-review.googlesource.com/c/82522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-11-02 14:22:12 +00:00
Konstantin Shcheglov e3c8774543 Add AnalysisSession.analysisContext, stop using AnalysisDriver's AnalysisResult outside the driver.
Change-Id: I63138e002d9e777f51d2d843f7ef2b1f32fed3e0
Reviewed-on: https://dart-review.googlesource.com/c/82529
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-02 14:16:31 +00:00
Paul Berry a4c73e3739 Merge commit '5226b5c307b04da8df96924a46780eb31a5bd75e' into analyzer 2018-11-02 06:06:20 -07:00
Konstantin Shcheglov 1fb58ad61b Fix CONVERT_DOCUMENTATION_INTO_LINE when there is an empty line.
R=brianwilkerson@google.com

Change-Id: Ib5c103426bf5ebb84945816c01e9f5bbcef941ba
Reviewed-on: https://dart-review.googlesource.com/c/82472
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-01 20:25:29 +00:00
Dan Rubel 8c20adffe6 Increment analysis server protocol version
Change-Id: I470a51b035c765d710e920f3fe77dfa11a7aca92
Reviewed-on: https://dart-review.googlesource.com/c/82480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-01 19:17:04 +00:00
Danny Tuppeny d802c7d33d Improve LSP server tests
Change-Id: Ib9c7cd2966c6cf4d0c02e56ec405761f899e6668
Reviewed-on: https://dart-review.googlesource.com/c/82441
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-01 17:08:16 +00:00
Konstantin Shcheglov d6d312cca6 Add 'Wrap with StreamBuilder' quick assist.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I109bfe41344943b6d1b456cb178f1db4d5e92858
Reviewed-on: https://dart-review.googlesource.com/c/82341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-11-01 15:33:04 +00:00
Danny Tuppeny 8852d36315 Add --lsp flag to analysis server and add basic Initialize handler
Change-Id: Iaf6c2a7cd56dea27233c4be1df2da900653e1822
Reviewed-on: https://dart-review.googlesource.com/c/81275
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 20:00:51 +00:00
Brian Wilkerson dee5e8a070 Convert more classes to mixins
Change-Id: I85bee426236a510305fc38a49b2f9348af7698df
Reviewed-on: https://dart-review.googlesource.com/c/82181
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 13:49:51 +00:00
Konstantin Shcheglov 87ee9c2c7d Don't generate library directive in CREATE_FILE.
R=brianwilkerson@google.com

Change-Id: Ia2853119ac119cfeff4c72f2528ebe6bc51745e4
Reviewed-on: https://dart-review.googlesource.com/c/82161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-30 22:01:44 +00:00
Brian Wilkerson 56861d5c98 Additional cleanup following session api change
Change-Id: I838c840ca001231890ea6fd3591de446f24c3d1d
Reviewed-on: https://dart-review.googlesource.com/c/82160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 20:16:15 +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 1c6774ba34 Create AnalysisDriver in AbstractContextTest using the new API.
Change-Id: Ia3b8e0fa297026f8d002cf4b29f179e686876d8c
Reviewed-on: https://dart-review.googlesource.com/c/81980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-30 15:57:59 +00:00
Paul Berry 03df087c60 Merge commit '1215d9163af58229132e4776a89ea87d5302c9e3' into analyzer
Conflicts:
	pkg/analysis_server/lib/src/edit/edit_dartfix.dart
	pkg/analysis_server/lib/src/services/correction/assist_internal.dart
2018-10-29 08:48:27 -07:00
Brian Wilkerson 57c185c89d Remove remaining uses of Element.context from server
Change-Id: Ibc383064951e181fa8e951714904526c2ea42f5f
Reviewed-on: https://dart-review.googlesource.com/c/81749
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-29 14:56:24 +00:00
danrubel 0fe448a996 Revise the analysis server edit.dartfix protocol
This updates the edit.dartfix protocol to separate location from the text
describing the changes so that the dartfix client can choose
what location information to display and how it should be displayed.

Change-Id: Ic56a4cb187538571d60136d6de9265d879fccb53
Reviewed-on: https://dart-review.googlesource.com/c/81780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-29 01:50:27 +00:00
Konstantin Shcheglov 142641e596 Stop using AnalysisContext.getContents() in SelectionAnalyzer.
R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I3464c88febba778b368061470b5aa80c3037e897
Reviewed-on: https://dart-review.googlesource.com/c/81660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 21:49:06 +00:00
Devon Carew d53b034a64 Fix several analysis lints.
Change-Id: If7921d5cfc3dd2af79699f9905d7f3b106254cd0
Reviewed-on: https://dart-review.googlesource.com/c/81722
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-10-26 21:41:35 +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
Brian Wilkerson 2fa00fd876 Remove the return type for Starter.start
Change-Id: Id60098a49f0eebeca7a43d99603e590e81d54682
Reviewed-on: https://dart-review.googlesource.com/c/81480
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2018-10-25 21:32:14 +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
Konstantin Shcheglov c689578779 Switch AnalysisDriver to RestrictedAnalysisContext.
It has two methods that should not be there: getContents() and
parseCompilationUnit().  Removing them will require more work on
Analysis Server.  But at this CL shows that we don't do any resolution
or element access through AnalysisContext in analysis_server or analyzer_cli.

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

Change-Id: Ib1625a0f590ebce55153dd0b29984f9b6d51792b
Reviewed-on: https://dart-review.googlesource.com/c/81329
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-10-24 21:31:56 +00:00
Paul Berry 2e2c360371 Merge commit '0b15595913ff89d8486e6677af0254dd6feab350' into analyzer 2018-10-24 06:09:47 -07:00
Dan Rubel 4695b5f138 Add "convert to int literal" to dartfix
This updates the analysis server edit.dartfix request
to find and convert double literals to int literals.
Under the covers it uses the prefer_int_literal lint
and gracefully degrades if the lint is not found
(e.g. third_party/linter needs to be rolled).

Change-Id: I0236af9c19667e543541fef18836bfeeba8c67d7
Reviewed-on: https://dart-review.googlesource.com/c/81302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 01:22:02 +00:00
Dan Rubel 4f2a4e69a8 new convert-to-int-literal assist
Change-Id: I25f08d82fd4afaba485059e558536b37855bb6c9
Reviewed-on: https://dart-review.googlesource.com/c/81301
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-23 20:29:27 +00:00
Paul Berry 5665636983 Merge commit '7fd78ed5b606e64d30ec201de9adce6fdf8856ba' into analyzer 2018-10-22 13:07:24 -07:00
Brian Wilkerson 67b9f2ec8d Deprecate Element.unit and Element.computeNode
Change-Id: Id2a70b4a194cba28bfdc0990d7306d6561f422db
Reviewed-on: https://dart-review.googlesource.com/c/81060
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 16:50:43 +00:00
Brian Wilkerson a342cecffd Disable support for the old super mixins
Change-Id: I8f8074b67ea43249fcc10deddd2325938996d529
Reviewed-on: https://dart-review.googlesource.com/c/79469
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 16:02:01 +00:00
Konstantin Shcheglov c44fa48f8f Extract and rewrite MethodInvocation resolution.
This is a copy of https://dart-review.googlesource.com/c/sdk/+/78182,
but now in the analyzer branch.

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

Change-Id: I75d17a351ee7a33c164d560009cf3ffd088d956a
Reviewed-on: https://dart-review.googlesource.com/c/80942
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-22 03:36:30 +00:00
Konstantin Shcheglov 02651515eb Fix identifyWidgetExpression() for Flutter.
Probably a bit pessimistic approach, allow only cases that we know
to be valid and useful.

R=brianwilkerson@google.com

Bug: https://github.com/flutter/flutter-intellij/issues/2714
Change-Id: I8835c03d919c1f00a986ff3ef677c7f69995682f
Reviewed-on: https://dart-review.googlesource.com/c/80985
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-21 21:12:13 +00:00
Konstantin Shcheglov 7c80d22878 Make indexing in AnalysisDriver optional.
This makes my Flutter benchmark about 6% faster.

It will not affect performance of `flutter analyze`, because for now
Analysis Server always enables indexing and search. But we could make
this optional, for DAS clients that need only errors, but not search,
refactorings, etc.

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

Change-Id: I4eafc37592a3bb18bd2c6ab84dc2515a4d42697b
Reviewed-on: https://dart-review.googlesource.com/c/80880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-10-21 20:20:05 +00:00
Brian Wilkerson 4e36069271 Add fixes for missing implementation of a superclass constraint
Change-Id: I5ea1e961dbb98c034131c15d1945f21bcfa0df1d
Reviewed-on: https://dart-review.googlesource.com/c/80980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-21 15:03:16 +00:00
Brian Wilkerson 20c75ccfb1 Remove more dead code from server
Change-Id: I20689dc5fefd3a636f78b38929a886ea96d01e0f
Reviewed-on: https://dart-review.googlesource.com/c/80961
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-20 00:30:51 +00:00
Paul Berry fe5467092a Merge commit '7a3762d4a91aed0b3885259b297953d0c38ce849' into analyzer 2018-10-19 10:00:38 -07:00
Brian Wilkerson 961484aa05 Remove an unused field from AnalysisServer
Change-Id: I7b7724db25451f3c64bdb299a43c8d475b8c28c7
Reviewed-on: https://dart-review.googlesource.com/c/80840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-10-19 16:55:38 +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
Danny Tuppeny a502061c11 Add test and implementation for package: uris
Change-Id: Ibf114d83cade42ced7601befafec8a7e7c9f4bc7
Reviewed-on: https://dart-review.googlesource.com/c/78985
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-19 10:41:48 +00:00