Commit Graph

110 Commits

Author SHA1 Message Date
Konstantin Shcheglov 8828fee865 Deprecate ExecutableElement.returnType, use returnType2 instead.
Change-Id: Ibd29c3fbec0439236c2cf45c57f820c45427df9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311932
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 23:16:59 +00:00
Konstantin Shcheglov fae9e418ea Deprecate Element.enclosingElement, use enclosingElement2 instead.
Change-Id: I78edb6d433949eb8bd86f397fb873a078edf9fc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311827
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-29 19:45:19 +00:00
Konstantin Shcheglov 38546e90ab Pre-fix unreachable_from_main for instance members.
https://github.com/dart-lang/linter/pull/4441

Change-Id: I55afa6b7d78bc1114ce97c1b5bebcf7a8bca5b98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307975
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-09 22:39:27 +00:00
Konstantin Shcheglov 4d6f49b1cd Update ExtensionOverride to use ImportPrefixReference and name token.
Change-Id: Ifc5852c775a95908992d33a7949b4f4bea396d66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-05 15:42:36 +00:00
Konstantin Shcheglov ec330b47de Deprecate 'DartType.isDynamic', use 'is DynamicType' instead.
Change-Id: Ia3660a0d38f01a590dd3e034f40dbdb5a432638a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300042
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-01 16:09:08 +00:00
Konstantin Shcheglov 4756d077ed Update NamedType to use ImportPrefixReference and name token.
Using Identifier expression inside NamedType does not make sense.

Change-Id: I4a61d2b472fd66fb7c5e6e92a80cccb391b06d49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-04-28 17:31:46 +00:00
Konstantin Shcheglov dc34fe9f86 Deprecate IfElement/IfStatement.condition, use 'expression'.
Change-Id: If43b4b71a21fd256ce8d1367d4b233e1cff764b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-19 17:17:28 +00:00
Sam Rawlins 7d6ab9bdfd Allow dead code in completion_metrics script.
Change-Id: I16751bcbb25f09c3a897de82c06ab424abcfcf1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293005
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-04-04 23:15:31 +00:00
Konstantin Shcheglov 5ecf6db857 Deprecate 'DartType.isVoid', use 'is VoidType' instead.
Maybe? With an explicit type check we don't try to make an impression
that anything more happens here, e.g. for type parameters.

Similarly, for https://github.com/dart-lang/sdk/issues/36697 we would need to introduce `InvalidType`, which is not `DynamicType`. And so, `DartType.isDynamic` should not return `true` for `InvalidType`, it is not a property that various types may have, and should be replaced with explicit `is DynamicType`.

We also have `UnknownInferredType`, but it should never leak to clients.

Change-Id: I302b06355143d97bb52922c805dbad585a522e0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-14 18:50:33 +00:00
pq ad2da86f18 linter 1.33.0 rc
Some notes.

* There are a number of tests that should get decoupled from the linter being pulled into `DEPS`.  Instead of depending on the state of lints there, we should update the tests instead to use a more hermetic environment.  (See for example `options_rule_validator_test.dart` for how that might look.)


Downstream (blocking) fixes:

* https://github.com/flutter/flutter/pull/119736
* https://github.com/flutter/gallery/pull/878


Change-Id: I5671b0abde3eeda75513abaaf9fef3bcd5115f9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280054
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-02-07 20:56:35 +00:00
Jens Johansen e4f0882709 [analyzer] Speedup some completion queries
When getting completions, some of the "contributers" basically do a
walk of the AST and almost add everything they see, and the list
is then later pruned based on the user query.

This CL introduces a "first pruning" (a copy of the first part of what
is done in the subsequent pruning) so only the things has could match
the user query is added.

Benchmarks for this:

