Commit graph

7351 commits

Author SHA1 Message Date
Danny Tuppeny 857a0d2e66 [analyzer] Resolve comment references for inherited members
Fixes https://github.com/Dart-Code/Dart-Code/issues/4114.

Change-Id: I47fe2909e4d09366c1e2f432c31076ba690fac7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256162
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-25 14:29:43 +00:00
pq 103a2fa642 [dart fix] detect and report un-enabled lints
Change-Id: Ie113348ae442f93ae2ea49afb2ed1b0305a6da03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256245
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-25 04:23:12 +00:00
pq c0e74c4433 [dart fix] report undefined diagnostics
Fixes: https://github.com/dart-lang/sdk/issues/49699

Change-Id: Ia412e4dce51b0887c3cd0d9b6d91f0ace926bea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-24 20:35:59 +00:00
Danny Tuppeny ece330a700 [analysis_server] Include annotation completions at end of class
Fixes https://github.com/Dart-Code/Dart-Code/issues/3182.

Change-Id: I93d7606cbbf9c527f31dcf9d0fb502dac581abc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256068
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 19:25:39 +00:00
Brian Wilkerson 2b27d3257b Report duplicated field names in record literals
Change-Id: Ifc5c3a06c7f489b00421f5b1af47df52615694d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-24 16:33:49 +00:00
Danny Tuppeny 177147bac3 [analysis_server] Improve handling of document modifications while computing completions
This prevents an issue where typing during completion can cause completion requests to completely fail (returning 0 items) just because snippets couldn't
be computed.

Change-Id: I20fb457a700ec12317d0146b3364e6f1a4f96177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256214
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-24 15:53:00 +00:00
pq 1b2644afd2 [bulk fix] report undefined diagnostics
Change-Id: I4abe1e83c56e632f91a81510ec0a35b521cd11d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-18 16:11:36 +00:00
Konstantin Shcheglov 05d01e79cc Highlight 'required' in SuperFormalParameter.
Change-Id: Ia25378e88eced277bb6242c8cea6bbf09dbb521a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255601
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-08-18 15:56:17 +00:00
pq c4766b319a bulk fix support for specified diagnostics
Change-Id: Ifa98da5466b0efb1b88cfa17d06b6b4e1d4ba8d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-17 17:50:03 +00:00
Sam Rawlins 4fcbbb107a Add CAST_FROM_NULL_ALWAYS_FAILS check
Fixes https://github.com/dart-lang/linter/issues/3605

Change-Id: I5f9a2b127173aa9f2cc6f8fcee9c93e96cb63663
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255149
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-08-16 23:41:02 +00:00
Jens Johansen 8a1dbb160f [parser] Parse record literals
This is the first stab at implementing the record expressions from
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md

Change-Id: I2adb6cb3cd50d4ee45e144e86ec7011d046f6170
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253783
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-16 06:36:36 +00:00
Konstantin Shcheglov 4eb511da43 Replace more Bazel with Blaze, some simplifications.
Change-Id: I096860e17ce56c2f602718f11706f24989c1f65b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-15 19:50:46 +00:00
Konstantin Shcheglov 293c39cfce Add RecordElement, RecordTypeImpl, implement basic subtyping.
Change-Id: I54ac91dfc5a4e01b6f960b865d3d73d11bd0cd84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255040
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-13 00:56:51 +00:00
Brian Wilkerson 33b0180e37 Remove an unused instance getter
Change-Id: I0655a7a3f205dadb555bb8e9f9411e0e08ef68f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254982
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-12 18:55:33 +00:00
Brian Wilkerson dd45694e84 Remove some casts per review comments
Change-Id: I4160cec1524994145d6c0ec25ff4b35ae028a0cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254723
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-12 13:55:58 +00:00
Konstantin Shcheglov 66038b732a Roll latest linter, 304042aaa933a02d2581ab9598dd2ddaebdbc803
Change-Id: I56edf420115793814b162eb779324619332ddb8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-12 02:56:08 +00:00
Brian Wilkerson 5c59f08857 Add more documentation to the server package
Change-Id: Id2413bc1f62ebc8ea42d3cac15adcb871c2cc234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254720
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-11 17:05:38 +00:00
Konstantin Shcheglov 82e33cc598 Add DartType.element2
Unfortunately my idea about checking for specific `DartType` subtype,
and only then asking for the element is too punitive. It almost
works in google3, but the amount and the kind of changes I had to
do make me realize that we should keep `get elementX` in `DartType`.

I guess this is the same as we had in AST when `get constructors`
does not make sense for mixins (?), but works for classes and enums,
and it is easier to pull it into the superclass.

Change-Id: Ibc4fac0b95d63748fa65de96d29300f477fdfc76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254482
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-11 16:01:48 +00:00
Brian Wilkerson 94d797ebee Add a refactor command
The command name is a bit unfortunate in that it isn't very readable for
debugging purposes, but it has the advantage that there isn't any
opportunity for it to get out of sync. That might be the wrong thing to
optimize for. Let me know what you think.

Change-Id: Iec5c2ad9703f51c7702d4d5094f0548b48fbaafd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254321
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-10 22:52:41 +00:00
Sam Rawlins e139fb1527 Tidy some lint issues in analyzer
* Move many identifiers from snake_case or SCREAMING_SNAKE_CASE to
  camelCase. I think I restricted the changes to private API.
* Add an ignore in generated files for constant_identifier_names;
  we often just mirror names found in YAML files or whatever, where
  things are not necessarily named according to Effective Dart
  standards.
* Avoid some implementation imports which I think were accidental.
* Use single quotes in some more places.

Bug: https://github.com/dart-lang/sdk/issues/48784
Change-Id: I439fe50cb9f8f8f5e9c74ce594aea15e394ee7da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-08-10 21:23:21 +00:00
Konstantin Shcheglov f3d919308f Use different marker file to identifier Blaze workspace.
Bug: https://github.com/dart-lang/sdk/issues/49629
Change-Id: I8f1496735373494745a79d502488a217e3c71223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-08-10 19:58:43 +00:00
Danny Tuppeny 61314e9588 [analysis_server] Fix flaky reanalyze tests
Change-Id: If6cef40f3215d6f826d72cad189de2ce5c677718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253661
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-10 18:56:08 +00:00
Konstantin Shcheglov 43065920cc Rename Bazel to Blaze - files, classes, methods.
No changes to implementation yet, we still look for both Blaze and Bazel.

Bug: https://github.com/dart-lang/sdk/issues/49629
Change-Id: Iaf1b1cc2c9a8cf28d8bbfb5541819a1f5c8a3de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-10 16:00:18 +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
Brian Wilkerson 0a1793eb5d Move the tests for legacy refactorings
This reflects the recent change to the implementation classes.

