Commit Graph

779 Commits

Author SHA1 Message Date
Sam Rawlins c219974ecf analyzer: Deprecate Diagnostic.errorCode in favor of diagnosticCode
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I2c7d64a81bc214e64fbc3ac95cf1fe2363a6ebd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433242
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-09 09:22:22 -07:00
FMorschel 9d6c5d40d0 [DAS] Fixes "Go to declaration" for undefined new constructor
Fixes: https://github.com/dart-lang/sdk/issues/60773
Change-Id: I7ee7cec371fbf0d0f9de1a4fe2b946929ba80d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-06-05 12:08:44 -07:00
Konstantin Shcheglov e724547892 Elements. Deprecate Annotatable.metadata2, use 'metadata' instead.
Change-Id: Ic4a7d8f19cb1793031951aadeb340e5dadf4744c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430261
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-30 11:09:40 -07:00
Brian Wilkerson 2545c3eb31 Remove three more uses of NodeLocator2
Change-Id: I3e8fba0516bb0988ca0794991e980157dacb7231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430860
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-05-23 10:22:17 -07:00
Sam Rawlins 2dc94ee84a analyzer: Rename DiagnosticCode.errorSeverity to DiagnosticCode.severity
Change-Id: I244a96a940f82902a20e817fd13fe32026607ce3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-22 17:25:01 -07:00
Konstantin Shcheglov 64baa393e5 Elements. Deprecate JoinPatternVariableElement.variables2, use 'variables' instead.
Change-Id: Ie896718aa19a5867be1a05a210ffb28a0daaa79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429824
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-21 13:59:30 -07:00
FMorschel 37edff79b1 [DAS] Adds new Remove async assist
Fixes: https://github.com/dart-lang/sdk/issues/59814
Fixes: https://github.com/dart-lang/sdk/issues/23962

Change-Id: I8121da0106f4f81b93bfcdc0908b0977210fa3c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425602
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-05-20 12:56:40 -07:00
Sam Rawlins 08c541aa9c analyzer_plugin: support library_private_types_in_public_api lint rule
Luckily, the two cases which were reported could both be remedied by
making more things private.

* `DartFileEditBuilderImpl.librariesToImport` exposed `_LibraryImport`,
  but could be made private anyhow. Also, it's package-private code,
  so this is not a breaking change.
* `CodegenVisitor.generateConstant` accepted a private type as an
  argument, but the whole class can be made private.

Change-Id: I8613812385ed0e9a7e36922d86889dad4cedf3cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428924
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-16 13:45:57 -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
Konstantin Shcheglov 05da3e1f22 Elements. Deprecate Element.enclosingElement2, use enclosingElement.
Change-Id: I055b1f9dd1c00605d813effcbbadb9cea874129a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-05-15 13:47:32 -07:00
Brian Wilkerson 5f75bb8ba2 Replace change builder copying with a transactional model
Copying change builders in order to enable reverting changes from a
single correction producer when there's an exception is expensive.

This CL replaces that implementation with a transactional model.
Clients are not required to start a transaction (that happens
automatically), but are required to signal the end of a transaction by
invoking either `commit` or `revert`. (Actually, `commit` is assumed
if neither method is invoked before computing the `SourceChange`.)

There is some information in the Dart file edit builder related to
imports that isn't correctly handled. The reason for this is that too
much of the import computation is done up-front. I don't think this
will be a problem in practice (or at least not often), but we should
come back at some point to change the implementation so that we retain
abstract data longer and perform more processing at the very end (where
we'll have complete information and probably be able to do a better
job anyway).

This CL improved the performance of the benchmark that adds and applies
fixes for 10,000 lint violations.

  Before it took an average of 11216.0 ms.
  After it took an average of 4200.2 ms.

Which is about a 62% improvement.

Change-Id: I12710606455a04e34a82308ede5d9fba1c68b972
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428060
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-15 10:12:20 -07:00
Danny Tuppeny 8642ff0108 [analysis_server] Make fix/assists consistently use "initializing formal" instead of "field formal"
There was a mix of the term "field formal" and "initializing formal" in fixes and assists. This changes those that used "field formal" to "initializing formal" (which seems to be the term used most here and on the website).

