Commit Graph

8768 Commits

Author SHA1 Message Date
Konstantin Shcheglov c61aecda75 Completion. Issue 55167. Suggest type names for DeclaredVariablePattern, in SwitchPatternCase.
Bug: https://github.com/dart-lang/sdk/issues/55167
Change-Id: I1f00fd0ea589786767443d97e7c74b7f482ba4be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-23 17:01:30 +00:00
pq a19c07ffd4 guard against empty entity lists
Unable to repro the reported issue, but this will at least protect against the exception.

Fixes: https://dart-review.googlesource.com/c/sdk/+/359280

Change-Id: I712f9b92879ca6b80b2f1004206e4f77a3178a47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359280
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 23:02:33 +00:00
pq 4145eeba06 don't replace is{Not}Empty for nullable targets
Fixes: https://github.com/dart-lang/sdk/issues/55250

Change-Id: Iae692c0f6a36e7fc89028acd1934580d1648c937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 21:24:41 +00:00
Keerti Parthasarathy ef3eb6b301 Modify completion test to address comments.
Change-Id: Ib5d1237e9008a9ec1b68558894c3cc15d17347ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-03-22 19:17:29 +00:00
Konstantin Shcheglov 5a65760042 Completion. Rework KeywordSuggestion to better constructors.
As requested in https://dart-review.googlesource.com/c/sdk/+/359240

Change-Id: I5047afaddfd74310303001669177f725aac9c02c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 19:04:39 +00:00
Konstantin Shcheglov 2447f1a973 Completion. Issue 55275. Suggest expressions in AssertStatement condition and message.
Bug: https://github.com/dart-lang/sdk/issues/55275
Change-Id: Icda00b5f472db29bfba8b58bd1a022bf43525221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359260
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 17:19:05 +00:00
Danny Tuppeny 683917ddd7 [analysis_server] Change flag for enabling LSP virtual document support
This accepts the flag without a suffix because I'm fairly confident we can ship this support without breaking changes to the API.

For a short period, the old flag is still supported so that Dart-Code + SDK don't need to be updated at the same time to avoid the support disappearing. I will remove the old flag in a few weeks (after a beta SDK branch and a stable Dart-Code release).

Change-Id: I246a33f37a5d5fc5c05c15daab7d87d4cc4fd9e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-22 17:01:40 +00:00
Konstantin Shcheglov f1a064cd8a Completion. Issue 55276. Suggest 'part of' and URI completion in it.
Bug: https://github.com/dart-lang/sdk/issues/55276
Change-Id: I7cc4bb94a06115899de941d2e72aa5efeb8831b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359240
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 16:24:31 +00:00
Danny Tuppeny df0b1f74f7 [analysis_server] Tidy up LSP tests failTestOnAnyErrorNotification to be implied when using expectErrorNotification
This is a small tidy up that changes `failTestOnAnyErrorNotification` to be automatically set when using `expectErrorNotification` so there's slightly less noise in tests.

Change-Id: I44056a23aca872b8e96109be4d4ba4356b8af53d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359221
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 16:06:58 +00:00
Konstantin Shcheglov 219f8a9013 Completion. Issue 55167. Suggest type names for DeclaredVariablePattern.
Bug: https://github.com/dart-lang/sdk/issues/55167
Change-Id: I3fad2f2559bf8677afbe893d8d147a0d443e441a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359121
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 15:48:49 +00:00
Konstantin Shcheglov e5a60de9d8 Completion. Migrate UriContributor.
Change-Id: If2b50d47736277eca2a2f4a20189cdb14d775f17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-22 00:56:15 +00:00
Konstantin Shcheglov 9f64559a8d Completion. Issue 55263. Suggest formal parameters in AssertInitializer.
Bug: https://github.com/dart-lang/sdk/issues/55263
Change-Id: Id210e1c98f9c8f5e20c09e6cade6c9893bd40761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 00:13:09 +00:00
Konstantin Shcheglov 3ca76a245a Completion. Migrate LibraryPrefixContributor.
Change-Id: I26e3a2d2a4d724262a5444580987ab9ad8ca9507
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-21 22:44:02 +00:00
Konstantin Shcheglov fc168c6a5f Completion. Migrate EnumConstantConstructorContributor.
Change-Id: If09014bad3467a9c0933d4f8aad6950051172efe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358683
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-21 21:18:29 +00:00
Sam Rawlins 4c689ca7f5 das: Extract CorrectionUtils.getTypeSource; tidy ExtractMethodRefactoring
This is mostly a very tidy extraction of `getTypeSource`. This method
relied on a handful of helper functions, all of which were _only_
present in order to help `getTypeSource`. This method also does not
rely on `_buffer` or `eol`. And it is only used by one piece of code,
`extract_method`. Almost a slam dunk!