Change-Id: I0867a274c830d34f46c858713f0df511b7b811c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254066
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-09 04:22:42 +00:00
Brian Wilkerson 858b89a10b Update the fix status of a couple of diagnostics
Change-Id: Ia62ee0f45db47895135427e019f1c558dee044fa
Closes: 49616
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254067
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-08-09 04:22:22 +00:00
Konstantin Shcheglov 75b8b916d6 Deprecate ClassOrMixinDeclaration, use ClassDeclaration or MixinDeclaration.
Change-Id: I23e292e9f7c4413edf9b068f057dd02794db21a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-08 21:40:40 +00:00
Brian Wilkerson a4f21c8754 Add a capability for command parameters
Change-Id: Id52b323ebb16fbd90c19ee43704dff03dac92336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
2022-08-08 19:54:21 +00:00
Brian Wilkerson bf4e7ade23 Re-organize the analysis server documentation
This is in preparation for adding new documentation.

Change-Id: Icf77b898d3e0b2c6ae0c71419e70ecd6248c86e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254002
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-08 16:55:30 +00:00
Konstantin Shcheglov 6e57418fd5 Roll latest linter, b677397483251d55ce1aec8d170be7720b53fe26
Change-Id: Ia4495bbf820a7df6ea7f86bbfca76c604a539af3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253903
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-08 04:20:10 +00:00
Brian Wilkerson 60773b9135 Rename two classes
Change-Id: I3fe6f0e4a4f3e8d04994a21c97e608fe8065e5ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253902
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-08 04:11:19 +00:00
Danny Tuppeny 139d150b23 [analysis_server] Remove use of SuggestionSets from LSP
Always use NotImportedContributor.

Change-Id: I3ed518f2d84d10600a5ea27bc88282762573ef2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253784
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-05 17:08:27 +00:00
Danny Tuppeny 30d7a0c5be [analysis_server] Don't re-analyze on watch events for files that have overlays
Existing tests like `test_fileSystem_changeFile_hasOverlay_removeOverlay` verify that removing the overlay correctly re-reads content from disk.

Change-Id: I05660acfe81e35fd4b247d8c7b901903bb67f728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253780
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-05 16:55:37 +00:00
Konstantin Shcheglov 35413ac2b4 Deprecate getType(), use getClass() instead.
Change-Id: I58d25a5449dfc79b1d6a092e58268f7a612d378c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253708
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-08-05 05:25:17 +00:00
pq c9750b2e4b update analysis diagnostics page to look for packageConfig
Change-Id: I60e2e5f247ebf6baff25bbeebbe276cd135beb43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253607
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-08-04 19:54: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
Brian Wilkerson b489c7f22e An initial sketch of the new refactoring support
This is very incomplete at this point, but any feedback, including
feedback about the overall design, is very welcome. I added a
placeholder for a refactoring so that I could see what the design
implies in terms of the difficulty of adding a refactoring.

I expect that specific details will change a fair bit as we start to
write some concrete refactorings, so I'm more interested in problems
with the overall design, but any comments are, of course, welcome.

Change-Id: Id80741b60542bee31fd48a0655ef8650192b58a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253604
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-08-04 17:41:36 +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
Brian Wilkerson 22fe2d2a47 Move the legacy refactoring support into a legacy folder
There were no changes other than to move the files and update the imports
to match.

Change-Id: I0790d9bf7287d62756ad7534b760689489706d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253602
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-08-03 21:37:26 +00:00
Konstantin Shcheglov 528836c4aa Deprecate 'get enums/mixin', use 'get enums2/mixins2'.
Change-Id: I5c7dbb6dcc58537657e429893797b2631733ce16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252871
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-02 21:05:54 +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
Brian Wilkerson 023c6df3b4 Initial draft of a custom LSP protocol for refactoring
Change-Id: Ib7a6b6bd0b2e0dccd8e7b6c117dc284b0e5a95cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253361
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
2022-08-02 15:48:04 +00:00
pq 85d91f95b9 migration to code_style_options
More migrations to code_style_options.

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

Change-Id: I8a2e8459ea9e02b9d65a219dad3ec73080001782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252965
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-01 21:45:34 +00:00
Konstantin Shcheglov 2c54a11c23 Add 'FileResult.isAugmentation' and 'isLibrary'.
Change-Id: I862a21d5abdefce14ad48a1043d90f0a32fc6994
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-08-01 21:07:44 +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 5d64241186 Deprecate Configuration.uriSource, use 'resolvedUri'.
Change-Id: I49bf3458341161173bbd44c2e18931277d6dcd3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-08-01 16:50:44 +00:00
Konstantin Shcheglov fd0d3b2546 Use named parameters for ResultImpl constructors.
Change-Id: I93bc4738259257b2a0326dc259c43693da5754c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253180
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-31 23:00:53 +00:00
Konstantin Shcheglov d5ea4c0fdc Revert "Deprecate ClassElement.isValidMixin"
This reverts commit da31cab154.

Reason for revert: I agree to some extent that this method can be useful.

Original change's description:
> Deprecate ClassElement.isValidMixin
>
> Change-Id: I0cc8245b20e2cbe3c201263207f8570a46d6ab15
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253026
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: Ibee8b6260ff8268f9e9f2f05b54c8256febb19d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253120
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-30 19:48:13 +00:00
Konstantin Shcheglov 5f96a8c7fb Deprecate disjoined 'uriX' properties in favor of 'DirectiveUri'.
Change-Id: I6414f7e0f041a7a4454564195b2582e643f01b7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253024
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-30 19:39:42 +00:00
Konstantin Shcheglov d8d2fbd031 Deprecate ClassElement.hasStaticMember
Change-Id: I29861d36098172b25498db2f0841736358e4b796
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253025
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-30 04:26:21 +00:00
Konstantin Shcheglov da31cab154 Deprecate ClassElement.isValidMixin
Change-Id: I0cc8245b20e2cbe3c201263207f8570a46d6ab15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253026
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-30 00:36:32 +00:00
Brian Wilkerson b7edb69e97 Reorganize the snippets support
Moves multiple classes into their own files. Renames several classes and
the associated test classes. Moves a few of those classes (files) into
the parent directory. Converts snippets to use constructor tear-offs
rather than static method tear-offs.

Change-Id: If1aae3cc468d20ef056e650c0206fcfbf3c94f62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253004
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-29 14:38:41 +00:00
pq 1f02320791 use codestyle options (rather than lint enablement)
Related to: https://github.com/dart-lang/sdk/issues/49558

Change-Id: Iac37649d58be88d7d26db179ac6b48958b0c1701
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-07-29 01:05:51 +00:00
pq 02a8d42261 use-super-parameters when use_super_parameters is enabled
Fixes: https://github.com/dart-lang/sdk/issues/49556

Change-Id: Ia22a4f2734b7dd3affe8984ea41984e5b2c263a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252961
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-29 00:23:31 +00:00
Danny Tuppeny dfe2463517 [analysis_server] Don't include prefixed type names in Outgoing Calls
Change-Id: Ic305706bf8fcb224c757b85379e69afa5ac8d102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-28 18:06:30 +00:00
pq eed97d8778 (conditionally) add trailing commas for wrapping streambuilders
Related to: https://github.com/dart-lang/sdk/issues/49541