I did not update all places that use this (for example there are many in the analyzer, including classes).

Change-Id: Ia4a1095a756adb35ca7faa8dc06c541abb04bfcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413781
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-13 16:24:46 -07:00
Konstantin Shcheglov 93f453912a Make 'token' a required named formal parameter of SimpleIdentifierImpl constructor.
For consistency.

Change-Id: I1b391353cffc0ad41cb81df51cd5a57fb9207c5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-12 09:28:18 -07:00
Konstantin Shcheglov 7eea262f06 Deprecate NamedType.name2, use 'name' instead.
Change-Id: I27725e1530c60a6aa2e197b97e027de1238c964a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427980
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-12 08:35:59 -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 5d6dc673dc Make nodeCovering a method on CompilationUnitImpl rather than an extension method
This allows us to traverse the children without needing to create lists.
It also allows us to iterate over lists of nodes more efficiently.

Tested against the script that computes fixes for 10,000 diagnostics,
I'm seeing the following result.

  Before this CL the average time was 10692.4 ms.
  After this CL the average time was 1900.0 ms.

That's just over an 82% improvement.

Change-Id: Ideff745288c8990e9948b22c5204d176af3cac6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426904
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-07 09:05:52 -07:00
Sam Rawlins 126def2b08 analyzer_plugin: Use Diagnostic instead of deprecated AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Icf62987d6de7cafb6f6e92076a5fcc2bd48772c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426522
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-05 11:34:00 -07:00
Sam Rawlins cfa4be3d93 analyzer: Use DiagnosticSeverity in analyzer packages
Work towards https://github.com/dart-lang/sdk/issues/60635

DiagnosticSeverity is the new name for ErrorSeverity.

Change-Id: I9d1040f23d4fe8affb234ff62527133e439adf50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-03 17:14:04 -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 35e8b9ba0b analyzer: Deprecate ErrorType in favor of new name, DiagnosticType
Change-Id: I552e816de6d526e3476cac9dd3ee2919fc7ec499
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425720
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2025-04-30 19:07:42 -07:00
Sam Rawlins 992cfb13bc analyzer: Deprecate AnalysisError.correction; simplify other final fields
Work towards https://github.com/dart-lang/sdk/issues/60635

* `AnalysisError._contextMessages` unnecessarily backed the public
  `contextMessages` getter; the field is final so it can be public
  itself.
* `AnalysisError._correctionMessage` unnecessarily backed the public
  `correctionMessage` getter; the field is final so it can be public
  itself.

Change-Id: If269d4ed590ef7df81d9b9e3be03766601526d7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425620
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-04-30 16:06:19 -07:00
Brian Wilkerson a676b7f700 Improve the performance of the bulk fix processor
This improvement was found by Jens.

The bulk fix processor needs to be able to revert a partial set of edits
that can't be completed because of a conflicting pre-existing edit. In
order to do that efficiently it needs to know whether there are any
edits to be reverted, which it used to do by computing a hash from the
edits both before and after running a correction producer. Computing
the hashes is expensive.

This CL changes the detection to use a modification counter that's
incremented any time new edits are added, removing the computation of
the hash values.

I don't yet have a benchmark for the case that uncovered the issue,
but I do have code that generates a file containing 10,000 violations
of the prefer_single_quotes lint, requests bulk fix results 5 times
to warm up the VM, then requests fixes 5 more times and prints an
average (the times between runs are fairly close, so the standard
deviation is small). The code uses the legacy protocol to request the
fixes, but it doesn't execute any of the code in dartdev.)

    Before this change the average was 20670.6 ms.

    After this change the average ise 13979.0 ms.

This represents a 32% improvement.

Change-Id: I74c079bef8e095acf4ad36de6d0c0241934f79a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425221
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2025-04-29 07:29:01 -07:00
Konstantin Shcheglov b2fdd8a345 Elements. Rename XyzElement2 into XyzElement.
The CL was done with rename + adding typedef for each class.

