Commit Graph

7248 Commits

Author SHA1 Message Date
Konstantin Shcheglov 00a3cdff40 Elements. Remove FragmentDeclaration, add 'declaredFragment' to Declaration.
Change-Id: I33398358d1241114b04995767d63188bb314fd6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394565
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-11 23:39:29 +00:00
Konstantin Shcheglov 8a5862ae66 Elements. Remove FragmentedElement.
Change-Id: If73caa44e64f469a16646794f96be044ad25d33f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394561
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 20:58:49 +00:00
Konstantin Shcheglov 6be32b412c Elements. Migrate CiderRenameComputerTest.
Change-Id: Id2b113cb30c7cf8680aa79f4a50a438d61088ba5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394362
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-11 19:05:27 +00:00
Danny Tuppeny 04641dcc53 [analysis_server] Allow the client to control whether experimental handlers are registered with DTD
This will allow testing in-dev features with a real IDE without having to run/build the server from source.

Change-Id: I62cf732e7c4935c111f312eef25afd247759ae7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394502
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 18:57:22 +00:00
Konstantin Shcheglov 5f8a5b1b52 Elements. Migrate SuggestionBuilderTest.
Change-Id: I1fffab521aceab1f78724250588822c9e3b95e4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-11 18:04:07 +00:00
Keerti Parthasarathy eb55f44637 [Completion] Do not ask for completion suggestions from plugins
Change-Id: I8f856a43e27f67948da249c5aae1cd53657438a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-11-11 16:55:18 +00:00
Danny Tuppeny 613bfa673f [analysis_server] Add a custom LSP handler to fetch editable arguments for the invocation at a position
This currently only supports int, double, boolean, string.

Change-Id: I236db8594907d28dc5901a384fbafdb34f243528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-11-11 15:38:42 +00:00
Danny Tuppeny 36eca4c4e1 [analysis_server] Remove unused AbstractGoToHandler base class
As part of the element model migration, the handlers were moved off this base class and just use shared helper functions where they overlap.

Change-Id: I13fcada1cc6b680bed24d3f91ab36e15548ae7c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394482
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 15:29:19 +00:00
Konstantin Shcheglov 48d8741451 CQ. Tweaks for InsertOnKeyword and tests.
Change-Id: I7dcdcbceb775fbf07c0bc27ab38a94bc02253086
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394343
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-09 21:01:01 +00:00
Erik Ernst c9391d7f19 Set obvious/property lints to hasFix
The lints `omit_obvious_property_types` and
`specify_nonobvious_property_types` previously had error fix status
'needsEvaluation'. This CL changes it to 'hasFix'. This is needed in
order to get access to the fix in IntelliJ.

This CL also corrects a bug whereby a map literal was considered to have an obvious type in cases where there were no actual type arguments and no elements with an obvious type.

Change-Id: Id9305152d086604b78636b696bd97e318ed6bdb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393280
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-09 16:59:49 +00:00
FMorschel 92663b7303 [DAS] Adds fix for expected 'on' keyword
R=srawlins@google.com

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

Change-Id: I316a2d29546c9edd3a808785efdbc148007c531b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392540
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-08 23:57:06 +00:00
Konstantin Shcheglov e7aaba1254 Elements. Migrate OverrideHelper.
Change-Id: I645d901fd0655c33c0c147c2b08a67b4791e6186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-08 23:05:39 +00:00
Brian Wilkerson 15cdbc5eab Migrate five correction producers
Change-Id: I3289e0862797947fadf76d78a2ce27c0cf249dd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394321
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-08 21:08:18 +00:00
Danny Tuppeny 7b8de02eda [analysis_server] Update "Go to Imports" to support enhanced parts
Instead of looking in a single root unit, we now look in each unit up the tree.

Change-Id: I59b0692438dd73fce7be7790ddc24240761d72c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 20:02:14 +00:00
Sam Rawlins cb5c73e06f linter: Remove unsafe_html rule
Fixes https://github.com/dart-lang/linter/issues/5001

