Commit Graph

130 Commits

Author SHA1 Message Date
Danny Tuppeny c8ab18f13e [analysis_server] Improve the display of unnamed extensions in LSP Outline, Document Symbols
We previously just showed "<unnamed extension>" for extensions without names, but in some files I noticed we have a lot of these, and the outline/symbols list looks awful (just "<unnamed extension>" repeated many times).

This changes it to instead show "extension on FooClass" instead (if there is a valid type name). I added a new field to the protocol to support this because the LSP classes convert from those classes (something we've discussed changing, but might be easier later).

Screenshots of before/after are in https://github.com/Dart-Code/Dart-Code/issues/5818

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

Change-Id: I3885a722443291bfa2419514841469c862b74450
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464560
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>
2025-11-25 13:49:55 -08:00
Sam Rawlins 793aeaee01 DAS protocol: Update comments to use markdown codeblocks
One can see that we have bare HTML in these signature-in-comments,
like:

  "contextMessages": optional List<DiagnosticMessage>

These are flagged by the unintended_html_in_doc_comment lint rule.

This CL solves this by indenting these signatures 4 spaces, making
them Markdown indented code blocks. Alternatively we could use
backticks. Backticks would make the comments taller; indenting makes
them wider. I would prioritize whichever style is less intrusive when
reading them in plain text, which I think would be to use
indentation.

Change-Id: I019d9073e994a505325194ceeac3c6e0635d947e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453642
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-08 09:16:20 -07:00
Sam Rawlins b1944f9529 Improve mismatch exception, wrapping field names in quotes
When hitting a protocol error, I saw some errors that were confusing
for a moment because of the lack of quotes, for example:

> Invalid parameter 'params'. Expected to be files; found \"...

This CL doesn't actually improve the situation _much_, but it at least
puts quotes around `files`, to indicate it is a property or something
similar.

Change-Id: Ic12d063b427661025cd4418951c58abf3394df3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449220
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-15 11:47:54 -07:00
Sam Rawlins b40781459a Bump analyzer_plugin to use Dart SDK 3.9.0
Change-Id: Ice7b7e978ccc666c18cbea9cb9e79673893066ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-09-02 14:07:49 -07:00
Sam Rawlins 26102c5d52 DAS plugins: Wire up initial screen for new plugins.
This renames the old screen, "Legacy plugins" and adds a new screen,
"Plugins". On the new plugins screen, we ask the plugins isolate(s) for
their plugins details, and print the following, for eadh plugin:

* the plugin's name
* the names of the registered lint rules
* the names of the registered warning rules
* the IDs and "messages" of the registered assists
* the IDs and "messages" and associated diagnostic codes of the
  registered quick fixes

More to come in follow ups:

* The resolved versions of plugin packages (coming from package_config.json)

Change-Id: Ic3dc4c5bffa64fd4da4097c042a847cc064e41ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447763
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-02 08:38:32 -07:00
Sam Rawlins 1b212e6cee DAS: improve error-throwing code to include JSON
Most calls to `jsonDecoder.mismatch` include the 3rd argument. I add
more here, so that the error can say, "I expected this field in some
JSON, but instead the JSON looks like this: ..."

Change-Id: I7d1944624e1fe758d9732d71db6571a579dc4690
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-08-27 11:31:39 -07:00
Jens Johansen 0d4b08caaa [analyzer] Use QueueList by default in SourceFileEdit
Adding edits (e.g. via `dart fix --apply` are often done with
`List.insert(0, whatnot)` which takes O(n) time.
Here QueueList that can insert fast at both ends is used instead
(and we use `addFirst` instead of `insert(0)`.

On the example from
https://github.com/feinstein/google-i18n-address-dart.git we go from:

```
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m55.810s
user    4m1.209s
sys     0m3.714s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m33.966s
user    3m37.588s
sys     0m2.058s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    3m36.525s
user    3m40.083s
sys     0m1.907s
```

to:

```
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.970s
user    0m12.676s
sys     0m2.100s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.862s
user    0m12.926s
sys     0m1.797s

(resetting)
$ time dart fix --use-aot-snapshot --apply
[...]
249517 fixes made in 255 files.

real    0m9.612s
user    0m12.712s
sys     0m1.834s
```

Statistics on the `real` runtime:

```
    N           Min           Max        Median           Avg        Stddev
x   3       213.966        235.81       216.525     222.10033     11.941664
+   3         9.612          9.97         9.862     9.8146667    0.18363369
Difference at 95.0% confidence
        -212.286 +/- 19.1415
        -95.581% +/- 8.61838%
        (Student's t, pooled s = 8.44503)
```

For `lsp_many_prefer_single_quotes_violations_benchmark.dart --sizes=3200`:

Before from something like:

```
Initial analysis: 0.115654
First code action call: 0.835152
Subsequent action call 1: 0.538592
Subsequent action call 2: 0.561636
Select all code action call: 1.564402
```

After to something like:
```
Initial analysis: 0.086985
First code action call: 0.411660
Subsequent action call 1: 0.171566
Subsequent action call 2: 0.193708
Select all code action call: 1.107339
```

Statistics on 5 runs gives:

First code action call:

```
Difference at 95.0% confidence
        -0.44381 +/- 0.0261597
        -52.4602% +/- 3.09218%
        (Student's t, pooled s = 0.0179367)
```

Subsequent action call 1:

```
Difference at 95.0% confidence
        -0.381012 +/- 0.0195618
        -69.9139% +/- 3.5895%
        (Student's t, pooled s = 0.0134128)
```

Subsequent action call 2:

```
Difference at 95.0% confidence
        -0.360077 +/- 0.0265277
        -64.634% +/- 4.76173%
        (Student's t, pooled s = 0.0181891)
```

Select all code action call:

```
Difference at 95.0% confidence
        -0.405855 +/- 0.027662
        -26.7277% +/- 1.82169%
        (Student's t, pooled s = 0.0189668)
```

Change-Id: I3868afaa8c32a24c01c3a52bd8a53d5e8e4e3afe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427401
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 00:45:34 -07:00
Danny Tuppeny f3f45a0e88 [analysis_server] Fix some typos in readme/spec
Change-Id: Ifb14293a886eedd0ee868ac43ef18b6224967ac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 10:03:07 -07:00
Danny Tuppeny fe43c00880 [analysis_server] Add document version support for the legacy server
This adds an optional version number to AddContentOverlay and UpdateContentOverlay in the legacy protocol.

It also moves some code (such as the `Map` that stores the current document versions) from the LSP server into the base class, and updates the overlay handlers to update it.

And finally, it removes the FailingTest() annotations on the versioned EditArguments test since they now work.

Change-Id: Icf2a2825eb6227f5faa3e21ae6c3a7d15997ef5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404821
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-08 09:11:52 -07:00
Brian Wilkerson 24cae8a684 Improve the performance of applying edits
I wrote a test that generates 10,000 lines of code, each containing one
violation of `prefer_single_quotes`, computes the fixes for all of the
diagnostics, and applies the 20,000 edits, measuring how long the
application takes.

Before this change the average was 3355.0 ms.

After this change the average is 3.8 ms.

The change was inspired by Jens.

Change-Id: Icd54a81ca3848fd5f0168934f713a7be8caec359
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425601
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-01 15:59:59 -07:00
Sam Rawlins f72576af3b analyzer_plugin: Introduce messages/types for plugin analysis status
There is no code in this CL that _uses_ the new AnalysisStatus
Notification or type, but landing it is important, so that I can test
plugins which will use the analyzer_plugin package from pub.

Change-Id: I31f835d5f7b8bda3781a6962d37f1f769b22852e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-01-16 13:26:09 -08:00
Sam Rawlins dbf6008297 DAS: Support monospaced text (eg code snippets) in generated doc comments
We take any `<tt>`-wrapped text, and keep it in some "monospaced" /
"teletype" format. For dartdoc we put it in backticks. For Javadoc
we put it in `<code></code>`, which looks standard for inline text.

This corrects some erroneous doc comment reference-looking text
(`offsets[i]`) which is not meant to be a doc comment.

Change-Id: I1d77a02368e3cde158ce95d3b0095ba09e071370
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-12-17 12:24:58 -08:00
Sam Rawlins 7190cb0c3e analyzer: Use package language version to format generated files.
This fixes an issue of our code-generation scripts fighting the Dart
Format presubmit check.

Change-Id: Ib0dc77a4cd580c4f4fd077b48849984eefebc7e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400223
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-12 15:04:19 -08: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
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
Danny Tuppeny 916272331b [analysis_server] Remove the singleton uriConverter and pass explicitly to all toJson/fromJson methods
This avoids accidentally using the converter when talking to plugins, (at least for now) URIs are never expected, and file paths should always be used regardless of which mode the server is in.

This unfortunately touches a _lot_ of code, so I've pushed in many separate patch sets to Gerrit.

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

Change-Id: I312c3e2cbc35a05a078aaa0138aec7288b3c7dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373745
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-07-02 14:15:11 +00:00
Danny Tuppeny 28e926f0fb [analyzer]/[analyzer_plugin] Support change descriptions on SourceEdit
Previously, we only had descriptions of changes on a SourceChange. In order to support annotated edits over LSP for "Fix All in Workspace" we need to be able to track descriptions on each change within a file so that if we're fixing multiple different lints with a single SourceFileEdit they can be annotated/grouped in the UI.

In order to avoid every fix providing a description, ChangeBuilder has a field that allows recording the current change description and all builders created from it will use that description when creating their changes. This allows the BulkFixProcessor to set the description on behalf of each fix producer ensuring they all get descriptions (which is done in a follow-up CL along with Fix All in Workspace functionality).

Change-Id: Ie1c508056898bd4000a5505cf59a1e6d35d28da0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-08 18:54:05 +00:00
Konstantin Shcheglov 8968e5500a CQ. Enable avoid_redundant_argument_values in analysis_server/
Change-Id: If9c09f81bdbac890553573a8491ca27cb4f22dd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353805
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-26 19:51:41 +00:00
Danny Tuppeny 8d936d38fc [analysis_server]/[analyzer_plugin] Make all toJson/fromJson methods go through a central converstion for Path<->URI Strings
This change shouldn't change any current behaviour, but means all "FilePath" types in the legacy protocol spec will go through a (currently no-op) conversion. The server will be able to replace this conversion based on client capabilities in a future CL.

Because a lot of the generated classes are in analyzer_plugin, this also moves the ClientUriConverter class there.

`pkg\analysis_server\test\src\utilities\json_test.dart` contains tests that the toJson/fromJson methods go through the converter recursively (inc. map keys/values/etc.).

Change-Id: If5aec884070128eea594540fd25a9017ada86079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-01-30 16:58:25 +00:00
pq f962700302 + flutter_style_todos
Enabled `flutter_style_todos` in analyzer packages:

* `analyzer_cli`
* `analyzer_plugin`
* `analyzer_utilities`
* `meta`


Change-Id: I5fcd76bfa5a3bdeb14d6a81b8193129c6d83d0e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335405
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-13 00:14:09 +00:00
Konstantin Shcheglov bbc3dcbe30 Extension type. Tests for type hierarchy.
Change-Id: Ic0e31bb13efd68a3413429d1ff9110bb9b268e2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323432
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-30 21:18:25 +00:00
Konstantin Shcheglov ce7164488a Extension types. Semantic highlighting.
Change-Id: I46cde8151965e209a230df811592f8498e93c218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318161
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-04 19:13:43 +00:00
Konstantin Shcheglov edccf64f54 Fix for highlighting mixin names.
Change-Id: Idadb02aa1b86525fde307a5eddc8876f152d1b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291045
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-24 21:37:57 +00:00
Sam Rawlins f46c9afc12 [analysis_server] Add type arguments to remaining raw types
The Maps are all JSON, so they become `Map<Object?, Object?>`.

Most other types get a `Object` or `Object?` type argument, and a
few also get `dynamic`.

Change-Id: I097318defed55360b5b0d910bd2d085a121e97b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287673
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-16 20:37:57 +00:00
Oleh Prypin 88ac4a27a1 Revert "Roll the latest dart_style into the SDK."
This reverts commit bbba3c9788.

Reason for revert: latest dart_style has a few bugs and overall the changes should be discussed more

Original change's description:
> Roll the latest dart_style into the SDK.
>
> This includes support for records, patterns, sealed classes, and class
> modifiers. It also includes a fairly small number of style changes. The
> one that will be most noticeable is more compact switch statements.
>
> Change-Id: I9e89ba82d52bfa451fc54f9dd59048d72db48377
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285460
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Bob Nystrom <rnystrom@google.com>
> Auto-Submit: Bob Nystrom <rnystrom@google.com>

Change-Id: I12fad53bdc75dda349b9362aeb84e798983bfa25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286420
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-03-02 13:16:36 +00:00
Robert Nystrom bbba3c9788 Roll the latest dart_style into the SDK.
This includes support for records, patterns, sealed classes, and class
modifiers. It also includes a fairly small number of style changes. The
one that will be most noticeable is more compact switch statements.

Change-Id: I9e89ba82d52bfa451fc54f9dd59048d72db48377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285460
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-03-01 16:08:40 +00:00
Josh Soref 01b28894e7 Spelling pkg dev compiler
Closes https://github.com/dart-lang/sdk/pull/50861

GitOrigin-RevId: 71005e6f5bf5a151cb5c1aefb6a2a300fc40f592
Change-Id: Iadfafb5787a62e9a379437f6a3763d31f99ba7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277743
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-26 09:12:41 +00:00
Brian Wilkerson d9482e35ce Remove some unnecessary ignore comments in analyzer packages
Change-Id: I578285132f0d3f200cb2e9069750a1391940711d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-09 21:33:18 +00:00
Konstantin Shcheglov 671bb192ab Remove domain 'kythe' from DAS.
Change-Id: I66f0e538dce6eead6ba1c98b9cf0e3d747450130
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264895
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-10-21 17:03:29 +00:00
Brian Wilkerson a3f8672778 Add a highlight kind for record literals
I don't think that there are any other highlight kinds we're going to
want to add, but if you can think of any please let me know.

I'll add code to actually associate the kind with record literals in the
next CL.

Change-Id: I15922984d96c2d0c7d97ea3f3832a95a68172968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256524
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-08-26 21:22:53 +00:00
Devon Carew 9282573e2c [analyzer] use package:lints for pkg/analysis_server_client, pkg/analyzer_plugin
Change-Id: I97d30af3930c3f65532d77dee06de57ce5f5fc20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250766
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-06 19:54:00 +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
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
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
Danny Tuppeny fa8a33f60e [analysis_server] Set Container() as final tabstop/selection in Flutter snippets
Change-Id: I0f1fd31a051440ccc119188cccdb3168c9e58e20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245988
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-05-25 18:57:28 +00:00
Ahmed Ashour 466202bb34 [analyzer] remove lints ignore in generated files
Fixes #49039

Change-Id: I14e98fc5ab9c1f7b7e69f99dc1c97178b56c624d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245020
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-05-19 05:17:00 +00:00
Sam Rawlins 531e6e175f analyzer: Prefer string interpolations
ignore prefer_interpolation_to_compose_strings and
constant_identifier_names in generated files.

Change-Id: I963504e298f8e439734522fed9ac09911750f419
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243646
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-05-04 20:45:25 +00:00
Konstantin Shcheglov 16fadd69a6 Switch to protocol version 1.33.0, enable new completion protocol.
Change-Id: Ib7de4d616cba91bfe3b014199b6aacaa01c9c052
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239322
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-29 20:53:39 +00:00
Danny Tuppeny f5bd632abe [analysis_server] Ensure imports are always added before other code being inserted in DartFileEditBuilder
Change-Id: I390f24ac10f7f061e79c9bfed616e9bcc908d240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234604
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-03-02 16:37:26 +00:00
Danny Tuppeny 70d25c7ce7 [analysis_server] Make docs more explicit about positions in LinkedEditGroups
Change-Id: Ifcc8935ac7c72d42fcc0462fd2f6ad3eb8ecd3b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-10 19:51:13 +00:00
Konstantin Shcheglov 52290eba28 Add CompletionSuggestion.libraryUri, keep isNotImported.
Change-Id: I1bce246c2d8eaa968a47ae6ba82114592b991a47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-04 22:49:10 +00:00
Konstantin Shcheglov 540c053ca8 Add HighlightRegionType.EXTENSION
Change-Id: I375df19b8ee5f6570fcc7d440b9d71b148bcef73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-26 16:11:59 +00:00
Konstantin Shcheglov 2170c061b0 Add Element.libraryUri and CompletionSuggestion.isNotImported
Remove libraryUrisToImport and libraryUriToImportIndex.

Change-Id: Iafe27d6fb0c5ce0c623567a0384a4579274b151f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227580
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-01-11 19:53:14 +00:00
Konstantin Shcheglov 4487759dd2 Document new DAS completion APIs.
Change-Id: I2ff1f2c494033a62fead7d828d5d875b55eda203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215643
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-21 18:21:35 +00:00
Kevin Moore b67a67e03c pkg:analy* - don't call .hashCode within Object.hash functions
Follow-up to https://github.com/dart-lang/sdk/commit/cb7c932f7bed440ead0279845c2e8e578cbdea41

Change-Id: Ie00e7759880bfc80f7b04a79979325d26607f148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214581
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-26 21:49:04 +00:00
Kevin Moore cb7c932f7b analyzer: use Object.hash functions, deprecate JenkinsSmiHash
Also bump min SDK for pkg:analyzer

Towards https://github.com/dart-lang/sdk/issues/27698

Change-Id: Ic32c839c02f18afd99fdb98eb382540aae7da88a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214126
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-09-22 19:11:24 +00:00
Konstantin Shcheglov 06f0ecb8e8 Add more HighlightRegionType.xyz_TEAR_OFF
Change-Id: I357d621439c68b77545bdd01719310c60684e1f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212602
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 18:31:03 +00:00
Konstantin Shcheglov 1957af707c Use CONSTRUCTOR_TEAR_OFF for ConstructorReference highlighting.
Change-Id: Iee9731ef6e273ae89bc5328d6941aa8ddd530562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212488
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-07 16:08:02 +00:00
Brian Wilkerson 9db372e6f4 Make Location.endLine and Location.endColumn optional fields in the protocol
In https://dart-review.googlesource.com/c/sdk/+/191862 we added two new
required fields to `Location`. Unfortunately this was a breaking change
because plugins using an older version of the `analyzer_plugin` produce
location objects without those fields, leading to deserialization failures.

This CL makes those fields optional in order to fix the deserialization
issue.

Unfortunately, the `analyzer_plugin` package was published after the
required fields were added. Making them optional is a breaking change
because the constructor parameters go from being positional to being
named parameters.

We also neglected to update the version number of the protocol as part
of the previous CL. Technically this is also a breaking change for clients
of the analysis server, but given that they had no way to test to see
whether these fields existed they would need to have been written as if
the fields were optional in order to reference them at all, so I think
that from a practical standpoint it isn't a breaking change. That does,
however, raise the question of whether we should increment the version
numbers as part of this CL.

Change-Id: I35fc1f8e950669a3d8dd33cee6b81890261b5c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206942
Reviewed-by: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-07-15 17:35:55 +00:00
Danny Tuppeny d3082bcb3e [analyzer] Add folding regions for parameters
Fixes https://github.com/Dart-Code/Dart-Code/issues/1201.

Change-Id: I2865337861397ae15d2c4515b009fa22c678b5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-24 17:13:35 +00:00