Change-Id: Ia25cc581d2e42cf7d12a85a3579af952d5c232ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424687
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 13:27:18 -07:00
Konstantin Shcheglov 49599e06cc Elements. Deprecated element2.dart library.
Change-Id: I2be38df49e6f242d9fe59f34164549da4a0f41b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424683
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-04-25 11:23:18 -07:00
Sam Rawlins 52f965e217 Analyzer: Remove outdated NodeLocator class
Change-Id: If8cff437d35452af5a19b4d414352228f899a94f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423216
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-21 10:11:30 -07:00
Sam Rawlins bc230b73aa Deprecate the unused importPrefixGenerator parameter of ChangeBuilder.addDartFileEdit
Change-Id: Ic8bad9999359d3670ea58fe9594e744d6560a030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2025-03-31 09:53:57 -07:00
Sam Rawlins d592a7eb26 DAS: Remove dead DartFileEditBuilderImpl code
* Privatize `DartEditBuilderImpl.dartFileEditBuilder`.
* Rename the `toAdd` parameter on `_addAll` to `items`.
* Remove the unused `required` argument on `_canWriteType`.
* Privatize `DartFileEditBuilderImpl.createEditsForImports`,
  `.codeStyleOptions`, and `ensureShown`.
* Remove the unused `useShow` parameter on
  `DartFileEditBuilderImpl.importElementLibrary`.

Change-Id: I473788d9d566a2982914c374fce2429909466381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418703
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-03-31 08:46:20 -07:00
FMorschel 35f84de658 [DAS] Fixes navigation to pattern variable with multiple declarations
Bug: https://github.com/dart-lang/sdk/issues/60398
Change-Id: Ibdb1681075c4a097a50483628af50da055cc751d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417905
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-03-27 11:11:16 -07:00
Konstantin Shcheglov bb676ba1f5 Elements. ElementImpl is not Element2.
Change-Id: Ia8885018d3e23875e53dfa0d3cf470bdd28eef29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-03-17 08:46:49 -07:00
FMorschel 48943ce460 [DAS] Provides DocumentLinks for lints in analysis_options.yaml
R=pquitslund@google.com

Fixes: https://github.com/dart-lang/sdk/issues/60185
Change-Id: I109ccba725af08cb037ac2b3ffa8d108926d15bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-11 12:26:00 -07:00
Sam Rawlins 68d05068aa analyzer: Extract out two common utilities for URIs
* Uri.isSamePackageAs(Uri) and Uri.isImplementation are each used a
  few times. Not as much as I would expect, but this still simplifies
  some code.

Change-Id: Ie9020916c793852a0df9d04154420948d942d951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413801
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-03-10 08:26:12 -07:00
Sam Rawlins 4ee4acc93c DAS: Tidy docs and API in import_library.dart
Change-Id: I2e18a9113ec96ec33fbf71e656ab0045496599c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413721
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-03-05 10:42:30 -08:00
FMorschel 4aa8b10978 [DAS] Makes "Add type annotation" consider explicit type arguments
R=scheglov@google.com

Fixes: https://github.com/dart-lang/sdk/issues/60080
Change-Id: I88bb6c3ece6f6a95bc22aa57e34aa16afa34bc7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412540
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-03-03 07:46:28 -08:00
FMorschel 58ff654dd5 [DAS] Adds 'Create extension method/operator' fixes
R=srawlins@google.com

Fixes: https://github.com/dart-lang/sdk/issues/60203
Change-Id: I2527c130dd68cf678ac4529eda42397ef80ca53c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412060
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-28 14:20:16 -08:00
Brian Wilkerson a59bae3f37 Cleanup code in analysis_server_plugin
Change-Id: I596a5a516136b4bd024b8f72b11df6eb641075ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412680
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-27 11:44:14 -08:00
FMorschel 1d4ebf7594 [DAS] Fixes extension and typedef dart docs
R=srawlins@google.com