Change-Id: I972ea8f9fafda88b6a4836ab92107cebe8a6ad4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391303
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-08 18:31:59 +00:00
Danny Tuppeny 9682da5a45 [analysis_server] Migrate LSP "Go to Imports" command to new element model
Change-Id: I07f53420649b5be11088407b0344186bcb741ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393861
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-08 15:37:05 +00:00
Konstantin Shcheglov ea86e0fe39 Elements. Return nullable 'LibraryFragment?' from 'get libraryFragment'.
We can have synthetic 'FormalParameterFragment' and 'TypeParameterFragment'
that don't have any enclosing 'LibraryFragment'.

Change-Id: Icc1a47c308e55b93ed6a2aad70788058e26ee803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-07 21:59:29 +00:00
Danny Tuppeny d698ace297 [analysis_server] Migrate LSP Go-To handlers to new element model
Change-Id: Ie517dcbba87c34d12a42707c3beea141d3fd509a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-11-07 19:30:27 +00:00
Sam Rawlins 082c71062b analyzer: Move enableTiming out of AnalysisOptionsImpl to AnalysisDriver.
It has seemed disingenuous to me that `enableTiming` has been a
property of AnalysisOptionsImpl, when it cannot be specified in an
analysis options file. Additionally, it is used in exactly _one_
place: the linter package's `benchmark.dart` script.

Instead, it makes more sense to think of this "flag" as a process-wide
flag. It is not something that may be set one way for some files, and
another for another set of files. And it is not something that can be
set to one value early during an analysis process, and then change; it
never changes.

So instead this change makes it a _final_, _private_ field on
AnalysisDriver, and on LibraryAnalyzer. LibraryAnalyzer gets its value
from AnalysisDriver, and AnalysisDriver gets its value from the
AnalysisContextCollectionImpl constructor.

Change-Id: I347605775680a8ea1c1237f0ee20bd4bbe2c6216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393961
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 18:49:01 +00:00
FMorschel 25c72bc9a6 [DAS] Go to Imports option
This change is to add a command that can be used to see which imports are contributing a symbol in the document. It'll work similar to things like "Go to Super", but when there are multiple results it will show them in a peek window, like Find References does.

Fixes: https://github.com/dart-lang/sdk/issues/56584
Change-Id: I70d369095a0500982818f0c8bea2651fe5f73431
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387387
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-07 18:09:35 +00:00
Sam Rawlins 73443c8603 DAS: Generated protocol 'enums' can be real enums
File sizes are reduced:

```
analysis_server_client's protocol_common.dart    - 132k -> 102k (-23%)
analysis_server_client's protocol_generated.dart - 453k -> 433k (- 4%)
analysis_server's        protocol_generated.dart - 528k -> 509k (- 3%)
analyzer_plugin's        protocol_common.dart    - 139k -> 108k (-22%)
```

Change-Id: I8018f1d09e053c9d3df340ba31cdb07cbd29acf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-07 17:27:18 +00:00
FMorschel 309ba3bd0f [DAS] Fixes keyword completion inside map literal value
R=brianwilkerson@google.com

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

Change-Id: I4703fdafc7986d20a40a18b729a4c66eaafff87a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-11-07 15:17:29 +00:00
Sam Rawlins fbf331e0dd DAS: reformat source code with tall-style
Change-Id: I42b4a44fd6a2197e499e8623274b3cd1a4b5556f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394003
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 23:04:00 +00:00
Sam Rawlins e66a8a4fa3 analyzer plugins: parse version and path keys in YAML
This enables plugin sources to be specified in one of three ways:

* as a YamlScalar, like `plugin_name: ^1.2.3`
* with a 'version' key, like `plugin_name:\n  version: ^1.2.3`, which
  allows diagnostic configurations to be alongside.
* with a 'path' key, like `plugin_name:\n  path: foo/bar`, which
  allows diagnostic configurations to be alongside.

We introduce a PluginSource with a `toYaml` method to convert the
values back into YAML for the generates pubspec. We update
PluginPackageGenerator to use PluginSource.toYaml.