Notes:
 - All of these numbers are with the timeout increased a lot (to a
   point where there effectivley isn't any timeout).
 - I have an external project too, but only in Android Studio as it's
   a Flutter project and my VSCode then uses the dart included in
   flutter. I don't know how to make it not do that.

Summary:

Android Studio, bin/server.dart --- `print(CallHierarchyK^);`
Difference at 95.0% confidence
        -46.45 +/- 10.0349
        -45.7861% +/- 9.8915%
        (Student's t, pooled s = 15.6785)

Android Studio, bin/server.dart --- `starter.^;`
No difference proven at 95.0% confidence

Android Studio, Other project --- `print(Cryptm^);`
Difference at 95.0% confidence
        -90.3 +/- 10.9506
        -58.0894% +/- 7.04448%
        (Student's t, pooled s = 17.1092)

VSCode, bin/server.dart --- `print(CallHierarchyK^);`
Difference at 95.0% confidence
        -61.45 +/- 5.41501
        -51.4226% +/- 4.53139%
        (Student's t, pooled s = 8.46036)

VSCode, bin/server.dart --- `starter.^;`
Difference at 95.0% confidence
        6.4 +/- 5.08317
        15.4217% +/- 12.2486%
        (Student's t, pooled s = 7.94189)

So for several queries it's ~50% faster. For a single one it slightly slower.

Raw numbers:

BEFORE:

Android Studio, bin/server.dart --- `print(CallHierarchyK^);`
90 ms
88 ms
89 ms
85 ms
139 ms
92 ms
86 ms
101 ms
87 ms
84 ms
112 ms
110 ms
128 ms
99 ms
99 ms
104 ms
98 ms
88 ms
106 ms
144 ms

Android Studio, bin/server.dart --- `starter.^;`
38 ms
38 ms
34 ms
30 ms
35 ms
34 ms
29 ms
31 ms
35 ms
60 ms
53 ms
37 ms
54 ms
31 ms
51 ms
33 ms
39 ms
68 ms
75 ms
91 ms

Android Studio, Other project --- `print(Cryptm^);`
150 ms
146 ms
142 ms
138 ms
150 ms
213 ms
147 ms
143 ms
149 ms
147 ms
153 ms
147 ms
136 ms
151 ms
151 ms
186 ms
160 ms
153 ms
150 ms
197 ms

VSCode, bin/server.dart --- `print(CallHierarchyK^);`
122 ms
113 ms
115 ms
118 ms
124 ms
116 ms
116 ms
114 ms
118 ms
125 ms
130 ms
117 ms
104 ms
119 ms
121 ms
120 ms
127 ms
123 ms
117 ms
131 ms

VSCode, bin/server.dart --- `starter.^;`
38 ms
45 ms
35 ms
37 ms
37 ms
59 ms
39 ms
38 ms
37 ms
44 ms
41 ms
41 ms
43 ms
41 ms
39 ms
40 ms
42 ms
43 ms
49 ms
42 ms


WITH CL:

Android Studio, bin/server.dart --- `print(CallHierarchyK^);`
65 ms
59 ms
41 ms
41 ms
70 ms
38 ms
56 ms
66 ms
64 ms
44 ms
47 ms
56 ms
46 ms
38 ms
46 ms
64 ms
57 ms
44 ms
69 ms
89 ms

Android Studio, bin/server.dart --- `starter.^;`
36 ms
36 ms
38 ms
35 ms
37 ms
43 ms
32 ms
30 ms
34 ms
39 ms
32 ms
40 ms
35 ms
34 ms
35 ms
39 ms
46 ms
54 ms
56 ms
78 ms


Android Studio, Other project --- `print(Cryptm^);`
59 ms
63 ms
61 ms
80 ms
98 ms
56 ms
60 ms
61 ms
57 ms
61 ms
57 ms
61 ms
59 ms
59 ms
57 ms
64 ms
60 ms
65 ms
58 ms
107 ms


VSCode, bin/server.dart --- `print(CallHierarchyK^);`
55 ms
54 ms
50 ms
47 ms
59 ms
55 ms
53 ms
53 ms
67 ms
67 ms
54 ms
54 ms
50 ms
62 ms
54 ms
54 ms
56 ms
59 ms
63 ms
95 ms


VSCode, bin/server.dart --- `starter.^;`
57 ms
41 ms
57 ms
40 ms
45 ms
47 ms
40 ms
44 ms
43 ms
43 ms
41 ms
40 ms
42 ms
49 ms
40 ms
46 ms
57 ms
49 ms
81 ms
56 ms

https://github.com/flutter/flutter-intellij/issues/6470

Change-Id: I1e34ce04774cafcb47f4e8590b990400a7b0f0ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279389
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-01-27 08:27:48 +00:00
Kaushik Iska 885457e1d3 Revert "[analyzer] new warning for nullable '==' parameter type"
This reverts commit 48ee1f218d.

Reason for revert: https://github.com/flutter/flutter/issues/118632

Original change's description:
> [analyzer] new warning for nullable '==' parameter type
>
> This rule checks that a parameter to an `operator ==` implementation has
> a non-nullable type.
>
> I intentionally did not enforce, in this rule, that the parameter is
> exactly `Object`. It is legal to narrow the parameter type to a
> different non-nullable type, like `int`. I can't imagine doing it, but
> it seems to be unrelated to whether the type should be nullable or not.
>
> Fixes https://github.com/dart-lang/linter/issues/3441
>
> Replaces https://github.com/dart-lang/linter/pull/3923
>
> Change-Id: I61d4a7b1ab8318dc9403da1633c352de95bfac61
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277700
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I6f96936b8d4e785b5f8e9719751e4b61c2a6ca2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279141
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-01-17 23:53:18 +00:00
Sam Rawlins 48ee1f218d [analyzer] new warning for nullable '==' parameter type
This rule checks that a parameter to an `operator ==` implementation has
a non-nullable type.

I intentionally did not enforce, in this rule, that the parameter is
exactly `Object`. It is legal to narrow the parameter type to a
different non-nullable type, like `int`. I can't imagine doing it, but
it seems to be unrelated to whether the type should be nullable or not.

Fixes https://github.com/dart-lang/linter/issues/3441

Replaces https://github.com/dart-lang/linter/pull/3923

Change-Id: I61d4a7b1ab8318dc9403da1633c352de95bfac61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277700
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-01-13 19:51:29 +00:00
Sam Rawlins 100f78daf6 Enforce new lint rules in pkg/analysis_server
Change-Id: I2fd938e5bc44f0798429b68524abc5718211c0ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270482
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-11-18 22:36:57 +00:00
Sam Rawlins 207a47145f Fix overlays in completion_metrics.dart
Overlays were not being removed fully, which lead to crashes as we tried to
change the file contents with an invalid index.

Change-Id: I2c60a101b3a60e90100fbaf1970a3cada0296e41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269180
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-11-11 00:20:29 +00:00
Konstantin Shcheglov 683e2419da Deprecate 'DartType.element2' use 'element' instead.
Change-Id: I6986a058616db489987789cfab09d53a450e3ab5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262666
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-10-05 16:30:09 +00:00
Konstantin Shcheglov fcc9473dab Deprecate CatchClause.exceptionParameter2/stackTraceParameter2
Change-Id: I3f0ae9367f35fe514a125cb0f06ccbdc8fa0dc18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262502
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-10-04 15:58:11 +00:00
Konstantin Shcheglov 745d0ff64a Deprecate 'Element.enclosingElement3', use 'enclosingElement'.
Change-Id: I6f4fd7e8c0f071bde10cb5e57ed6195ae517e575
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-26 23:58:14 +00:00
Konstantin Shcheglov 44316060f1 Deprecate 'get declaredElement2', use 'get declaredElement' instead.
Change-Id: Ida7a9c2ac35943aed2d75f81f98ce7056b616aee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260741
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-23 20:05:29 +00:00
Sam Rawlins 51114fca8a Unnamed libraries
Fixes https://github.com/dart-lang/language/issues/1073

Spec: https://github.com/dart-lang/language/blob/master/accepted/future-releases/unnamed-libraries/feature-specification.md

This work allows library directives without a name. Every single one would look like this:

```
library;
```

:) it was a little anti-climactic implementing a non-feature like this, but there it is.

The affordance for a library directive without a name is guarded by an experiment flag, `--unnamed-libraries`.

Change-Id: I8612238359e88d6082f7e89d0d0fc624fdb45273
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257490
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2022-09-23 05:37:39 +00:00
Konstantin Shcheglov e03170035a Deprecate 'get name2', use 'get name' instead.
Change-Id: Iee8ef5fb6700d96c857a22a99dc61dac3da88572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260443
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-22 02:22:47 +00:00
Konstantin Shcheglov 6f0fe880c4 Breaking changes for analyzer version 5.0.0
Reland of https://dart-review.googlesource.com/c/sdk/+/243164

Change-Id: I5167844ea1001f026cf8d9b82465a79f560d188d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257267
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-07 16:27:18 +00:00
Konstantin Shcheglov ff8024fc78 Revert "Breaking changes for analyzer version 5.0.0"
This reverts commit d8df88cbe4.

Reason for revert: breaks Flutter HHH, requires updates to linter

Original change's description:
> Breaking changes for analyzer version 5.0.0
>
> Change-Id: Id9f27b6c41829249f6b2e7b93ad396643193fc78
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243164
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

TBR=scheglov@google.com,brianwilkerson@google.com

Change-Id: I6ca213427189c169ddacbd89f60d463efa2c38f2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257122
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-31 21:05:19 +00:00
Konstantin Shcheglov d8df88cbe4 Breaking changes for analyzer version 5.0.0
Change-Id: Id9f27b6c41829249f6b2e7b93ad396643193fc78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243164
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-31 05:08:50 +00:00
Konstantin Shcheglov f4c009dc33 Deprecate Declaration.declaredElement, use 'declaredElement2' instead.
This is necessary to separate `ClassElement`, `EnumElement`, and `MixinElement`. And, in the future, augmentations like `ClassAugmentationElement`, etc.

Change-Id: Iecd2f8707212e53ef56f0e101880c7bab9e5d057
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254104
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-09 17:26:06 +00:00
Konstantin Shcheglov 5458af8662 Deprecate ClassElement.isEnum/isMixin, use 'is EnumElement' instead.
Change-Id: I493fb048d0f7c8af778a35e4543df206cfd18739
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-04 19:21:27 +00:00
Konstantin Shcheglov cbfad8f802 Deprecate DartType.element, use specific element accessor for InterfaceType, TypeParameterType.
For `InterfaceType` keep `element2` deprecated and define
`InterfaceElement get element2` instead. Most changes are because
of this.

Change-Id: I13b888610fc707438c3c97b676f1460e7fc2b040
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253564
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-04 16:18:06 +00:00
Konstantin Shcheglov 71ef76ddfd Deprecate Element.enclosingElement2, use 'enclosingElement3'.
Change-Id: I0aba589bd42648eb420051cbe04bb3ef435081e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253400
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-02 18:00:14 +00:00
Konstantin Shcheglov 01173e2aa2 Deprecate 'name' in AST, use 'name2' token instead.
Change-Id: I867f009dca12208f835199297d2ea85c203c8556
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252566
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-02 16:25:34 +00:00
Konstantin Shcheglov 33b672f789 Use CatchClauseParameter instead of SimpleIdentifier.
Change-Id: Ib254d05954548d4101fef9c2545d18b2611b59dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253100
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-01 17:32:04 +00:00
Konstantin Shcheglov 2f3269faa1 Deprecate 'Element.enclosingElement', switch to enclosingElement2.
We need this for:
1. CompilationUnitElement changes its enclosing element from LibraryElement to LibraryOrAugmentationElement
2. Similarly PrefixElement.

Change-Id: I5e3719b4ef59d03caab1b20c9172a8c0fd786bdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251900
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-19 15:44:14 +00:00
Konstantin Shcheglov 33295f8247 Add more await or unawaited() to DAS.
Change-Id: I45b2b988141c235b6fbe50e69fa018627e20e004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251146
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-12 00:59:01 +00:00
Konstantin Shcheglov 40db70d5fd Deprecate 'Directive.keyword', use specific 'xyzKeyword'.
Change-Id: I66ab521df857de07343205aed6335e6d3566eafb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-07 19:55:21 +00:00
Konstantin Shcheglov e5da1f97b9 Remove DocumentationCache, we cache documentation and more in _ElementCompletionData.
Change-Id: I36e0f9cfaf648349f789658bcf80a7aab294c7ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-30 14:52:06 +00:00
Devon Carew 0340696b02 [pkg/analysis_server] remove code referencing itsallwidgets.com
Change-Id: Ic7b93eaaef6cb35395d47af5603e095250048d77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245740
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-05-23 20:54:00 +00:00
Sam Rawlins f397ecb588 Satisfy library_private_types_in_public_api in analyzer
This involves changes of a few flavors:

* Make classes private which were unnecessarily public.
* Make class elements private which were unnecessarily public.
* Comment in places where a "public" API contains a private type,
  but this is because of the signature of a super-member. I think
  these are generally quite safe.

Change-Id: Ied1864202cc256205a3b421ddec5513f0a22a608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243647
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-05-22 01:45:33 +00:00
Sam Rawlins 84ca405b35 Support overlays in completion_metrics_client.dart
Change-Id: Idedb38193ed80be0fa10e8e6be3fa04f8f30b100
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243649
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-05-04 20:58:54 +00:00
Sam Rawlins 9d456bf516 Basic client completion test
This involves a large refactoring of completion_metrics.dart, extracting
out some common code into completion_metrics_base.dart

The code in completion_metrics.dart and completion_metrics_base.dart is
largely unchanged, but restructured to fit the sub-class structure.

* Rename CompletionMetricsComputer -> CompletionQualityMetricsComputer,
  as this is focused on quality metrics.
* Extract out applyOverlay and removeOverlay methods.
* Extract out computeSuggestionsAndMetrics, code which is run per
  ExpectedCompletion.
* Extract out setupForResolution, for code custom to the quality
  computer.

The meat of this change though is in completion_metrics_client.dart:

* _AnalysisServerClient is code which was extracted from
  package:dartdev/src/analysis_server.dart. It may seem like an odd
  choice when we have package:analysis_server_client, but I think
  dartdev's client is fairly mature in creating a short-lived client,
  and handling crashes, etc. If this should be re-combined with dartdev,
  I think there are open questions about where that should live, and I'd
  like to address that in a follow-up.
* The client does not perform overlays yet.
* The client does not track slowest requests yet.
* The client does not have support for performance metrics which DAS
  tracks itself. Adding this is high priority.

Change-Id: Ib259f78e4646d10b61559bfd5700d98a95d14d43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243522
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-05-04 01:05:05 +00:00
Sam Rawlins c94b26e5b1 Add comments to completion_metrics.
Change-Id: I0836afe9d94998bbc6fac3358cba40372cabc418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242240
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-04-23 04:21:10 +00:00
Sam Rawlins 7e95dc1335 completion_metrics: add a 'prefix-length' option
This option allows the completion position to be an offset from the
start of each token, and plays well in each overlay mode. For the
original content:

```dart
void main() {
  foo();
}
```

In OVERLAY_NONE mode, completing on `main`, with `--prefix-length=2`,
we complete at:

```dart
void main() {
       ^
  foo();
}
```

In OVERLAY_REMOVE_TOKEN mode, completing on `main`, with
`--prefix-length=2`, we complete at:

```dart
void ma() {
       ^
  foo();
}

In OVERLAY_REMOVE_REST_OF_FILE mode, completing on `main`, with
`--prefix-length=2`, we complete at:

```dart
void ma
       ^
```

Change-Id: Id2493777cb38f147f7a2c401a9e53e17561516bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241982
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-04-21 21:05:01 +00:00
Sam Rawlins f986ec4ed8 Change 'slowest requests' flag to not group by group; instead use p90
Previously, the 'slowest requests' flag would only track and print the
slowest 5 requests for each category. But this ends up printing many
requests which are not slow at all, and are perfectly reasonable. It is
more interesting to print the slowest results, those in the 90th
percentile.

The limit is set to 100. This is to set a limit on serialization in the
map/reduce system, and a limit on printing to stdout.

Change-Id: I31fde906e227ea195ec25d8c9c2d92569ceb72b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241865
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-04-21 20:59:18 +00:00
Sam Rawlins c32fe13239 Fix help for completion_metrics
As it is, it is broken if you pass `--help`.

Also, this adds line wrapping for option help text.

Change-Id: Ia1e096eba46b1f4db804f9c1ed771d4e67816ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242020
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-04-21 20:14:29 +00:00
Sam Rawlins 11a01c8fad Add a progress bar to completion_metrics
Progress bar largely taken from
https://github.com/dart-lang/sdk/blob/main/pkg/nnbd_migration/lib/src/utilities/progress_bar.dart

If there's a good common place (in package:analyzer?) to put this,
I'd be happy to do so.

Change-Id: Ic64ac98d8a8f5ae1cc036932364f37f10b837055
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241623
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-04-19 20:40:19 +00:00
Konstantin Shcheglov 5910da4f02 Use AnalysisContext.applyPendingFileChanges() after changeFile().
Bug: https://github.com/dart-lang/sdk/issues/48789
Change-Id: Ibb1ae34cdaa447385d9b2cd0f3282eb178b1dbf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241208
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-14 18:20:53 +00:00
Sam Rawlins 6660e3c9a0 Add median, p90, and p95 metrics to completion_metrics
This adds a section to the output like this:

```
### Percentile metrics

                   p50  p90  p95  count > 2s
ms per completion    4    6    7           0
```

Bug: https://github.com/dart-lang/sdk/issues/48788
Change-Id: I868580324b3bc83605aa6466ffd5799625d1a9f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240941
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-04-13 20:48:03 +00:00
pq 16b436151a migrate server to recommended lints
See: https://github.com/dart-lang/sdk/issues/48785

Change-Id: I1bec40cc0b52e5df5f07c35ec993e08c56a59cbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240907
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-04-12 13:34:12 +00:00
Konstantin Shcheglov 5fa65048c1 Use file_paths.pubspecYaml instead of 'pubspec.yaml' literal.
WDYT ?

Change-Id: I6677b2237e0558c74bb11073dcfb44d7b672323f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-10 19:03:55 +00:00
Konstantin Shcheglov 60b428e2b1 Deprecate superclass2, mixinTypes2, etc.
Change-Id: Ieaaeab57930cb93f5b6b1323efe63c3395b79993
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232742
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-17 02:20:42 +00:00
Konstantin Shcheglov f69d1f887f Use CompletionSuggestionBuilder, and HasCompletionData to store location independent data.
Change-Id: I767bfc1c31b5aebc8f4e27267520f705701e7724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231044
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 17:33:19 +00:00
Konstantin Shcheglov 985d476218 Use Map.identity() to associate data with CompletionSuggestion(s).
CompletionSuggestion.hashCode is very, very expensive.

With some other changes the difference is 67 vs 47 seconds.

Change-Id: Ie792b5ccbfd32a1896166594fdeeb89193d4d061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-27 22:11:41 +00:00