However, there appeared some strange caveats that I must document
here:

CorrectionUtils also featured two mutable fields, `targetClassElement`
and `targetExecutableElement`. Theoretically, these fields are
supposed to be set before calling `getTypeSource`, to help understand
whether a TypeParameter will be visible when extracting a method, or
something like that. But it appears to be totally broken:

* The singular caller of `getTypeSource`, `ExtractMethodRefactoring`,
  _never sets those fields_.
* Two other pieces of code, the AddTypeAnnotation fix, and the
  CreateField, CreateFunction, and CreateOverrides fixes, all set the
  fields, but _never call getTypeSource_.

Since this all looked like just very stale / rotten code, I removed
everything which looks to be dead: `targetClassElement` and
`targetExecutableElement`, and lo and behold: no tests fail! I've kept
those things deleted, and added a TODO for TypeParameters.

Lastly, since I was trying to figure out ExtractMethodRefactoring, I
tidied it up:

* Make it final
* Rename `ERROR_EXITS` to `errorExits`
* Privatize `searchEngine`, `resolveResult`, `selectionOffset`,
  `selectionLength`, `librariesToImport`, and `variableType`.
* Both `selectionRange` and `utils` could be final as they were set
  in the constructor body, so move that to initializers, make final,
  and make private.

Change-Id: Ia3fb948e5424971eb4250e711c179707552ad8aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358663
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-21 17:07:43 +00:00
Keerti Parthasarathy 5119fb93c4 Completion Issue 52839: Show local declarations intead of global when shadowed.
Fixes https://github.com/dart-lang/sdk/issues/52839.

Change-Id: I84c112d2aff9cb60c829d366c14a621558eb7712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-03-21 16:22:38 +00:00
pq 070eac1826 quick fix for unnecessary_library_name
Change-Id: I22f7734266050c7d06c8ee5809af6912ea39c4e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358681
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-21 01:35:09 +00:00
Danny Tuppeny 4b85176d97 [analysis_server] Add a new LSP command for "Go to Augmentation"
This adds a custom command similar to `dart/textDocument/super` but for augmentations.

This won't show up anywhere on its own, but it will be added to the command palette in Dart-Code based on the server capabilities (and in the future, maybe CodeLens - although that will require some additional work in the server first since it will be the source of CodeLens even if they trigger client-side actions).

See https://github.com/dart-lang/sdk/issues/54742

Change-Id: Ib3a3fd08702e14b8bd251991035ef0b8d06ad996
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358452
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-20 22:39:43 +00:00
Danny Tuppeny 2b8c2f6418 [analysis_server] Add a new LSP command for "Go to Augmented"
This adds a custom command similar to `dart/textDocument/super` but for augmentation targets ("augmented").

This won't show up anywhere on its own, but it will be added to the command palette in Dart-Code based on the server capabilities (and in the future, maybe CodeLens - although that will require some additional work in the server first since it will be the source of CodeLens even if they trigger client-side actions).

See https://github.com/dart-lang/sdk/issues/54742

Change-Id: I11ca115c61ade40bf51478f58b39b7caedac19c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358451
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 21:08:09 +00:00
pq 200e6d987d rename to unnecessary_library_name
As noted by Lasse, we're not really consistent and the singular is more "correct".