Change-Id: Ic5f372f0339edd6aa638dd9b568a83f41a023b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393900
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 19:41:00 +00:00
Robert Nystrom 732b07a42b Roll dart_style into the SDK.
I'm still chasing down a couple of google3 failures, but this is ready for review so that I can get it approved and land it once the last couple of failures are fixed. Here is who I think should review what:

athom@ for:

- DEPS

johnniwinther@ for:

- pkg/_fe_analyzer_shared
- pkg/front_end
- pkg/kernel

brianwilkerson@ for:

- pkg/analysis_server
- pkg/analyzer_plugin
- pkg/analyzer_utilities

kenzieschmoll@ for:

- pkg/dartdev

pquitslund@ for:

- pkg/linter/lib/src/lint_codes.g.dart

If you're not the right person, feel free to summon someone else.

Most of the changes here are re-running code generators that auto-format the code they generate. The changes are:

Roll in the latest dart_style commit:

- DEPS

Manually updated these test expectations to expect the new style:

- pkg/analysis_server/test/lsp/format_test.dart
- pkg/analysis_server/test/services/refactoring/agnostic/change_method_signature_test.dart
- pkg/analysis_server/test/src/domains/flutter/set_property_value_test.dart
- pkg/analysis_server/test/src/services/flutter/container_properties_test.dart
- pkg/analysis_server/test/src/services/flutter/widget_descriptions_test.dart
- pkg/analysis_server/test/src/services/refactoring/convert_selected_formal_parameters_to_named_test.dart
- pkg/analysis_server/test/src/services/refactoring/move_selected_formal_parameters_left_test.dart

This was auto-generated by something, but I'm not sure why it thinks there is a diff:

- pkg/analyzer_plugin/doc/api.html

Updated to require a version of dart_style that accepts a language version in DartFormatter():

- pkg/analyzer_plugin/pubspec.yaml

Updated to always use the latest language version (and thus new style) when invoking the formatter:

- pkg/analyzer_utilities/lib/tools.dart

Manually updated the formatting in the code templates so that they matched the formatting expected by the tests, which implicitly format using the latest language version:

- pkg/dartdev/lib/src/templates/...

The rest are all generated files that are formatted so re-generated using the new style:

- pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
- pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
- pkg/analysis_server_client/lib/handler/notification_handler.dart
- pkg/analysis_server_client/lib/src/protocol/...
- pkg/analysis_server/lib/protocol/protocol_generated.dart
- pkg/analysis_server/test/integration/support/integration_test_methods.dart
- pkg/analysis_server/test/integration/support/protocol_matchers.dart
- pkg/analyzer_plugin/lib/protocol/...
- pkg/analyzer_plugin/test/integration/support/integration_test_methods.dart
- pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
- pkg/analyzer/lib/src/analysis_options/error/option_codes.g.dart
- pkg/analyzer/lib/src/dart/error/...
- pkg/analyzer/lib/src/error/codes.g.dart
- pkg/analyzer/lib/src/manifest/manifest_warning_code.g.dart
- pkg/analyzer/lib/src/pubspec/pubspec_warning_code.g.dart
- pkg/analyzer/lib/src/summary/format.dart
- pkg/analyzer/lib/src/wolf/ir/ir.g.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_000_1.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_001_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_010_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/less_simple/lib_100_0.dart
- pkg/compiler/test/tool/graph_isomorphizer/golden/simple/...
- pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
- pkg/front_end/lib/src/codes/cfe_codes_generated.dart
- pkg/front_end/lib/src/util/parser_ast_helper.dart
- pkg/front_end/test/parser_test_listener.dart
- pkg/front_end/test/parser_test_parser.dart
- pkg/front_end/testcases/...
- pkg/kernel/lib/src/coverage.dart generated
- pkg/kernel/lib/src/equivalence.dart generated
- pkg/linter/lib/src/lint_codes.g.dart

