Commit Graph

1881 Commits

Author SHA1 Message Date
Parker Lougheed 691ae80cd5 [analysis_server] Allow rethrow partial completion in catch clause
Fixes https://github.com/dart-lang/sdk/issues/54384

Bug: https://github.com/dart-lang/sdk/issues/54384
Change-Id: Id86f0e1b71d27921054e11f2fcbb8bb952f8161e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-12-18 17:20:27 +00:00
Brian Wilkerson ae15831811 [code completion] Move completion generation for initializing and super parameters
Change-Id: Ie9d09b323c7072c4fe375b6de12347a16065ac5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341823
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-12-15 17:41:32 +00:00
Brian Wilkerson d45080d365 Remove support for the older legacy completion protocol
This does not remove the computation of available declarations. This CL
seemed big enough without that, so I (or someone else) can get that in
the next CL.

Change-Id: I67ab49b75c8a415ccfaef16c4e49a00026a6091f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-12-12 00:54:48 +00:00
Brian Wilkerson 14a836f6f6 Move the generation of imported elements to the in-scope completion pass
Sorry for the long CL; once again I couldn't find a reasonable way to
split it up into smaller pieces.

This CL causes all of the elements from imports to be generated by the
new approach.

It does contain a new flag that is used to preserve the current
semantics when computing completions for Cider. I hope to be able to
make the new approach efficient enough that we can remove this flag,
but I can't realistically do that until more of the approach is
implemented.

I'm also not fond of the way it fails to handle conflicts in the import
scope. There's a TODO marking the places that would need to be changed,
but the current behavior is that if the same name N is imported from
two or more imports and they refer to different elements, the first one
found will be suggested and others won't. I don't think we want to
suggest any of them unless we also fix the imports so that the name
won't be conflicting. I'm not sure how we want to do that, but it needs
to work with whatever optimization approach we choose.

I think the changes to the tests are all positive, but please double
check that I haven't missed a good reason for the previous behavior.

Change-Id: I70d4514a67988f654984ac20f33b2d7a3cfc78e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340282
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-12-08 22:17:38 +00:00
pq a354347178 Add PubWorkspacePackage.sdkVersionConstraint.
See: https://github.com/dart-lang/sdk/issues/54043.

In a follow-up, we'll:

* deprecate `AnalysisOptions.sdkVersionConstraint` and
* update all callers to use `PubWorkspacePackage`

Change-Id: Ie24861d50168de79e6a6db511887aea5148987f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340021
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-12-06 20:41:13 +00:00
Brian Wilkerson 0915f6e053 Remove the tests related to the deprecated completion protocol
I left the mixin structure because Danny and I plan to use the same
structure to start adding LSP-specific test coverage.

Change-Id: I2eefc05c01eadb67f2c95fcaed3e5a963df7d69b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-30 05:27:39 +00:00
Daco Harkes 019efc9c65 [analyzer] Add dart:typed_data to mock sdk
Split off https://dart-review.googlesource.com/c/sdk/+/338620 which
starts testing FFI analyzer logic that uses Typed Data objects.

Change-Id: I65f98a0f0074b9eaedf7dd6fb0dee57532d41d71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-11-29 18:03:52 +00:00
Brian Wilkerson 3641fc33d6 Suggest local declarations in new framework
Sorry for the length of the CL. I couldn't really think of a good way
to split it up further.

The first pass was previously suggesting everything declared in scopes
below the class level. This CL expands that to include everything
declared in the current library. It does not include imported
declarations. It also doesn't yet handle members suggested after a
period. Those are both being handled by constributors.

Please look over the tests carefully. There are more changes than I
would have liked, although I think they're mostly for the better (as
in, the suggestions are more accurate), but I could easily have
missed an invalid change.

Change-Id: I98b3cfc8440ee5da09a8e6828c946d65d8d77759
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338482
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-11-28 21:48:28 +00:00
Danny Tuppeny 07d40a0210 [analysis_server] Fix Rename+References for forElements outside of blocks
Fixes https://github.com/Dart-Code/Dart-Code/issues/4849

Change-Id: Iceeeab549235622d4fe8c5c129c754cea53012b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337741
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-28 21:23:39 +00:00
Danny Tuppeny 7d3020f14f [analysis_server] Handle snippet completions correctly in return statements
Fixes https://github.com/Dart-Code/Dart-Code/issues/4843

Change-Id: I59c41c2ef6439583465a729785fe379c03583cce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-11-27 19:28:09 +00:00
Parker Lougheed 9e328d4af3 [analysis_server] Do not suggest Type instance methods on extension static member access
Fixes https://github.com/dart-lang/sdk/issues/52962