Bug: https://github.com/dart-lang/sdk/issues/59724
Change-Id: I9a4a7390e71b1e1fd2daa0f3e548f28cd34834cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411380
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-25 07:57:12 -08:00
Danny Tuppeny a31be9beba [analysis_server] Provide DocumentLinks for packages in Pubspec.yaml
Having quick links to pub.dev in pubspec.yaml is a long-standing request, but all of the API options to implemented it seemed bad.

However I was recently made aware that DocumentLinks (which we use for the Flutter example links) support HTTP links and this turns out to be a perfect fit (credit to https://github.com/orestesgaolin for the idea).

Links are built based on the kind of package, so `git` and `hosted` packages will be built accordingly (I special-cased GitHub SSH links but don't know if this could be generalised for other Git-hosting services). We use PUB_HOSTED_URL as the default base for standard Pub packages.

Packages that don't have URLs (such as `path`, `sdk: x` or other unknown kinds) will not produce links.

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

Change-Id: I1c9e704f67736bbc451866a9e10f7928e2246c7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409660
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-02-20 09:36:01 -08:00
Konstantin Shcheglov 7964d55940 Elements. Migrate TopLevelDeclarations.
Change-Id: I9bdcf6ac8c26bfa2eb50de8efd8c2a3a3538403a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-14 14:46:37 -08:00
FMorschel 6de0ef3d5f [DAS] Fix auto-complete update combinators
We already have a quick-fix that allows us to use the same existing import by editing the combinators. The auto-completer now should do the same.

Bug: https://github.com/Dart-Code/Dart-Code/issues/5238
Change-Id: I0f3a50299abb9890370a6c8934b49036f7e03196
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404525
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-02-03 11:15:57 -08:00
FMorschel 1372538855 [DAS] Fixes import prefix go to definition (multiple)
R=keertip@google.com

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

Change-Id: Ida0cb58cdb4267af31a87a29862a3f4f2e28907f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405201
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-02-03 09:18:52 -08:00
Danny Tuppeny 154b473cdb [analysis_server] Fix missing dartdoc references in Library comments
Fixes https://github.com/dart-lang/sdk/issues/59946

Change-Id: I3b8558f72b6cc932f2c87ee4f2e993c5584907a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 13:00:30 -08: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
Keerti Parthasarathy 70e77158e6 Elements. Migrate lib/src/utilities/completion/optype.dart
Change-Id: I46f1f2e6de31d2583b21c3f96699e85e0b4feab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403840
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-13 22:04:10 -08:00
Konstantin Shcheglov 8bbe6fbdfe Elements. Report analyzer_use_new_elements without any txt file, add file ignores.
Change-Id: I13125f93a6633563ed6853a622bd9fec045bfc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403923
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-10 15:20:59 -08:00
Konstantin Shcheglov 2de8b5efb0 Elements. Migrate lib/src/utilities/navigation/navigation_dart.dart
Change-Id: Ia3a98eaa939c5efcf62d8f2c3490e92ee731ab6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403905
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-09 14:07:07 -08:00
Konstantin Shcheglov 4be4ec7d36 Elements. Migrate AnalyzerConverter.
Change-Id: Ia3da05853e97e64899358bdc787c0226ba036bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403904
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 13:37:59 -08:00
Konstantin Shcheglov 75882f9bf7 Elements. Migrate CompletionTarget.
Change-Id: I3a7f4d13d0174ff282a1ead65616a8db685ef0d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 12:51:58 -08:00
Konstantin Shcheglov 26d91675f9 Elements. Migrate ElementSuggestionBuilder and related.
Change-Id: I3f282c1ec2f2ba277d9ae011b4723fa835e44c37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-09 12:19:03 -08:00
Konstantin Shcheglov 4356eacd87 Elements. Migrate lib/utilities/completion/suggestion_builder.dart and required.
Change-Id: I6331e3f620bdaaec2a618aa0f6651099bdc606c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403921
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-09 11:25:58 -08:00