Change-Id: Ice0141b763e63b84f54692cd19a442a0719673c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391263
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-06 18:42:25 +00:00
Keerti Parthasarathy c30f961f13 Delete unused code - RuntimeCompletionComputer
Change-Id: I4fd027998ce4f9fa847df2ddd0773c3a476e766a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393701
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-06 12:59:00 +00:00
Keerti Parthasarathy da1930ab6c Add cancellation token for legacy requests in message scheduler
Change-Id: I6b0837edbf373d2b8b72b16ed47d157c097347d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-11-06 12:58:02 +00:00
FMorschel 9d340db3e6 Fixes import prefix hover text as code
R=srawlins@google.com

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

Change-Id: I37fa39f385dd26dfcf55c024b9ca331ec83381f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-05 18:10:19 +00:00
Parker Lougheed 235a7157d5 [analysis_server] Don't repeatedly redetermine sort member order
Also complete some nearby cleanup. Mostly turning MemberKind into a normal enum.

Change-Id: I96f810c9f2197e5c748231f3d1fb5344e5ef528a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-05 17:29:29 +00:00
Danny Tuppeny facc712ec8 [analysis_server] Migrate LSP colors to new element model
Change-Id: Ib31793e2cc5b52cde46b76dee9da7ddc9047eee3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393322
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-11-05 16:05:46 +00:00
FMorschel 6eda5e2019 [DAS] Fixes add const for final variables and lint
R=srawlins@google.com

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

Change-Id: I75dd2c0063ea5d3a6ebbf4afb734d2cb5d98c1d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392860
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-11-05 15:48:00 +00:00
Chloe Stefantsova 8a1c0203b4 [analyzer] Handle null-aware elements in code completion
Part of https://github.com/dart-lang/sdk/issues/56989

Change-Id: Id02c049d0afb5cb6c3f1d94ee5bebf7ca532e2e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392902
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-05 10:57:28 +00:00
Vyacheslav Egorov 729c1c01ce Fix Collect Report functionality
When language server is started through dartdev is gets
classified as a system isolate, but Collect Report
only looks at user isolates.

I have looked at various ways to fix this but it is
complicated because we are in the middle of rewiring
dartdev to work with AOT built tools.

I would like a trivial change that can be easily
cherry-picked into stable release. Thus I am opting in
to simply change data collection code to collect information
from both user and system isolates.

Change-Id: I00f9eb937153fc730feccf778e5cd2f69d222a18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-11-05 09:07:28 +00:00
Konstantin Shcheglov 4f6b07c25e CQ. Remove available declarations.
Bug: https://github.com/dart-lang/sdk/issues/55281
Change-Id: Ie8d2a7f3d5ea9408320312d49eb67561ca463289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393480
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-04 21:30:08 +00:00
Konstantin Shcheglov c054056146 Elements. Lint. Disallow 'declaredElement' from src/dart/element/element.dart
Also enable the lint for analyzer/.

Change-Id: I2c9e61c6427f5e59b936f1ee7f5f94d4584f2988
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392851
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-11-04 20:59:51 +00:00
Konstantin Shcheglov a868303290 Elements. Remove FragmentName, inline as name2 / nameOffset2.
Change-Id: If238cd71867501a39e243261228d137f925db1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-01 18:56:26 +00:00
FMorschel d5e19c60b7 Fix for completion inside late final fields
R=paulberry@google.com

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

Change-Id: Ib1a5ca0c27df2d19bca36f7385c30b02811c2e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393043
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-01 16:34:58 +00:00
FMorschel 5e6a681445 Fix hover import prefix
Fixes https://github.com/dart-lang/sdk/issues/32735

Change-Id: I6830b61fe554065f9ec6e87f2ac24dfaffd67f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
2024-11-01 14:16:58 +00:00
Brian Wilkerson 5ef250a2bf Rework the new element model so that all elements have fragments
Change-Id: Ic4fc0368cabc5fa8dfc21c958e1619777f2701b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392541
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-31 23:23:39 +00:00
Danny Tuppeny 3f6ff63774 [analysis_server] Use only Parsed AST for format in legacy protocol handler
+ clean up LSP version to use new `unit.languageVersion.effective`

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

Change-Id: Ia28f3ddb116427ecd8588f58adb7238a7204832a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-31 19:54:32 +00:00
Danny Tuppeny 6a94c6122f [analysis_server] Minor LSP refactors + fix
Some minor fixes/tweaks extracted from another CL