Change-Id: Iba6ce96c12838ad23c035aca64dda233803fac32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252866
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-07-27 22:48:39 +00:00
pq 933a3cbaf2 wrap with builder: add trailing comma if require_trailing_commas is enabled
Fixes: https://github.com/dart-lang/sdk/issues/49541

Change-Id: I616919c8f951648431f34646f88abe260af69424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-07-27 21:50:19 +00:00
Sam Rawlins 70e2d3d6e7 [analysis_server] Evaluate a few fixes
* I manually edited the counts. They seemed to have drifted...
* I flipped 4 diagnostics to "noFix" with notes.
* I flipped 9 diagnostics to "needsFix" with notes.

I didn't use a _lot_ of rhyme or reason, or even method to my madness;
I more or less gut-checked each of these.

I also didn't have a lot of rhyme or reason to the ones I picked except
they are alphabetically near each other.

This is sort of an experiment in spending 10 minutes "evaluating"
possible fixes, to get down the huge "needsEvaluation" count.

Change-Id: I32c9f86058c54b97e68f5e9182e3ff827ec4eb48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252783
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2022-07-27 18:55:08 +00:00
Konstantin Shcheglov a8be1c1e0b Deprecate Directive.element, use element2.
Change-Id: Ic18f9c579bcec0b6406070da04b476be2582a504
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-26 18:51:47 +00:00
Sam Rawlins 0cc284a083 Nit tweaks in LSP Analysis Server
Change-Id: I8f1dee82486f357dcfc64294852ea02d23b9e8a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252761
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-26 18:11:37 +00:00
Konstantin Shcheglov 4359108a8b Deprecate ClassOrMixinDeclaration.getField/getMethod
Change-Id: I312a1214b0babb03a3208dcf306753e0d75f77e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252705
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-26 16:54:27 +00:00
Konstantin Shcheglov a31337548e Deprecate ClassDeclaration/ClassTypeAlias.isAbstract
Change-Id: I70fa1714fb31bb611d86054fc4538c01afda6763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2022-07-26 01:51:27 +00:00
Sam Rawlins 7280525117 Implement mustBeOverridden annotation and enforcement
Fixes https://github.com/dart-lang/sdk/issues/30175
Fixes https://github.com/dart-lang/sdk/issues/28250

Change-Id: Id9c62448da9ade81258c2ae2355d05117057a8f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252463
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-07-25 22:17:18 +00:00
Brian Wilkerson 9312ba0abc Fix rename_to_camel_case to handle screaming caps
Change-Id: I04564db1c4f47be18949cf16dcf42230db0da6e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252562
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-07-25 16:08:23 +00:00
Ahmed Ashour 296f114d77 [analysis_server] link failing test to an issue
Part of #49514

Change-Id: Ie74a149b998a5901c6f1ad2a389403165167aa83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252582
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-25 16:00:19 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Brian Wilkerson 56dc3e360a Fix the convert_to_contains fix to remove the second argument
Change-Id: I2da6b71909dd5ecf725714fb51cd075498712c1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-23 14:58:07 +00:00
Ahmed Ashour eefbe1fd14 [analysis_server] add fix for ASSERT_IN_REDIRECTING_CONSTRUCTOR
Fixes #49486

Change-Id: Ic96d2b347578f574eb67b12ef3dbbddcd9c04d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 22:16:06 +00:00
Ahmed Ashour a9ba31a5b2 [analysis_server] add fixes for ABSTRACT_FIELD_INITIALIZER
Fixes #49488

Change-Id: I48caabef2c038b95ef88cad903fdead47b91c615
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252081
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 21:30:26 +00:00
Danny Tuppeny 055774958d [anaysis_server] Cancel in-progress LSP completion requests if another arrives
Change-Id: Idf49b70750a3427529f71e952aa036fae4c7c6cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252422
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 17:40:06 +00:00
Danny Tuppeny 5741f11f7b [analysis_server] Remove unnecessary imports when organizing imports
Change-Id: I7a39a9b07adbacc7d3fd5abb3b165b47668e7938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 15:10:55 +00:00
Danny Tuppeny 71e2aee8a5 [analysis_server] Disallow extract method on all prefixes
Change-Id: I63ecfab4fad63797358dc2cfb7d5cf79ca444dc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252340
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-21 14:57:26 +00:00
Danny Tuppeny 0add39a68e [analysis_server] Skip analysis work when overlays are created if content matches previous content-
May prevent https://github.com/dart-lang/sdk/issues/48051 from occurring since we will no longer call driver.changeFile() for SDK libraries being opened, although it does not resolve the underlying issue.

Change-Id: I5ca53a04842348a584ccc824aaf90ba7f230c002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251980
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-07-20 22:45:15 +00:00
Danny Tuppeny 210af2940f [analysis_server] Fix loss of comments containing newlines when sorting imports
Change-Id: Ie264c16d4ec8254ba0394691625a161598e73f5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 21:23:55 +00:00
Danny Tuppeny 1d49366927 [analysis_server] Simplify ImportOrganizer to use a single range for each directive
This should be a no-op and existing tests pass. This is a step towards extracting code that computes a range for removing/sorting directives that could be used elsewhere such as the RemoveUnusedImport() fix.

Change-Id: Ib43b57bb1e34b817cb3771b60c65ad9ba2fe2919
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252142
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 19:44:35 +00:00
Danny Tuppeny 720f7bea37 [analysis_server] Fix assist test on Windows
Change-Id: I2a85c699140c2fd31ee03524fd2ecac6a0482540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 18:48:45 +00:00
Konstantin Shcheglov 21d0028643 Resolve augmentation import directives in libraries.
Change-Id: I900d262df4b32698e20907a3bb99e88fbee38d3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-20 17:08:58 +00:00
Ahmed Ashour 157e407450 [analysis_server] don't offer fix when the error in "cannot-ignore"
Fixes #49464

Change-Id: I9f9f40e5a47604fa422a223f5c54fef3d045a074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251941
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 17:02:25 +00:00
Danny Tuppeny 019cfb998d [analysis_server] Handle errors from temporary watchers during rebuilds and restart rebuild
Fixes https://github.com/dart-lang/sdk/issues/49286.

Change-Id: Id60111e381f75aaf488dc4b80412242e113f3b59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-20 16:35:34 +00:00
Danny Tuppeny 2c6876aa47 [analysis_server] Fix CompletionBudget to start with the completion request
Change-Id: Iaa9f84394dce36b65a3f5e25dbb381449deb7ea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251981
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-19 18:19:04 +00:00
Ahmed Ashour 5459fc133f [analysis_server] associate DEFAULT_VALUE_ON_REQUIRED_PARAMETER with RemoveDefaultValue
Fixes #47540

