This introduces the new API. When we're happy with this I'll mark the
old APIs as deprecated and fix up the nearly 900 places impacted by the
change.
Change-Id: Ie88e354d9111339dc79448139bd64246cf06e0c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This doesn't significantly improve the overall scores, but it does cause
the element kind to be used for available declarations, which means that
constructors are suggested before classes.
Change-Id: I75e7bb13bd867b9209a43c4d737c5079c42eb25a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154080
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
local_declaration_visitor.dart was updated to better implement ConstructorDeclarations
This adds the API of _recordCompletionElement() and _elementAlreadyInCompletionSet() to local_reference_contributor.dart, if this API looks good and lands, I will use it in the rest of the contributor to fix other known shadowing bugs.
local_constructor_contributor_test.dart was removed (a large copied & pasted body of tests not providing value) and tests were added at the beginning of local_reference_contributor_test.dart. Tests in this file were also updated accordingly.
The change of the testCommentSnippets025 test in completion_test.dart is due to the framework not supporting (in a more robust way) the allowance of both a class and an implicit constructor
The addition of the testCommentSnippets045 test in completion_test.dart is to show that constructor invocations don't need the new keyword.
Change-Id: Ic4a52e3cb94320a92f24b1c743dd61e18c6c7b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150165
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
and the available declarations support.
The resulting metrics are lower than I'd like them to be, but I suspect
that this will be a reasonable first step toward the final solution.
Change-Id: Ib5d471a9d3c0dafcb2b3687e25b9af21da97854a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit a2c3ecabce.
Reason for revert: Breaking change to de facto API
Original change's description:
> Remove DartSdk.useSummary.
>
> R=brianwilkerson@google.com
>
> Change-Id: Ifa851f4af47a973d65c528c6d07fcac0a515134b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149495
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
TBR=scheglov@google.com,brianwilkerson@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I9998bedb74ea940371f18ac7dce42b2f5dcc3b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149687
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The tests in analyzer_cli and analyzer_plugin imported
analysis_server, resulting in warnings when publishing
analyzer_plugin. combining these tests all into analysis_server
shares more code and avoids the warning.
Change-Id: I519f67872500e93e399c5c3d2aeddf781f07602c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149610
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The previous publish attempt failed because
lib/utilities/navigation/navigation_dart.dart imported from
analysis_server. Bumping the version number to 0.2.4 since the fix
required exposing a new method to the public API.
Note that one import of analysis_server remains, in
test/verify_sorted_test.dart. This is less urgent to fix, since it
doesn't block publishing analyzer_plugin, it just prevents users from
running analyzer_plugin tests based on the files downloaded via pub.
I'll fix this in a follow-up CL.
Change-Id: I8ae9470db3249492b5756b8f9af742e528db004a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149387
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
The way we used to configure it does not work with changed I want to
make, specifically we were given SourceFactory with no resolves,
so no DartUriResolver, so no SDK.
R=brianwilkerson@google.com
Change-Id: Ibf798aae1792366cfbe240f9781038568936146d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149384
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
There was a bug earlier in which we were attempting to use a relevance
table (MethodInvocation_arguments) that was not generated. I thought
the bug was that the table wasn't being generated, so I attempted to
generate the table (in relevance_table_generator). But the table can't
be generated and the real bug was that the wrong contextLocation was
being generated when computing the OpType. So I backed out the earlier
change and updated the generation to generate the right location.
Change-Id: Ifbd2c6c3e11e1e98887108be7eb6d90e90452446
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149381
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The enhancement is that we can now create a const constructor if the
class to be created is being used as an annotation. We could also do
this if the class were being created from a constructor invocation, but
I didn't do that. This also doesn't handle creating a named constructor,
but I don't think it's any worse than before. If you disagree let me
know.
Change-Id: Idcff7bd0ac8def416b141b49b801f6798548405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148885
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The code to check the element kind was not being used in a few places
because (a) the generator wasn't always generating a table when it
should and (b) the key for the table wasn't always being set when
creating the OpType. Both of these issues have been mostly addressed.
That required re-generating the element kind tables.
There were several places where context type information wasn't being
used when building suggestions. This has been fixed for all the places
I'm currently aware of.
There were a couple of places where the context type wasn't being
computed where it could have been. I have fixed the places I'm aware of.
Context types were not being computed anywhere because of a bug that
has now been fixed.
There is now one place that computes and caches the context type, which
should improve performance slightly.
I also removed some dead code that I discovered in the process of making
the other changes and cleaned up a couple of places in the code that
were suboptimal.
Change-Id: Ieae8dcc71b986841be3078d6e0b3a653c35384b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148237
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This will allow it to be used by the nnbd_migration package.
Change-Id: Ia628630cf156af7bbfdbe2e104254cf5a609ae91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144467
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Having IDs to the change allows them to be key-bound in VS Code (see https://github.com/Dart-Code/Dart-Code/issues/2169).
Changing for format is to make them better match the existing IDs for assists (these will need to be pre-loaded into VS Code to allow users to see them to aid keybinding).
Change-Id: Iedcfaaf9a29d5e8575f1b8394e3db0ff19360872
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143588
Commit-Queue: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In addition to implementing the feature, this CL updates one of the
contributors to use the new feature as a way of testing it. I haven't
looked to see whether it impacts the metrics, but I wouldn't expect much
change anyway because of the small number of completions that are likely
to be effected by this change.
It might be interesting to start thinking about ways to measure the
impact of individual features.
Change-Id: Idd0040a774e5fd9a6e3f6c29d0aa7fd762676fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143622
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
The completion location will be used later to help compute relevance
based on the element kind.
Change-Id: I3927bb0137340a81fc90efcbc9c3ecb25ad63542
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143240
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The test test_TopLevelVariableDeclaration_type_after_comment3, fails without the change to optype.dart, the other tests were added simply to have more coverage.
Change-Id: I11512f1a97e72796b6e0656b7555206640e2a8f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142545
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This merges the 3 concrete classes into a single class. We were not
really testing Dart 1 behavior, and the extension methods experiment is
enabled by default.
I also renamed several of the tests to conform more closely to the
convention we use.
I did not alter the bodies of any of the tests, so we're testing exactly
the same things after this CL as before.
In future CLs, as I add more information to OpType (for the new relevance
computations), I plan to subdivide the tests based on the type of the
AST node being tested, which will split up the tests and allow for shorter
test names.
Change-Id: I717c5697817d9f96d050318f2f39da85dff23422
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142203
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
There are 34 instances of this in the package collection.
Change-Id: I43856f0e840ca3f76285948363868927b669caf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142063
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
There was crash:
NoSuchMethodError: The getter 'offset' was called on null.
Receiver: null
Tried calling: offset
at Object.noSuchMethod (dart:core )
at _OpTypeAstVisitor.visitSimpleFormalParameter (optype.dart:976 )
at _OpTypeAstVisitor.visitFormalParameterList (optype.dart:631 )
at FormalParameterListImpl.accept (ast.dart:4479 )
at DartCompletionRequestImpl.opType (completion_manager.dart:435 )
R=brianwilkerson@google.com, pquitslund@google.com
Change-Id: I0b0ef50e925ad48ca293a7a753b332821b503e5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141320
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
I didn't update the generators to generate sorted output, I just
whitelisted those files for now.
Change-Id: Ia1d233ee978691f15bce06b2556aa3371c54183f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141209
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This should have tests, but I (or someone else) need to do some data
mining to figure out the correct relevance values and hence the correct
ordering to test for.
Change-Id: I7782d7b7e13ff38a785c445cd0d6fc82a388a6aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141000
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Once again, test suggestions are welcome.
Change-Id: I470825a0ef51f555977bdc86192cc38bd718519a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140943
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Also updated a comment that I missed from the last CL.
Change-Id: Ibfcce19998532c672b9990308cd7b03fd42d14cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140772
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This also includes a new metric computation showing how often function
typed parameters have closures as arguments.
Change-Id: I8999cc3935bcc7514ebba90a8a4d246b2f236c42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140702
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>