See: https://github.com/dart-lang/sdk/commit/71456592d0268238ac0f8a5c7d3fd8bf2c096752#r140033857


Change-Id: I55afeab8c42d9f20999e263682f71d54a2302ea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-20 19:28:52 +00:00
Konstantin Shcheglov 5120f166f1 Completion. Issue 55224. Fix for suggesting extension members on 'null'.
Bug: https://github.com/dart-lang/sdk/issues/55224
Change-Id: Id2941165dc336411315e009a4bcba913b1e1a7b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358780
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 17:24:15 +00:00
Brian Wilkerson eb615fc31b Compute the context location in more places
Change-Id: Ic8df3d344afc271615874f6de882d18b5378497a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358600
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:57:11 +00:00
pq 71456592d0 + unnecessary_library_names
Fixes: https://github.com/dart-lang/linter/issues/3882

(I'll follow-up with a quick-fix.)

Change-Id: Ice88bfb59a16163b003ce94c73e057d2fd968a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-20 16:54:59 +00:00
Konstantin Shcheglov 8be20a0d67 Completion. Speed. Don't create new Set / toList() 'requiredImports' for every suggestion.
Before:
[1710880110645][time: 513 ms][mean: 486.0][stdDev: 24.021][min: 436.0][max: 537.0]

After:
[1710908972390][time: 421 ms][mean: 425.0][stdDev: 21.033][min: 386.0][max: 479.0]

So, about 12% faster.

Change-Id: I75676d5b6a4614ef81b25c0ff4694ff0c711b2cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358403
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:03:49 +00:00
Konstantin Shcheglov aa2cd456a3 Completion. Issue 35449. Don't suggest @visibleForTesting instance members when not available.
Bug: https://github.com/dart-lang/sdk/issues/35449
Change-Id: I7e02d7fbbc9477ad98dd87327adf3b562fc0fde8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358328
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:02:33 +00:00
Sam Rawlins f3a47d3123 das: Move findPossibleLocalVariableConflicts; tidy PostfixCompletionProcessor
`CorrectionUtils.findPossibleLocalVariableConflicts` actually does not
use the `eol` utility or the `_buffer` field; it turns out it is a
good candidate for an extension method on CompilationUnit. It is moved
to the existing extension.

In refactoring call sites, PostfixCompletionProcessor didn't have a
perfectly obvious CompilationUnit field, so I refactored it a bit, and
cleaned up it's fields:

* Make the class final.
* Rename `NO_COMPLETION` to `_noCompletion`
* Privatize `node`, `completion`, `eol`, `file`, `key`,
  `selectionOffset`, `typeProvider`, and `typeSystem`.
* While checking whether `change`, `linkedPositionGroups`, and
  `exitPosition` could be private, it turns out they are unused; this
  would have been flagged by static analysis if they had been private.

Change-Id: I29c48c362261b11402cee43464386c3152df7158
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358641
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-03-20 15:00:13 +00:00
TheComputerM 7eddad0708 quick fix for annotations with static getters
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/55066
Change-Id: Ifb2dcaf9610e1123cb65f35cd9f9232f31a6b2a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 23:36:19 +00:00
Konstantin Shcheglov 8e8a88db8c CQ. Share isInternal, isProtected for analysis and completion.
Change-Id: I884d854f0dd258019d1c4d96f9db7959f36140c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 21:29:28 +00:00
TheComputerM 27066e6d3b do not quick fix to existing named arguement
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/54336
Change-Id: If41d8c239b3375600de6f9245127c2d27b37e40b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Mudit Somani (TheComputerM) <mudit.somani00@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-19 21:22:32 +00:00
Danny Tuppeny dd8c55cc9d [analysis_server] Improve Go-to-Super for constructors and augmentations
This changes Go-to-Super to handle augmentations (jumping to a super-member will go the last augmentation in the chain) and constructors (will jump to the actual super constructor that is called, regardless of name).

Change-Id: I7439fd42ef81983e7a052f250f7ba272fe8c2c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357608
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 21:22:15 +00:00
Sahil Kachhap 590683660b Fixed the Error message of "extract method" refactoring (#55148).
R=pquitslund@google.com

Fixed: 55148
Change-Id: I51a17b182bbd6e2001a4dfd0130c8ff378f7bdcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357960
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Sahil Kachhap <sahil.kachhap111989@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-19 20:26:20 +00:00
Sam Rawlins 6896a21216 analyzer plugins: Move DartFixContext and Impl to server_plugin
* Combine DartFixContext and DartFixContextImpl into one class;
  separation seems unnecessary.
* Change constructor (which was on DartFixContextImpl) to use all
  named parameters.
* Change `resolveResult` field to `resolvedResult`, since the type is
  called `ResolvedUnitResult`.
* Start doc comments with third person verbs [1].


[1]: https://dart.dev/effective-dart/documentation#prefer-starting-function-or-method-comments-with-third-person-verbs

Work towards https://github.com/dart-lang/sdk/issues/53402

Change-Id: Idb3c6776f899d5bc9b634c1d9c4b998de2603d04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-03-19 19:06:33 +00:00
Konstantin Shcheglov dbaa922223 Completion. Issue 35449. Don't suggest @internal instance members when not available.
Bug: https://github.com/dart-lang/sdk/issues/35449
Change-Id: I9e65a0075a69e0bbc00e814272099a6810b82ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358261
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 17:11:23 +00:00
Sam Rawlins a8a42cffd2 Simplify some CorrectionUtils code
The big one is `getIndent`, which I think can be simpler, and also used a handwritten implementation of `String.operator *`. It turns out:

* > 90% of calls to `getIndent` were `getIndent(1)`, which can be
  replaced with a constant `'  '`.
* Then 4 calls to `getIndent` were `getIndent(2)`, which can be replaced
  with a constant `'  ' + '  '`.
* Then one last call, in CorrectionUtils itself, used a variable number
  of indents which can be replaced with `'  ' * n`. This is in the
  `indentRight` function.

Also:

* Privatize `getInsertionLocationTop`, `isClassWithEmptyBody`, `isJustWhitespaceOrComment`, `skipEmptyLinesLeft`
* Rewrite CorrectionUtils.findSimplePrintInvocation as an extension
  method on AstNode; does not need the `_buffer`.

Change-Id: I15c19b8c0cc354adcd4ffea5803b3a182cf28336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 17:05:49 +00:00
Konstantin Shcheglov 22873be577 Completion. Benchmark for continuously asking completions.
Useful to focus on measuring performance of computing suggestions
only, without any overhead of resolution, protocol conversion, etc.

To be run as is, or with `--observe:xxxx` to see what to optimize.

You need to supply your own Flutter checkout.

Change-Id: Ie143b4ec9c24e05a0de2a14c1b8f0e1c20ef3a8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 22:56:10 +00:00
Sam Rawlins 3a650f40a8 analysis_server: Introduce analysis_server_shared package
With a simple move of two classes, Fix and FixContent.

The class moves are not exactly no-ops. I moved each class into its
own library and made the following changes:

* Start doc comments with third person verbs [1].
* Make `Fix` class **final**.
* Make `FixContext` class **interface**.

[1]: https://dart.dev/effective-dart/documentation#prefer-starting-function-or-method-comments-with-third-person-verbs

Work towards https://github.com/dart-lang/sdk/issues/53402

Cq-Include-Trybots: dart-internal/g3.dart-internal.try:g3-cbuild-try
Change-Id: Ic046b236d634543832825db8746e0abdca5191fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355889
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-03-18 20:54:49 +00:00
Keerti Parthasarathy 5a6ef279fb Completion Issue 53515: Fix for shadowing in extensions.
Change-Id: I4b1b0651479ec669018ef5a74b91f0b20c6871e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-03-18 19:58:49 +00:00
Konstantin Shcheglov a09fa058d2 Completion. Issue 38235. Check if isPostfixCompletionApplicable invoked inside a comment.
Bug: https://github.com/dart-lang/sdk/issues/38235
Change-Id: I97108bb549d220d45dba35147c0e1fe53fe6b597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357985
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 18:12:24 +00:00
Konstantin Shcheglov 28210d7793 Completion. Issue 55186. Suggest field formal parameter names even when starts with keyword.
Bug: https://github.com/dart-lang/sdk/issues/55186
Change-Id: I6f17e6fad9fe135737d75fb08200dae190c95ea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357943
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-18 18:08:50 +00:00
Konstantin Shcheglov e0d6fd040e Completion. Issue 35449. Don't suggest @protected instance members when not available.
Bug: https://github.com/dart-lang/sdk/issues/35449
Change-Id: Ie8d0b3ba354addbf42d2a4efe9c4dbf318e6c659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358120
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 18:02:29 +00:00
Konstantin Shcheglov 1eab8550ea Completion. Issue 55186. Suggest variable names after incomplete field.
Bug: https://github.com/dart-lang/sdk/issues/55186
Change-Id: I2cc2e5b7df6c3a25e157aa36b04c2bb44fbe3a28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358020
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-16 21:56:56 +00:00
Konstantin Shcheglov d918ac16b3 Completion. Cache 'inConstantContext' value.
For package:collection, computing measures.

Before: 0:01:00.236000
After:  0:00:55.977000

So, about 7% faster.
I think this translates into actual completion speed up.

Change-Id: I45f0c0186d5988e6e1b043d465030668cd61335b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357982
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-15 20:38:36 +00:00
Konstantin Shcheglov 1473c306a1 Completion. Move 'allowedIdentifiers' to the top of test methods.
Change-Id: Ibed4bd2c284e3b90f1b5477a22c5559857530e51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-15 19:47:59 +00:00
Konstantin Shcheglov 94abcc81ab Completion. Use CompletionSuggestionBuilder in completion metrics, faster.
For sdk/pkg/analyzer_cli

Before: 0:01:32.542000
After:  0:00:33.254000

So, about 3 times faster.

Change-Id: I8eae44eeefd5624f88a42fe37b8ae1c29427ee49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356310
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-15 19:08:23 +00:00
Konstantin Shcheglov 1e17df5aec Completion. Issue 55206. Fix completion of partial property access before another identifier.
Bug: https://github.com/dart-lang/sdk/issues/55206
Change-Id: I247464934aa41491ac6e051a28a680c3fe68d2bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-15 18:53:38 +00:00
Brian Wilkerson db1b6018ca Convert the identifier contributor to the new structure
Change-Id: I99b5b1286a314e4c612b33dcfea9c2acb9b6740d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357940
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-15 18:09:29 +00:00
Konstantin Shcheglov aa58a628e2 Completion. Issue 55198. Fix completion after 'if' statement.
Bug: https://github.com/dart-lang/sdk/issues/55198
Change-Id: I50032b8cc24c4b0e4961dba5afd8ee8414810b03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-15 16:51:15 +00:00
Konstantin Shcheglov e7a109c875 Completion. Issue 53964. Recovery after parsing almost PropertyAccess before 'await'.
Bug: https://github.com/dart-lang/sdk/issues/53964
Change-Id: Ia583243fefd190bb14d857f8547c88e74524d33f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357520
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-14 18:30:10 +00:00
Konstantin Shcheglov 081cff0cc4 Completion. Issue 54773. Exclude TypeParameterList created during recovery.
So that we don't suggest the partially type name as a type parameter.
It is a partial type argument actually.

Bug: https://github.com/dart-lang/sdk/issues/54773
Change-Id: I427d75524f9c6a7c298a8708ab01b362f7a564e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-14 17:03:29 +00:00
Sahil Kachhap 41fa436c73 Add quick-fix for USE_NAMED_CONSTANT linter rule
R=scheglov@google.com

Change-Id: Ibb6978544eb780f02211f079db58503558ce7039
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357400
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Sahil Kachhap <sahil.kachhap111989@gmail.com>
2024-03-14 16:20:51 +00:00