Change-Id: I8fa50933f2a7fadf6b11df2b6c385a759f36a8c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-19 17:58:22 +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
Ahmed Ashour 09680ec704 [analysis_server] associate INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD with ChangeTo
Fixes #49058

Change-Id: Ie064f0155269282b6c8fa4208f9881ed307c0421
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251762
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-19 04:57:35 +00:00
Danny Tuppeny 89e9801103 [analysis_server] Fix isIncomplete flag for LSP completion when budget is exhausted
Change-Id: I1cc2ec9e3688383008d0eefc44ec7b94f858c5d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251768
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-18 21:22:05 +00:00
Konstantin Shcheglov e23101a16f Rename to LibraryImportElement, LibraryExportElement.
Change-Id: I0928ca5522d9c67142111a8f3a7eb4d84f114f56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251844
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-18 20:01:18 +00:00
Konstantin Shcheglov eddd4f4427 Renames for FileState kinds / directives.
Change-Id: Ia024eb8922b06a0bdb37321f76a7527dc7e3c117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-18 17:20:33 +00:00
Danny Tuppeny 6bbe04d40f [analysis_server] Set selection/selectionLength for Flutter "Wrap with X" widgets
Fixes https://github.com/Dart-Code/Dart-Code/issues/4061.

Change-Id: I41b54c2641a0eed29e500e1bcc90f9e3945f4f7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251766
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-18 16:28:27 +00:00
Ahmed Ashour e34c84a4fc [analysis_server] associate DEFAULT_VALUE_ON_REQUIRED_PARAMETER with RemoveRequired
Part of #47540

Change-Id: Iff1e81a2809ce045dc6dfb9b9567ad934400308e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251761
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-18 16:05:23 +00:00
Konstantin Shcheglov 2e86c1f018 Deprecate AnalysisDriver.dispose(), use dispose2() instead.
Change-Id: Icfb46bf83f3a1f5828efd76eab1014c4dee0e088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251587
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-15 17:15:40 +00:00
Danny Tuppeny 0482fa6fb3 [analysis_server] Don't 'await' between calling function and using expect(throwsA)
This introduces a race where if the function throws before `expect(throwsA)` adds a handler, it becomes an unhandled exception.

Fixes https://github.com/dart-lang/sdk/issues/49455.

Change-Id: I81205f272c9ec211b99bf73af64dab8e4d774e84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251550
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-15 15:40:40 +00:00
Jaime Wren d61562d765 Extend the LSP Analysis Server support to include the DetachableFileSystemManager support
The DetachableFileSystemManager API also changes slightly with this change resolving a TODO.