Bug: https://github.com/dart-lang/sdk/issues/52962
Change-Id: I516050aa3592a33a7710dc13d79cd6e4b0208b8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337420
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-11-21 00:24:16 +00:00
Brian Wilkerson d86a114d49 Move the generation of type parameter suggestions
Change-Id: I3ab850747ab9c12360ffcccd80120b7723af8420
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336840
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-17 17:26:38 +00:00
pq 07c77f59a2 Final todo updated format fixes
This should tidy up the last ones. 🤞

Sorry for the noise!

Change-Id: I7104fc33282184acb0c843eae6e73f6fcc77d892
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336723
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-11-16 20:18:32 +00:00
Brian Wilkerson c7458baa7a Add tests of shadowing in code completion
I'm fairly sure the failing tests are recent breakages. I was only able
to break it without noticing because we didn't have adequate testing.

The next CL should fix the tests.

Change-Id: I69f5fde6e7cd2e872b2ffab38905467d366caa9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336625
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-11-16 17:45:09 +00:00
Konstantin Shcheglov 444ad4daae Include 'localVariableDistance' feature into relevance.
Bug: https://discord.com/channels/608014603317936148/1174045252164796566/1174149206571753594
Change-Id: Id3aed7cc67194a5efdbfbf1851c132b8e7b933e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336320
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-15 17:08:10 +00:00
Konstantin Shcheglov 0fa6a6b8b7 Set 'CompilationUnit.declaredElement' when resolve for completion.
Change-Id: I8cb475af4400380c8859c1d1ae179a3db3a3850f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336241
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-15 02:57:59 +00:00
Danny Tuppeny 4dddc98fc6 [analysis_server] Include 'required' keyword in closure completion text
This adds missing 'required' keywords when completing closures. The keyword is only added to the completion text and not the displayed label because there's limited space for completions and seeing the end of the completion (for example `=>` vs `{}` is more useful.

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

Change-Id: I3cb791bcd84533e9bc3819d8a527233f026849bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336021
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-14 22:38:39 +00:00
pq 440ea59ee0 enable flutter_style_todos in server
Change-Id: I4921d538e1498e66c8cab2d84dfcad21d1a7b555
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335952
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-14 21:08:12 +00:00
Sam Rawlins 73ab31b98a analyzer: Move the Source class to be public API.
Deprecate accessing LineInfo, Source, or SourceRange via the
old library (pkg/analyzer/lib/src/generated/source.dart).
Migrate all SDK code to the new library.

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

Change-Id: Ic7c98a5820415c92a457f9fa2756351b05520cd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-14 17:10:37 +00:00
Konstantin Shcheglov e0b7d929a9 De-duplicate Posix path access implementation.
Change-Id: Ie97dd395c3f760881b38a9045be167b9d21eff0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335905
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-11-13 20:17:11 +00:00
Brian Wilkerson 57ece5b452 Move generation of suggestions for methods and fields
Change-Id: I84b95c465fc11338326f4591aadae9baac6a2779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-06 21:20:54 +00:00
Danny Tuppeny 29c4b557eb [analysis_server] Migrate all remaining tests using legacy marker functions
+ remove legacy functions

Some of these tests still use `indexOf` to find positions (like `rangeAtSearch`) that could perhaps be changed to use ranges marked in the code too, however I'm not sure if that'll make them more readable and this CL ended up already being a little larger than originally planned.

Change-Id: If23b712134171c9d716aa0585045489d109fb39a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333923
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-06 17:58:56 +00:00
Danny Tuppeny d1a1a273ee [analysis_server] Migrate some LSP tests off old marker functions
No functional changes, just moves the snippets tests and a few others off the old marker functions to the new TestCode class for consistency.

With this change, there are approximately 15 remaining instances of "withoutMarkers" to remove (inc. the declaration).

Change-Id: I7f11992bb9ce47740adf6972ed097cabbd011607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-02 16:18:01 +00:00
Brian Wilkerson 8de066a4b0 Share the visibility tracker and suggest local functions
Sharing the visibility tracker this way prevents shadowed elements from
being suggested and improves performance.

Most of these changes can be reverted once the local reference
contributor has been removed.