1. Fix tool/lsp_spec/codegen_dart to set `options` on `CodeStyleOptions` (a late field that needs to be set to the owning options file)
2. Fix a wrapped TODO to be indented so it's detected correctly
3. Move the custom `DartTextDocumentContentProviderHandler` handler into the `custom` folder
4. Merge `LspHandlerHelperMixin ` into `HandlerHelperMixin` since the APIs it uses are no longer LSP-specific and exist on the base server

Change-Id: Ie1b3a8057575346cf9bfb98465c0a3e330c28a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392909
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-31 19:14:03 +00:00
Sam Rawlins 1033027175 Tidy some legacy plugin code
* Update comments to be modern and reference "package config files"
  rather than "packages files"
* Remove commented out code that we aren't going to uncomment.
* Rename PluginFiles.packages.
* Simplify `PluginManager._computeFiles` to use less nesting, and use
  early `throw` statements, rather than storing data in local
  and choosing late whether an exception should be thrown with the
  stored data.

Change-Id: I7d5da0e299962d8887f2222137478a2fd96671b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-31 19:12:30 +00:00
Danny Tuppeny 27b52a3f82 Add languageVersion to CompilationUnit and make non-null
Change-Id: Ice6f866929f1f028d9b4e64685c2e815a08279f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-31 18:49:03 +00:00
FMorschel df520c9ee3 [DAS] Import library with prefix
R=srawlins@google.com

Fixes https://github.com/dart-lang/sdk/issues/55863
Fixes https://github.com/dart-lang/sdk/issues/41515
Fixes https://github.com/dart-lang/sdk/issues/24338

Change-Id: I8b8457488b55a468d4b3c6d34efffc7436a2ff18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389780
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-31 16:57:03 +00:00
Danny Tuppeny ca0cfad6bd [analysis_server] Add occurrences/document highlights for type aliases
Fixes https://github.com/dart-lang/sdk/issues/56994

Change-Id: I0721603b7b019ab09614265e412d3b9e76d26ad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392660
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-10-30 20:27:54 +00:00
FMorschel 006caad390 [DAS] Inline enclosing else block assist
Fixes https://github.com/dart-lang/sdk/issues/56924

Change-Id: Ib697e7b29671331f4e5b87a2472e3be60f89ffa1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391021
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 19:47:38 +00:00
Alex Wallen 901f356c1f chore: add actual vs. expected in error logging message
Closes https://github.com/dart-lang/sdk/pull/56988

GitOrigin-RevId: da1fceb6e01622ca3bc63ede831c983d77c2417e
Change-Id: I1bed7fcdfdbf891f3205fb7ffd3e104fa6528cc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392406
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 18:40:15 +00:00
Sam Rawlins 1db40b6eb8 analyzer: Add an AnalysisRule alias for LintRule
Since the LintRule class is the basis for writing both "lint rules"
(rules that must be explicitly enabled) and "warning rules" (rules that
are enabled by default), it is a misnomer to use 'LintRule' as a
supertype. This change adds an alias, 'AnalysisRule'. Additionally:

* Rename LinterVisitor to AnalysisRuleVisitor.
* Rename lintRuleTimers to AnalysisRuleTimers.
* Rename LinterExceptionHandler to AnalysisRuleExceptionHandler.
* Rename LintRuleExceptionHandler to _AnalysisRuleExceptionHandler.

* NodeLintRegistry is used in too many places, so I have left it for
  now.

Change-Id: I43340cca0f9b64502960d8f5e05c6c9b81c3dfd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392203
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-30 17:43:19 +00:00
FMorschel a40403e0fb [DAS] New assists for wrap with Expanded/Flexible
R=pquitslund@google.com

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

Change-Id: I34a697d914e3a480105a4388d77178a96425893a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390622
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-30 17:26:18 +00:00
FMorschel 9612b71707 [DAS] Update combinator - Use aliased import fix
R=scheglov@google.com

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

Change-Id: I1354e3cde559229d5167a27e51efb6d030e5f8bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-10-30 16:10:11 +00:00