Change-Id: I388b352c987e6c96f95fcabd9a532cbfcfa39e4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2022-07-14 21:10:39 +00:00
Danny Tuppeny 0213854523 [analysis_server] Don't provide commit characters on every completion item when enabled
Setting commit characters on the registration is now enough to apply to all items (see https://github.com/microsoft/vscode-languageserver-node/issues/673).

Change-Id: I1133005773e63f563d4e303af60f6c5bb56ec826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251546
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-14 20:11:59 +00:00
Danny Tuppeny 57a3598b2b [analysis_server] Check Call Hierarchy target is still valid before returning calls
Change-Id: I7d915700dd323381adab4d3bd22d5fb384c6de00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-14 14:29:54 +00:00
Danny Tuppeny f34d4d5f93 [analysis_server] Add support for LSP Call Hierarchy
Fixes https://github.com/Dart-Code/Dart-Code/issues/612.

Change-Id: Ic51d4be2340317443b5a1cdae83e6eeaac4fa06b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 18:45:03 +00:00
Danny Tuppeny f0d3e1dd90 [analysis_server] Enable unawaited_futures lint and fix remaining violations
Change-Id: I44b56ba8e1bd9ed5ba3d85006eb5d615e5a2c9d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251461
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 18:40:53 +00:00
Ahmed Ashour b3df7ce795 [analyzer] remove BulkFixProcessor.fixOfTypeInUnit
Fixes #49406

Change-Id: Ib755f918f91ceca1ac4c282e18a9eab9224882e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250746
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 16:05:13 +00:00
Danny Tuppeny 4bafe2233c [analysis_server] Has containerName to Call Hierarchy items
Change-Id: Ic39900ef0ef80b721eae645d1e7e1aa7b5b03661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251266
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 14:22:53 +00:00
Ahmed Ashour 0813000fe4 [analysis_server] associate RemoveAbstract with ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER
Fixes #49365

Change-Id: Ibb0b2b3a0431e6c2770a214045fd94788c85f62b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 14:20:33 +00:00
Ahmed Ashour 565a52571d [analysis_server] associate RemoveInitializer with ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER
Part of #49365

Change-Id: Icf4ef0fb89cbc514587b39bbe10a4d394290499a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250162
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-13 04:50:42 +00:00
Konstantin Shcheglov 210536e46f Use ExportDirectiveState to build LibraryElement.exports2, add ExportElement2.
Change-Id: I29242bb6f9514eccc93b1bef207ecd5b1e558571
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251143
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-13 01:48:34 +00:00
Konstantin Shcheglov e47a2f7705 Fix more unawaited_futures in DAS.
Change-Id: Icb1810a775282ad9c0095ddb35edff3fbcdd160c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251150
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-12 16:34:12 +00:00
Danny Tuppeny b331747f22 [analysis_server] Add codeRange to Call Hierarchy items
Change-Id: If78df6e9eadb3a22cb0334aab37fa53e50b70681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251260
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-12 14:54:44 +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 4640782906 Fix UpdateContentTest integration test.
Change-Id: I82a1989df9f3cb1e551eb403c2099caff087ab01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251148
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-11 23:37:02 +00:00
Danny Tuppeny 2dd3080b37 [analysis_server] Add basic computer for Call Hierarchy
Change-Id: I2f6252596bcfe81fed619999986138cf59fb9f38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-11 22:50:31 +00:00
Danny Tuppeny d887dc8f2e [analysis_server] [lsp] Fix navigation for field/super formal params
Fixes https://github.com/Dart-Code/Dart-Code/issues/4031.

Change-Id: Ic1a6ec5407cf3599bb4b88d5be1ff8c3efe50066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251108
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-11 21:27:31 +00:00
pq 3efd79b4b5 linter 1.26.0
Change-Id: I0a20fd9f26933908f6c40cb1019fca45b9a88299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250949
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-07-11 20:00:21 +00:00
Brian Wilkerson 94e3ddab39 Add documentation about creating an assist
This was copied from quick fixes and then modified, so please also look
for places that I missed updating the text.

Change-Id: Ib67865232e9af2194999553a8007911f1e691fae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251140
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-07-11 18:43:51 +00:00
Konstantin Shcheglov a943d2707b Use ImportDirectiveState to build LibraryElement.imports2, add ImportElement2.
Change-Id: I27a0e87a812eb3733ccfc7b98841c4169dc0a070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250790
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-07-11 16:54:32 +00:00
Danny Tuppeny e26de63f92 [analysis_server] Improve name of completion budget option
Change-Id: I866bbfa624eb63d5e9ecfaa3fe8e1d74e397bab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-11 14:43:31 +00:00
Danny Tuppeny 97fa3ca9fc [analysis_server] Don't extract methods as async if only a nested function expression is async
Fixes https://github.com/Dart-Code/Dart-Code/issues/4053.

Change-Id: I13a76fab9a2e6f9e08bbd736f997b37bf07ae78d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-11 14:42:22 +00:00
Lasse R.H. Nielsen 3fc0bf7e59 Retire the 2.17 language feature experiment flags.
Remove them from tests.
(They should have been removed from tests before launcing 2.17.)

Change-Id: I546f6cb90fdf9e6ed1bb560f3715f9db163b7c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250384
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-07-11 13:02:22 +00:00
Konstantin Shcheglov c481790c50 Add a few await(s) in DAS integration tests.
Change-Id: Iee36f383a3b5b21eab1b6bbd9c59115a4e585567
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-07-09 14:39:09 +00:00
Brian Wilkerson 60a83b80d8 Update the documentation about creating fixes
Change-Id: Ia9f7d4f2b7008ee2684a0eee201c24ef28438857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250941
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-07-08 18:11:29 +00:00
Brian Wilkerson 0634e1fc47 Add priority constants for assists similar to those used for fixes
Change-Id: Id1b4b05b49e90db2fc1ffb6ea32229379152eda1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-07-08 18:11:13 +00:00
Danny Tuppeny e3c055de80 [analysis_server] Add support for using NotImportedConstributor in LSP behind preview flag
Change-Id: I4b7223f5057ede1f97c3209c12a2a50a9ab911bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250845
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-07 20:23:28 +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 d19e1d16b9 Use LibraryFileStateKind to link.
Change-Id: I35a88c71e9cd1c6e05d3de28ecb7c5dabf75defd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-07 18:08:31 +00:00
Danny Tuppeny 0e39bb2d5e [analysis_server] Add additional checks for libraryUri to completion tests
Change-Id: I84e4234b543c1645024c65fc16e577932a6df429
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250840
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-07 16:28:41 +00:00
Danny Tuppeny a8a0ea2ea5 [analysis_server] Simplify resolution of LSP completion items
Change-Id: Iadfe416e3da69cd74c633f8513ee3f1edb3f0499
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-07 16:28:01 +00:00
Ahmed Ashour df1e5cce34 [analysis_server] Add FlutterConvertToStatelessWidget assist
Fixes #46011

Change-Id: I14a4498831ed7d91a2ac1350824f5b7d8d0023c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250087
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-07 16:19:31 +00:00
Danny Tuppeny 83f0bb25a4 [analysis_server] Allow multiple not-imported items in completion if name not already imported
Change-Id: Ie5bfa353d59546518180a08cd4720f793a01ba30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250660
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-06 17:19:40 +00:00
Ahmed Ashour 572f24882f [analyzer_plugin] consistent hashCode for SourceFileEdit
Fixes #49371

Change-Id: I853323df821a9b6481f6fdd190ccecba2c01aa2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250380
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-06 16:03:20 +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
Konstantin Shcheglov a8541852d5 Extract NullableObjectExtension.
Change-Id: I2fe2704d875082d20e1586f924aeebd6653703ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-30 14:25:26 +00:00
Brian Wilkerson fc6a140020 Add an analytics page to the server diagnostic pages
This page is currently disabled, and will likely remain that way until
we allow analytics to be enabled.

Change-Id: I834d3b3eba4f8b690524d7f0955a2bc55418a327
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250101
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
2022-06-28 17:43:24 +00:00
Danny Tuppeny 2e27dd8d0f [analysis_server] [lsp] Handle paths with trailing slashes in didChangeWorkspaceFolders
Fixes https://github.com/dart-lang/sdk/issues/49338.

Change-Id: I054cb896575e0947b840cbb7745a8fdd2d2fb098
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-28 14:29:43 +00:00
Jens Johansen 25dcfca3c2 [parser][CFE][analyzer] Function is builtIn keyword
This CL makes `Function` a builtIn keyword instead of a `pseudo` keyword.

See also (and fixes):
https://github.com/dart-lang/sdk/issues/45703
https://github.com/dart-lang/sdk/issues/45704
https://github.com/dart-lang/sdk/issues/45705
https://github.com/dart-lang/sdk/issues/49197

This undoes https://dart-review.googlesource.com/c/sdk/+/195761

This is ~a merge of https://dart-review.googlesource.com/c/sdk/+/195906
and https://dart-review.googlesource.com/c/sdk/+/200080

Change-Id: I8bfee6976d43819fa355de99b3b2429eb67a7cdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249484
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-06-28 14:26:33 +00:00
Brian Wilkerson 9f97ab9602 Restructure analytics support
I wanted to be able to plug in different kinds of analytics reporters,
and that's still a goal, but with the desire to make it possible for
users to see what data we are collecting I needed to change the level
at which reporters are plugged in.

This CL doesn't change the behavior of the code, but it does split the
classes out into separate files and collapse the AnalyticsManager class
and its subclasses into a single class, requiring that different
reporters be implemented by implementing the Analytics class instead.

Change-Id: Ia98ff225f97ae747d89c61fe98f520ce0b5e9961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249943
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-27 21:19:32 +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
Ahmed Ashour 9f5942df4c [analysis_server] fix RemoveUnnecessaryParentheses with space
Fixes #49343

Change-Id: I7b55f45d624197f75110759f9b507bbe9157c40d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249861
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-27 18:24:22 +00:00
Devon Carew cb5b66f694 [analysis_server] minor cleanups to analysis server spec generation
Change-Id: I9fd780fb627eaab24731d426e5a0f51b9608f189
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249734
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-27 17:21:02 +00:00
Konstantin Shcheglov 78bb59655a Use getFileSync() in ExecutionMapUriHandler instead of FileSystemState.
We don't need to go so low.

Change-Id: Ifbb02e60038c545bc43ebb4f7a344f1fde014fc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249941
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-27 17:05:02 +00:00
Ahmed Ashour 09ec1743fe [analyzer] fix method name for concrete_class_with_abstract_member
Fixes #49334

Change-Id: Idd47028064e4c98d693e7b9d831322a2c6c628ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249614
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-27 15:11:02 +00:00
Devon Carew 057d0baaf9 Add a lightweight parser for the analyzer spec (remove sdk deps on package:html).
Change-Id: Ia8776c8aea845a7dde089d5ac9f3dab82e984f4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-25 00:34:40 +00:00
Ahmed Ashour a573cb847b [analysis_server] ConvertIntoBlockBody to fix ENUM_WITH_ABSTRACT_MEMBER
Fixes #48478

Change-Id: I186f7b06e497a1b79d77fd1844488ae4302b5ba7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249612
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-24 21:16:00 +00:00
Ahmed Ashour c979aa71d8 [analysis_server] ReplaceFinalWithConst to handle unnecessary const
Fixes #49295

Change-Id: I6974c370e14d16ce5b38471bad7c0d8e86ac6062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249581
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-24 19:31:23 +00:00
Konstantin Shcheglov 33822c4caa Use LibraryAnalyzer from AnalysisDriver in Cider.
Change-Id: I5fd1edba5c2c62a92ed6bc84099839ab98b17063
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-24 15:53:39 +00:00
Ahmed Ashour dc58725d4e [analysis_server] MakeFinal to handle the lint at token
Part of #49317

Change-Id: I616ca93bb5061ded835b4dc0938446a402fd76e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249584
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-23 16:51:55 +00:00
Danny Tuppeny 23f1c542e4 [analysis_server] Disallow Extract Method on nullable type names and import prefixes
Fixes https://github.com/Dart-Code/Dart-Code/issues/4029 (and maybe https://github.com/dart-lang/sdk/issues/48824).

Change-Id: I52a975a830733062dacdf72f06418f4b67d3318b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249600
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-23 16:04:55 +00:00
Ahmed Ashour f9984c267b Add quick fix for UNNECESSARY_FINAL
Fixes #48778

Change-Id: I86b0b8344768db9653c16507a88d4f454dc86ed6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-23 15:39:15 +00:00
Brian Wilkerson 2e77fe796a Capture severity adjustments in analytics
Change-Id: I10d3d878c70d7acf2773db2a4c1b01293892dc4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249543
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-23 15:28:20 +00:00
Danny Tuppeny 8596955593 [analysis_server] Fix+refactor code actions tests
Change-Id: I2835f5b01de915edf24fa05d28109f7613bd212f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-23 14:54:15 +00:00
Danny Tuppeny 14796fafa8 [analysis_server] [lsp] Fix resolving completions with no insertText and stop using insertText entirely
Fixes https://github.com/Dart-Code/Dart-Code/issues/4027.

Change-Id: I60d4e9aabdd125771cd8f3e9f63367cf21eea5fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249489
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 17:03:35 +00:00
Danny Tuppeny d6215b7eb0 [analysis_server] [LSP] Prevent Getter<->Method refactors showing in invalid places
Fixes https://github.com/Dart-Code/Dart-Code/issues/4000.

Change-Id: I3b0b39b871b2d7176a1cbbe73064fce2586813ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249482
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 15:30:34 +00:00
Danny Tuppeny 77bf07a87f [analysis_server] Rename LSP Pattern alias to not conflict with Dart Pattern type
Change-Id: Ib3178eb2fd3f3e2d41844d5fb492775da7e3171a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249487
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-22 14:05:24 +00:00
Konstantin Shcheglov 16796fbbe0 Extract AnalyzerStatePrinter to prepare for using it in AnalysisDriver tests.
Change-Id: Ia788c2f9dcc537ce4631e4c2ab62f3f11f0602b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-21 21:59:36 +00:00
Brian Wilkerson 3b01def1a6 Add hooks for and start gathering some analysis context dependent analytics
Change-Id: I6d428c1bd55aae060a09b7cc039b92df38d09d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249380
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-21 19:47:24 +00:00
Keerti Parthasarathy 338d8299ef Modifiy remove/add mutliple parameters test to capture case where there is no trailing comma.
Change-Id: Icc3eb54ee1202ca22e187a2dc7e992cd02a56e94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2022-06-21 17:04:14 +00:00
Konstantin Shcheglov e78399ac52 Issue 23067. Report HintCode.DEPRECATED_EXPORT_USE
It found a few cases for `BytesBuilder` exported from `dart:io`.
I fixed most of them in a separate CL.

But package:flutter (itself only) is clean.

There are a few violations in google3.
I will ignore most of them, and fix a few.

Bug: https://github.com/dart-lang/sdk/issues/23067
Change-Id: Ic89370ad84caa60fd49326c2bc60ad5d927e2264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-06-18 18:17:40 +00:00
Ahmed Ashour a60df664b3 [analyzer] Add a quick fix for avoid_renaming_method_parameters
Fixes #47126

Change-Id: Ic9ee97174504cf8e0c6a5fcc3224849c870714c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-17 16:16:59 +00:00
Danny Tuppeny cd43f3d08c [analysis_server] Use generated typedefs for LSP code
Change-Id: I242413db35b22d01965aa8ecf9851e47982ea41d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 22:02:00 +00:00
Konstantin Shcheglov 2ff7c7aa25 Make 'isGenerated' required, use it, remove 'from' constructor.
Change-Id: I470e0c02e75c65c73f57f3a6b5b1873fc0a8df4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 19:21:17 +00:00
Konstantin Shcheglov 31c49c4fd8 Use FileState from AnalysisDriver in Cider.
Change-Id: I3f6dc6f80845d24e555328d25f8355eb11e51883
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248709
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 17:48:49 +00:00
Danny Tuppeny a2f9ad4ba7 [analysis_server] Tweak navigation regions/targets for named constructors
+ fix an issue with constructor declarations not returning any matches at all for LSP which provides an offset.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4020.

Change-Id: Id59c83e32630c4ab947e3c3062b55989c78d1c61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248581
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 17:47:59 +00:00
Sam Rawlins 567b45fb1d Add the enable-experiment flag back to DAS
Bug: https://github.com/dart-lang/sdk/issues/48960
Change-Id: I6576f45e63e28902986db844df49a06a71385704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245202
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-06-16 16:26:39 +00:00
Danny Tuppeny 341b60796a [analysis_server] Generate typedefs for LSP params/result unions
Many params/result types are defined as unions without names in the spec. This gives them names so the handlers will be able to use names instead of the full EitherX<Y> type.

Change-Id: I3f96b48e5e70c86814724edc3fec4fc7f76534de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248801
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 16:11:21 +00:00
Danny Tuppeny b46a2d3039 [analysis_server] Preserve type aliases from the LSP spec as typedefs in generated code
+ improve the use of LSPAny/LSPObject where

LSPAny = anything, including null or undefined
LSPObject = any object (equiv of non-null Map<String, Object?>)

Change-Id: I335b299aad8e58b1cb4ee33cf27dc0dd887ec916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-16 14:15:41 +00:00
Danny Tuppeny 8038192b9d [analysis_server] Fix names of canParse functions for nested generics
Change-Id: I4f641d8cb4cc2aadfd38c5fc0b06fd11445c4165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248587
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 19:29:48 +00:00
pq d2e006eefa quick-fix to wrap in unawaited
Fixes: https://github.com/dart-lang/sdk/issues/49262

See also: https://github.com/dart-lang/linter/issues/3429

Change-Id: I0d3bf6c72ae1cf3e08f50b4deda10aba52e25eb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-06-15 18:03:08 +00:00
Brian Wilkerson c44bb947eb Capture initializationOptions from initialize
Change-Id: Ib9bf4361b97d284e5e1f96edc2c4540a0551b349
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248340
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 16:37:49 +00:00
Konstantin Shcheglov 0aed38d52a Make ByteStore similar to CiderByteStore and switch Cider to it.
Change-Id: Ic05df27da094fdd5671eb45d66ab3533b0f0d844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248445
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-15 16:05:34 +00:00
Danny Tuppeny e787255915 [analysis_server] Remove unused type args in LSP interfaces
The new JSON model doesn't have/support type args (the original Markdown/TS spec had one instance where the type arg added no value) so this cleans up the code slightly.

Change-Id: I773d2acb38f95d78d2d5f73e1c9bd39468fbcad8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 16:00:01 +00:00
Danny Tuppeny 28d5347d8e [analysis_server] Allow running server from source in tests with an env variable
Change-Id: I70b974b094b6d6c87831a80245a0c741abb12d40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248584
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 15:57:32 +00:00
Ahmed Ashour 07f7e455fa [analysis_server] use single function per type for canParse
Fixes #49229

Change-Id: I87d2dea79f8786b826162d132a63c69a2ebaba67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248009
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 14:31:38 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Keerti Parthasarathy 744d14470a Fix a bug when replacing a single parameter with multiple in Flutter code.
Change-Id: I87c2fdbe5e74a725463942693016e83da952718c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2022-06-15 06:12:58 +00:00
pq 08d6d8f88d add quick-fix for discarded_futures
See: https://github.com/dart-lang/linter/issues/2923

Also: https://github.com/dart-lang/sdk/issues/49262

Change-Id: I57336d792b91b5bfaf8bcf4e28d8d592716b3999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248444
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 21:48:16 +00:00
Danny Tuppeny 7df87288d8 [analysis_server] Update + simplify LSP methods table
Change-Id: Ia89e4bf2b65effe7ea98bd0081873f6a749eade6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248145
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 17:28:32 +00:00
Danny Tuppeny 40e25ebad0 [analysis_server] Always provide textEdit for LSP completions
Not providing textEdit means that the client will use insertText and compute its own range for what needs to be replaced. This may be incorrect if the name includes symbols that VS Code doesn't realise are part of the identifier.

To fix this, we should _always_ supply the range. This will result in a slightly larger payload, although an upcoming change to use itemDefaults will remove that for supporting clients.

Fixes https://github.com/Dart-Code/Dart-Code/issues/3943.

Change-Id: Ifd3f38ef96fecc6c745e00f511eb0bdbbd0d4a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248143
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 16:00:47 +00:00
Danny Tuppeny d6e5a0fc49 [analysis_server] Support Flutter's "wrap" assists in variable declarations
See https://github.com/emacs-lsp/lsp-dart/issues/141.

Change-Id: Ib5f3cbcf67ad70582ff257900f35beac61746380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248125
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-14 14:11:47 +00:00
Devon Carew 295898343a [pkg/analysis_server] remove some references to package:html
Change-Id: I5995c1281103e632bd98e180929cb170b2a87ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-06-13 20:00:28 +00:00
Brian Wilkerson d876b2b48d Prepare to collect data about workspace folders
Let me know if there are other parameters that we should collect
information about. I thought about open/close, to correspond to the
number of priority files tracked for the legacy protocol, but I thought
it would be too noisy. Happy to discuss if you think otherwise.

Change-Id: Id1b8bc043052570c706dc19ea31c33c2b19177ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247480
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-13 15:23:49 +00:00
Phil Quitslund 9a48d1b82f Reland "[data driven] support moving symbols across packages"
This reverts commit f111a2df54.

Reason for revert: this change was mistakenly associated w/ a windows bot breakage (https://github.com/flutter/flutter/issues/105641)

Original change's description:
> Revert "[data driven] support moving symbols across packages"
>
> This reverts commit 3290d7a137.
>
> Reason for revert: flutter engine breakage (https://github.com/flutter/flutter/issues/105641)
>
> Original change's description:
> > [data driven] support moving symbols across packages
> >
> > See: https://github.com/dart-lang/sdk/issues/48997
> >
> > Change-Id: Iad16b9eae0523bc4bc14537af642b05efa75b6f7
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246663
> > Commit-Queue: Phil Quitslund <pquitslund@google.com>
> > Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Change-Id: I4a83d50497d6208b7f518ca1b381ece3aab192ad
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247606
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Keerti Parthasarathy <keertip@google.com>
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

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

Change-Id: I769dec0d85fc0a41048b21deec0724d8509ef8e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2022-06-13 14:45:06 +00:00
Konstantin Shcheglov 1b9554d481 Add 'textToMatchOverride' for 'setState' completion.
Bug: https://github.com/dart-lang/sdk/issues/49233
Change-Id: I74fd86fc7f49c932e6698e474842078ff823f3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247933
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-13 00:54:16 +00:00
Ahmed Ashour 503e7232ab [analysis_server] have a single function for union
Bug: #49229
Change-Id: I6141c48e48fbe88812c10d7fcc3541af28ec36c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247966
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:31:57 +00:00
Ahmed Ashour 57b192f3a6 [analyzer] RemoveTypeAnnotation to handle type arguments
Fixes #49227

Change-Id: I0f754d84e3e4e89800abdec26925229587202bca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247968
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:24:06 +00:00
Ahmed Ashour 4ecc7ff67e [analysis_server] AddAwait to handle NON_BOOL_CONDITION
Fixes #49114

Change-Id: Id6b345a946ec124e4518c7bb526c510ae0cb92c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-12 17:23:55 +00:00
Ahmed Ashour 8bb3a10e40 Fix typos
Fixes #49228

TEST=ci

Change-Id: Idcc625554bcf07807bae9791ea37b73ae9394b87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-10 15:48:54 +00:00
Konstantin Shcheglov c5e725578a Revert "Add AnalysisDriver.contextRoot, deprecate configure()."
This reverts commit 3b111d5e0d.

Reason for revert: Wrong design, will rework.

Original change's description:
> Add AnalysisDriver.contextRoot, deprecate configure().
>
> In the future AnalysisDriver.analysisContext will be removed, and
> AnalysisDriver will implement AnalysisContext. At the same time we
> will remove DriverBasedAnalysisContext.
>
> Google3 looks green.
> https://fusion2.corp.google.com/presubmit/tap/453818030
>
> Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

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

Change-Id: I2eb567c6343636d3affd48bb4bfb0b4b1aa788b6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247861
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-06-09 20:53:03 +00:00
Ahmed Ashour eda47496d7 [analysis_server] Removing ignoring hash_and_equals lint
Bug: #48785
Change-Id: I9007eb2388adac3f5f33ae81346e4bc0485a405f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247556
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2022-06-09 19:36:43 +00:00
Ahmed Ashour a3d8800c9d [analyzer] ChangeTo to handle SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED
Fixes #48480

Change-Id: I234ccb0cd170a78f5686048a294536d434e84eb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 19:20:13 +00:00
Daco Harkes a855030120 [vm/ffi] Allow struct nesting with looser packing
C compilers don't enforce nesting rules. `dart:ffi` was enforcing these
rules causing issues for binding to C libraries having looser packing
for nested structs than outer structs.

This CL completely removes the error from the analyzer and CFE.
(As an alternative we could have kept a hint/lint, but this might create
more noise than value.)

TEST=pkg/analyzer/test/src/diagnostics/packed_nesting_non_packed_test.dart

Closes: https://github.com/dart-lang/sdk/issues/46644
Change-Id: Iae2d5c885546f7799bc6dea2f8cd7dd508216a0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247382
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 19:08:43 +00:00
Ahmed Ashour e11d6b4a62 [analysis_server] simplify generated equals
Fixes #49222

Change-Id: I430ff02a4721d7d937b701bf0137096f314a6860
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247557
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 18:30:33 +00:00
Ahmed Ashour e86635968d [analyzer] AddNullCheck to handle non nullable target
Fixes #49152

Change-Id: I010755baa441a213f927a963972fed108f861baf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247555
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 17:44:03 +00:00
Konstantin Shcheglov 3b111d5e0d Add AnalysisDriver.contextRoot, deprecate configure().
In the future AnalysisDriver.analysisContext will be removed, and
AnalysisDriver will implement AnalysisContext. At the same time we
will remove DriverBasedAnalysisContext.

Google3 looks green.
https://fusion2.corp.google.com/presubmit/tap/453818030

Change-Id: Iaa6bf85e27c3be5d0ecb40126d6b857fe6f2aa64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247626
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-06-09 17:24:14 +00:00
Danny Tuppeny 5b3bfe4137 [analysis_server] Add snippet for function definitions
Fixes https://github.com/Dart-Code/Dart-Code/issues/4017.

Change-Id: I1017be3abe73a8cfcd6354f1c2ca99ad729dcf47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247553
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-09 16:07:43 +00:00
Danny Tuppeny a5d2b9156e [analysis_server] Enable updating imports for folder renames via LSP
Change-Id: Idbc1745570f19e372eee17089ebdc7db0d0b4fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247548
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 21:57:19 +00:00
Phil Quitslund f111a2df54 Revert "[data driven] support moving symbols across packages"
This reverts commit 3290d7a137.

Reason for revert: flutter engine breakage (https://github.com/flutter/flutter/issues/105641)

Original change's description:
> [data driven] support moving symbols across packages
>
> See: https://github.com/dart-lang/sdk/issues/48997
>
> Change-Id: Iad16b9eae0523bc4bc14537af642b05efa75b6f7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246663
> Commit-Queue: Phil Quitslund <pquitslund@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

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

Change-Id: I4a83d50497d6208b7f518ca1b381ece3aab192ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247606
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 21:35:22 +00:00
Devon Carew ca205612d6 [deps] remove the dep on package:charcode
Change-Id: I0880f16db5bf62e6e7c91352c2f8e57f66ad7022
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247500
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-08 19:49:22 +00:00
Janice Collins e63e4937e9 Add a fix for HintCode.UNUSED_ELEMENT_PARAMETER.
This repurposes an existing lint CorrectionProducer to handle both
the lint and the hint.

Bug: https://github.com/dart-lang/sdk/issues/49074
Change-Id: Iacd597ca2151cdb80be9ddae0847128b4cc700a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246989
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2022-06-08 16:57:02 +00:00
Danny Tuppeny 88c2f888ea [analysis_server] Support dart.updateImportsOnRename setting for updating directives on renames
This setting is already supported in VS Code but accidentally stopped working in the switch to LSP. This change prevents/removes the registration for willRenameFiles so that a client won't call the server when files are renamed if this setting is `false`.

Change-Id: Ia7b22b9fc2f119d0e7f98f4e2c5f0bac994a28af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247544
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 16:06:52 +00:00
Danny Tuppeny 8b40a7bb2a [analysis_server] Make Sort Members + Organize Imports fail silently if invoked automatically
Previously, Organise Imports always failed silently (since it was often run on-save). Sort Members had not been given the same treatment (but often now runs on-save).

This uses a new LSP 3.17 field to know when the command was run automatically, so both are now consistent, showing errors if invoked manually and failing silently if run automatically.

Change-Id: I48e8380fcee4e54d0f4dc3c177c9ae2362627efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247542
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 14:11:42 +00:00
Danny Tuppeny 1861eac395 [analysis_server] Fix an edit conflict renaming folders containing files that reference siblings
Renaming a folder with files that referenced each other would fail with edit conflicts. The pass over the first file would update the reference to the other (going from "a.dart" to "../old/a.dart" as if the other file wasn't moving too) and then then when processing the second file, it would try to update the import back.

It doesn't seem to ever make sense to update relative paths when the "other" file is also in the folder being renamed, so this skips them.

Change-Id: I14c09977aa66017eecac5922d0e3caacf59350fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247541
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-08 14:07:25 +00:00
Alexandre Ardhuin 473dbf17b6 add UNDEFINED_EXTENSION_GETTER to bulk fix
Following up on #49164 this PR allows rename in extensions via `dart fix`

Closes https://github.com/dart-lang/sdk/pull/49200

GitOrigin-RevId: a5af8d05f4d9bf849e8115cc780b17bce18d0d50
Change-Id: I845848901768ff48746a0438b009f631c5d03a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247460
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-07 20:27:41 +00:00
pq a362115c60 bump to linter 1.25.0
Change-Id: Ie709139029d1f58cef4807708ff054acb0fba6cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247363
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-07 17:59:29 +00:00
Danny Tuppeny 03d51e1f89 [analysis_server] Switch to using Maps for LSP command arguments
This makes it easier to extend commands in future (for example adding additional args to indicate if the command execution was automatic on-save or manually invoked, to adjust error handling).

Change-Id: I274f28109ebc0d93ed555525b4c8d1ee689b2af1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247385
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-07 15:52:15 +00:00
Brian Wilkerson 9e8132da51 Prepare to gather analytics about the number of analysis roots and priority files and the kinds of refactorings
Let me know if there are other values you can think of related to
requests that ought to be captured, especially in LSP.

Change-Id: Id9e92f54dd9ade3541d3ca8dc11450fb6affee0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247328
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
2022-06-07 13:37:18 +00:00
Danny Tuppeny 225291c803 [analysis_server] Improve naming of LSP codegen types
Change-Id: I51f97c5a7bfdbc1fb420c7d59855efd2f9f4b2f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-06-06 19:53:48 +00:00