Change-Id: Ib156ae56455e8d85a31163f9e59ce4dd93f5920b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-01 16:21:19 +00:00
Konstantin Shcheglov 49ef0be2bc Add ElementKind.MIXIN, use it for MixinElement.
Change-Id: Ie95c6c331ff437c4d6b99bfc7f9a3109f47c985b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332460
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-26 18:27:39 +00:00
Brian Wilkerson 3659b3e585 Recover from exension type declarations with no representation field
Change-Id: I2fdd0c281ba8a8458248d00b91a0cb1abfed02da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331749
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-10-24 23:27:59 +00:00
Danny Tuppeny ae78a3d8e5 [analysis_server] Don't show private static members in completion outside of library
Fixes https://github.com/Dart-Code/Dart-Code/issues/4772

Change-Id: I5a033b7464c2325f4f5db309254392e0ec337d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329605
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-10-23 17:06:18 +00:00
Brian Wilkerson de04e693c9 Convert (and move) some older style completion tests
I found the old style of tests difficult to read and even harder to
debug, so I decided to convert them. Fortunately, a small conversion
program did most of the work.

I didn't change the actual test code except in a couple of places where
the tests were failing because the test code produced diagnostics beyond
those expected for incomplete code (such as unreferenced variables).

As much as possible I kept the original pass/fail sense of the test.
There were a few tests that were failing because the expectations were
just wrong, so in those cases I allowed the test to pass with the right
expectations. I tried to verify the expectations of the tests, but I'm
sure I missed some.

Change-Id: I80b7f914e75012562d3423cc6eb242bb8be11cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331215
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 20:32:29 +00:00
Brian Wilkerson 7da4e0b9e8 Complete in the representation field
Change-Id: I6906296b57c2cdd516ecc045ee78d74b4493e217
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331096
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-19 21:08:32 +00:00
Brian Wilkerson 67e888113b Code complete inside an extension type
Change-Id: I293d1379561abdce3816dccaa6dfde867e0ed9ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330998
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-19 14:04:51 +00:00
Danny Tuppeny 646b515d76 [analysis_server] Fix "switch expression" snippet showing up in wrong places
Fixes https://github.com/Dart-Code/Dart-Code/issues/4795

Change-Id: I6f74f538f91cc62cc8ae3ca2cfef4f77cccbc636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330425
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-10-16 20:51:45 +00:00
Brian Wilkerson 4603900569 Stop using multiple test case mixins in test classes
We found cases where two or more of the mixins defined methods with the
same name, which resulted in some tests not being run. This fixes that.

Change-Id: Ie752e1c9287633990652a965949df602086e07ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330162
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-12 17:54:17 +00:00
Danny Tuppeny 209483da72 [analysis_server] Don't disallow extracting local variables matching argument names
Fixes https://github.com/Dart-Code/Dart-Code/issues/4787

Change-Id: Idbd54e55599cf3cb34f504e4aad40018b70dfe78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330109
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-11 17:37:43 +00:00
Brian Wilkerson bbd8c88862 Move local variable generation to the in-scope completion pass
Change-Id: If43972bc58a52664d7c70d37d1a0b25a494dbec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330022
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-11 14:47:28 +00:00
Danny Tuppeny 09f3eb0c8b [analysis_server] Support renaming multiple files in a single operation
We already supported moving a single folder, which we expanded to each file inside it. This adds support for moving multiple distinct items at the same time (eg. dragging multiple files).

To support this, we need to track a full mapping of source/destination paths (because files might be moved from different levels into the same level - we can't compute destination paths from a single `newFile` variable), and also build a unique set of references that need updating (rather than building edits as we go - where we might try to edit the same reference from both ends).

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

This is currently only supported for LSP.

Change-Id: I3a8ab8b2dcb13451111d38d2ec0e2f69d6084e28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-11 03:56:29 +00:00
Danny Tuppeny cf78037c5b [analysis_server] Change default leading/trailing behaviour for replaceSourceIndent
Makes behaviour of changing leading indent or trailing newlines opt-in.

There are only slightly more uses of this method that don't want this (now opt-in) behaviour, although I think this is slightly less surprising (for example the trailing newline behaviour was to "add a trailing newline only if it didn't already exist" which I don't think was obvious).

Mostly this was just changing the defaults and all of the call sites. However, some call sites were getting the old behaviour (inc leading/trailing whitespace), but then calling `.trim()`, so I didn't add the opt-in there because it would then be removed (they won't show up in the diff because they didn't actually get any changes).

Change-Id: I2f05b3a6266aaad5ee510ce2a8bf269b26d42d5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-10-06 23:32:22 +00:00
Brian Wilkerson 420bfe3bf5 Cleanup overlap between suggestions for statements and expressions
Fixes some cases where the same keyword was being suggested twice
because we were completing at the beginning of a statement which can
also be the beginning of an expression.

Change-Id: I7c12da8caed14438f9f1a16fa7121d1cbd96b891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328769
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-03 13:23:46 +00:00
Brian Wilkerson b580b1c08e Minor cleanup in code completion
Change-Id: Ie9a6effe069ca327b6fc42a7a4b4198427d19627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328184
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-28 03:47:58 +00:00
Danny Tuppeny 7dfd97ba99 [analysis_server] Improve re-indenting of fixes/assists + add additional switch expression fix for Wrap
The original goal of this change was to add the `switchExpression` test in `flutter_wrap_center_test.dart`, but it failed on Windows and exposed a bug that affected a number of assists/fixes.

The issue was that indentation was being rewritten using a regex:

src.replaceAll(RegExp('^$indentOld', multiLine: true), indentNew)

On Windows, when `indentOld` is an empty string, both `\r` and `\n` are matched individually, resulting in indentation being inserted between them:

foo\r    \n    bar

To fix this, I changed all places using a regex for replacement like this to call the existing `CorrectionUtils.replaceSourceIndent` method which did not have this problem. However, it made two different assumptions:

1. Indentation should always be updated on the first line (which if `indentOld` is an empty string, results in extra unwanted indentation being prepended to the string)
2. A new EOL should always be added at the end of the new code

To handle this, I added two new parameters and kept the original behaviour the same (although, I'm not sure if defaulting to adding a newline makes a lot of sense).

Change-Id: Ifa714da62c2541ba54a5376aa67149c90396dec2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328220
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-27 22:25:52 +00:00
Brian Wilkerson 4c73e0ab49 Convert one more KeywordContributor method
Change-Id: Ic58d7a4cd2878981f77221b85b0566a7a0f5b732
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327240
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-21 19:21:39 +00:00
eliasyishak 83cfcf9cac Updating for unified analytics v4
Change-Id: I76e43f6cf75ac4b5b7ed4c9aadb048d54dbdf3b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Elias Yishak <eliasyishak@google.com>
2023-09-19 20:11:46 +00:00
Danny Tuppeny cc7dd80d51 [analysis_server] Don't include unnecessary parens when inlining locals
Fixes https://github.com/Dart-Code/Dart-Code/issues/4732

Change-Id: I5d0da808bea37b533a42b7aaf5443433826393f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326821
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-19 17:04:40 +00:00
Brian Wilkerson cc399708d3 Move more keyword completions
Change-Id: Ibdd1175731317acc91bff3e08ac57f706775bf56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-18 18:02:25 +00:00
Sam Rawlins 283dad4ddc analysis_server: Enforce single quotes preference
Change-Id: I553befc2c45e66bfc569004d810b4e0a958d4baa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325544
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-13 17:48:22 +00:00
Brian Wilkerson b8a89b66a6 Initial support for code completion in extension type declarations
Change-Id: I6acb71d0ac282135b6527431b162fad9a0dee8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-09-08 14:30:20 +00:00
Brian Wilkerson 7dd241361d Change the computation of the completion node
Sorry about the size of the change.

This started as a CL to move the computation of keywords with a record
pattern from the contributor to the pass. In the process of doing so I
realized that the previous computation of the completion node (the node
that's visited) was too aggressive about moving upward in the AST. I
believe the issue happens when we reach a node in a list of similar
nodes (such as a statement in a block).

I changed the computation of the completion node, which necessitated a
lot of changes to existing code. It also resulted in changing several
tests, most for the better I think, but please look carefully for
places where you think the changes aren't reasonable. I'm also
interested in feedback about the change to the computation of the
completion node.

Change-Id: I2c6ac76fe88f672a206c3692d9ff51d2e487ec0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324620
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-09-07 00:53:55 +00:00
Danny Tuppeny 144ea5b206 [analysis_server] Fix snippet context for initializing formals
Fixes https://github.com/dart-lang/sdk/issues/53308

Change-Id: I5b7f409882f00f347f014142c40be27ee81fed8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324100
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-04 17:28:47 +00:00
Konstantin Shcheglov 12bd986c71 Extension type. Request based test for rename, a fix for representation field.
Change-Id: Ic10550089272797724a0047a31fa040f4a293001
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323706
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-09-01 17:53:57 +00:00
Konstantin Shcheglov 84f65be285 Fix 'Extract Method' refactoring inside extensions.
Change-Id: If055456980361c5ec768bf5cb104af11cfa1b12e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-09-01 17:06:39 +00:00
Konstantin Shcheglov 80a76ff357 Extension type. Extract method refactoring.
Change-Id: I34e08182b568bfc0296b45851ccedb803595efa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323701
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-31 21:35:39 +00:00