Commit Graph

329 Commits

Author SHA1 Message Date
Varad Raj Agrawal 6a678d1f49 Quick fixes that create constructors use new-style syntax when primary_constructors is enabled
Closes https://github.com/dart-lang/sdk/pull/63534

GitOrigin-RevId: 345471bc33c002bbca9cea9c6626a05f481f70e3
Change-Id: If8d533ab0bbb4e6dff51a4256101fb8cb0490fb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/509680
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-06-09 10:57:01 -07:00
Brian Wilkerson f2319d4ed4 Support fixing codes not enabled in the options file
Codes specified on the command-line are force-enabled in all of the
analysis options for all of the files. This is done in a brute force
way, but it should be safe because the code is creating an analysis
context collection just for this one run, so the options objects
should be short lived.

Closes https://github.com/dart-lang/sdk/issues/63345

Change-Id: I8925da426d6cb5b9ce686725e3b95696b552cae0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505045
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2026-05-21 12:57:18 -07:00
Konstantin Shcheglov e20704c3b0 CQ. Move PackageConfigFileBuilder to analyzer_testing.
Move PackageConfigFileBuilder into the analyzer_testing public API and
deprecate the copy exposed from package:analyzer. The builder is only
used by test infrastructure, so keeping it in analyzer_testing makes the
ownership clearer and avoids exposing test-only utilities from analyzer.

Update the builder API to accept a rootFolder instead of a rootPath.
This lets callers pass the resource-provider folder directly, so the
generated rootUri is derived from the same file-system abstraction that
created the test files. This avoids accidentally passing POSIX paths
where resource provider paths are required, such as on Windows.

Update existing test utilities and callers to import the new library and
pass Folder objects. Remove the production analysis server dependency on
the builder by emitting the temporary plugin package config JSON
directly.

Change-Id: I46b14710626e0d6d5884afcdc5a05b23077acfc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499081
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2026-04-29 13:18:35 -07:00
Danny Tuppeny b93488cd4c [analysis_server] Prevent server responding twice to refactor requests
If a refactor request failed with an error, the `request` field wasn't cleared, so the next refactor would cause a cancellation response to be sent for the previous (already-responded-with-an-error) request.

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

Change-Id: I36072556e91f92b50d493833532a81908bf4e6ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464440
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-11-25 10:00:59 -08:00
Brian Wilkerson b8b41cbbba Add support for logging communications from plugins
I believe that this is the final piece to having all of the information
needed by the replay tool.

Change-Id: I367d628302c06397706172ba65c0de64972a2a34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459543
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-11-04 14:44:40 -08:00
Danny Tuppeny 6dac72652a [analysis_server] Update some more tests to handle EOL normalization
This sets `useLineEndingsForPlatform=true` for basic completion tests that now pass, but leave it set to `false` in `AbstractCompletionDriverTest` for now because there are a large number of failures in other tests that use that base class due to hard-coded offsets.

It also updates the format tests to support this (plus extracts some helpers to reduce the duplication).

Change-Id: Id2a0323b4605761d05e30bee89f7dccebb1f48c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-09-23 09:46:19 -07:00
Danny Tuppeny 6be105bb24 [analysis_server] Normalize test sources in base class
This adds code to normalize file contents in `PubPackageAnalysisServerTest.newFile()` so all tests using this base class normalize their source newlines by default (this ensures we run with \r\n on Windows, regardless of the git settings always using \n in this repo).

A flag `useLineEndingsForPlatform` allows option out of this, and any tests that currently fail in this mode set this in their setUp - with the exception of a few that were just trivial fixes.

This will make it easier to fix the remaining tests (by looking at code that does `useLineEndingsForPlatform = false`, deleting it, then fixing those tests).

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

Change-Id: If05bc5f7fe3007151c1290831157b6a62d6bf651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449880
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-16 19:37:19 -07:00
Danny Tuppeny 31f75e7399 [analysis_server] Remove hard-coded offsets from some more tests
See https://github.com/dart-lang/sdk/issues/60234

Change-Id: I8bc51365611a51596b7511c35135002156acec6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449806
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-09-16 16:54:11 -07:00
Sam Rawlins 33f664940a Bump DAS to use Dart SDK 3.9.0
Change-Id: I04bc285d822a657adb5573c6de3eb38655ab0fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448232
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-09-03 12:56:29 -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 649944c76d DAS plugins: Rename PluginInfo to PluginIsolate; move to separate library
Work towards https://github.com/dart-lang/sdk/issues/61386

A few distinct changes:

* Rename PluginInfo to PluginIsolate
* Move PluginInfo and PluginSession to a new library,
  plugin_isolate.dart. PluginSession is _essentially_ a private class
  to PluginIsolate, so it's good to co-locate them.
* Move PluginInfo tests and PluginSession tests to a new library.
* Extract out shared parent class for PluginManager tests,
  PluginIsolate tests, and PluginSession tests.

Change-Id: Ib0c638b8797f51c57c07e277acdaea6d8202f957
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-08-26 19:02:42 -07:00
Sam Rawlins cc28d8ca3d DAS: Remove AnalysisServer.supportsPlugins
I'm not sure of the history of this static final field, but it is not
commented, nor are there any hints of the value changing. It can just
be removed.

Change-Id: I310511fb63000a728f21a96c40b34f8d8798b366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446281
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-08-21 13:28:59 -07:00
Sam Rawlins 456e81eacc DAS: Remove a mock PluginInfo; can use the real one instead
Change-Id: I4c1cdb879f5f0d3370752721298a9b089db5e849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445523
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-16 09:17:29 -07:00
Sam Rawlins 24a54eb1f4 DAS: Remove unnecessary PluginInfo subclasses; privatize members
I don't know the history here, but there was a BuiltInPluginInfo
subclass, which has no instances (dead code), and a
DiscoveredPluginInfo class. So I deleted the former, and merged the
latter into the superclass, PluginInfo.

I also made a few members private, in PluginInfo, PluginManager, and
PluginSession. I modernized comments along the way.

This all paves the way for adding information to PluginInfo about
_new_ plugins, for use in the diagnostics pages.

Change-Id: Ib7c5deebd43e5636141ed36ddb3d5da7cf325883
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445405
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-08-15 09:50:30 -07:00
FMorschel fae7752e9e [DAS] Adds tests for fix priorities and new priority for Create class
The related issue asked for a new priority for the `Create class` fix
that would be lower if the undefined name was lowercase, giving the
`Create method` and `Create function` fixes a higher relative priority.

This change also adds a new abstract class to test the relative priority
between fix kinds. It is also used to test agains the merge combinators
fixes.

Fixes: https://github.com/dart-lang/sdk/issues/60523
Change-Id: I938f52a577ecf1b6bb8dd66c94fd45395a011ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422321
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-05 16:58:40 -07:00
Sam Rawlins bd700772ff analyzer: move testing utilities to analyzer_testing package
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: Iae062d95e5cf3b94b540496242b3627268ac2612
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428844
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-05-15 16:28:50 -07:00
Sam Rawlins 3021cc4913 analyzer: Move PackageConfigFileBuilder to public API.
Work towards https://github.com/dart-lang/sdk/issues/55660

Change-Id: I3df2cd374f6b3ef9e027f0e07c748be6ea21ebb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427586
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-09 10:57:55 -07:00
Danny Tuppeny 16d6594346 [analysis_server] Wire up analysis_options formatter/trailing_commas to formatter
+ validation + code completion

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

Change-Id: I383c888756e29e091c7abf8d4b8df66387714e31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424440
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-24 11:59:05 -07:00
Sam Rawlins 5eef8e4ebe analyzer etc: move analysisOptionsContent function to be shared
This function was defined once in analyzer testing code, once in
linter testing code, and once in analysis_server testing code. In this
change, all three are combined into one function in analyzer_utilities.

Change-Id: Ib2daa7b3d14aae6ca2aa09f6f9bdeaf76bc72d10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423068
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-04-21 13:01:36 -07:00
Sam Rawlins b40c30898c DAS: Fix ElementLocator for the SimpleIdentifier under a ConstructorSelector
With the `nodeCovering` utility, ElementLocator is given the
SimpleIdentifier _under_ a ConstructorSelector, in code like:

```dart
enum E {
  one, two.^new();
}
```

ElementLocator previously did not handle this SimpleIdentifier
correctly.

Change-Id: I32296dea2aaef6df33e56da23b77a4f83d06c9e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423063
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-04-18 13:34:12 -07:00
Brian Wilkerson d6eca31417 [cq] Support use of TestCode in more tests and clean up refactoring_test
Change-Id: I2b939042654fcc8a1b97edf5644769669ffa45e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418400
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-27 13:30:31 -07:00
Sam Rawlins a804d0d2e5 DAS: Require assists to be registered
This is required so that an analyzer plugin can process producer generators that are registered in a plugin isolate.

* Change `AssistProcessor._generators` and
  `AssistProcessor._multiGenerators` into private top-level variables
  which are only used as "built-in" assist processor generators. They
  must be explicitly registered, which we see much of in this change.
* Rename all of the lists of _generators_ and maps with lists of
  _generators_, which were named "producers". The new names are
  "generators." This leads to giant diffs because of alphabetizing.

Change-Id: Id4432737daaec1bb282f0b387619b23c18c0ea55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-03-12 12:07:40 -07:00
Brian Wilkerson 07ae3d6159 [cq] Remove the last uses of a comment-based cursor position
Change-Id: Ie5e9c81a6e35cd5da411620dacdbea5429ca454c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414460
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-11 14:10:58 -07:00
FMorschel 82c3d74505 [DAS] Renaming positional parameters to rename hierarchy equivalent
Fixes: https://github.com/dart-lang/sdk/issues/53187
Change-Id: Ie0aaea2e24667ad04a95ce6522fd687710501230
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412520
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-03-07 10:29:44 -08:00
Brian Wilkerson 2aa14dbe98 [cq] Convert some uses of a comment marker to use TestCode
There are a couple of other places where this older convention is still
being used, and I hope to clean them up as well.

Change-Id: I84d7e8d81778b6b7b69060df6eda5db2a6aaf256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414161
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-03-07 10:15:59 -08:00
FMorschel 83a16ea8a7 [DAS] Fixes renaming fields at constructor parameters
Fixes: https://github.com/dart-lang/sdk/issues/52305
Change-Id: I39a547c391ffd3538b3ccaafeab3af65bb4088b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413340
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2025-03-07 09:27:32 -08:00
Brian Wilkerson d18af76865 [migration] analysis_server.dart
Change-Id: I111faf848d4243f72fb5e9bf20393784d6ed1fcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410180
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-14 12:15:10 -08:00
Konstantin Shcheglov 2946ea71d5 Macro. Remove more from analyzer/ and analysis_seever/.
Change-Id: Id5426cce73395d3d95657cf1e0b5f9d85fe3f574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406921
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-31 11:35:10 -08:00
Konstantin Shcheglov a5468363c6 CQ. Remove unnecessary 'async' where no 'await'.
Change-Id: I58f56c098c9cec753325ab56d0aad37e1fde0ec6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403082
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-01-07 10:08:11 -08:00
Konstantin Shcheglov 143bbe0a05 Elements. Use identical() to compare ElementImpl(s), other elements.
Change-Id: If2abddeaea0551fa4646027ad8aa1bb4fd255660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401760
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-19 13:17:19 -08:00
Konstantin Shcheglov 6494efb192 Elements. Use identical() to compare ElementImpl(s).
Change-Id: Idbe935bc6ae333d9940d8ea53ad44011eff237ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401384
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-18 14:25:00 -08:00
Danny Tuppeny 619c8511ab [analysis_server] Add tests for formatter language version for legacy protocol
LSP already has equiv tests in `test/lsp/source_edits_test.dart`.

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

Change-Id: I70a836e4de9a50816f08382b81c0fc4a3f3e6fba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397540
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-02 19:32:41 +00:00
FMorschel 06caa3fa11 [DAS] Adds new import with show option
R= srawlins@google.com

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

Change-Id: I3acb03cc6d9a5f8bc1ebaf590a45ac5ee10388f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396564
Auto-Submit: Felipe Morschel <fmorschel.dev@gmail.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-12-02 18:54:59 +00:00
Danny Tuppeny 9350b85b17 [analysis_server] Add a missing 'await' that may prevent handling of InconsistentAnalysisException
This test (without the code fix) reproduces an infinite loop in the GetFixes handler. There is error handling for `InconsistentAnalysisException` but it didn't appear to work (at least in some cases) because it's async and there was no `await`.

Change-Id: I835398062ea3da1386c2bc065bbdaf93cf10cdf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396820
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-11-21 16:04:47 +00:00
Danny Tuppeny be7a40dd78 [analyzer] Ensure parseFileSync() flushes pending file changes
Fixes https://github.com/dart-lang/sdk/issues/57120
Fixes https://github.com/dart-lang/dart-pad/issues/3092

Change-Id: I803cdc19702bcd357cdafde3176ecad246495182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396003
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-11-18 19:05: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
Danny Tuppeny 97dafd74f5 [analysis_server] Consider sort_constructors_first lint when sorting
Fixes https://github.com/Dart-Code/Dart-Code/issues/4934

Change-Id: Ic6c739a2aaf6f62ecf0c2488a32f90c3f19738a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-10-29 20:04:49 +00:00
Danny Tuppeny 75d15bbfa3 [analysis_server] Support formatter page width from analysis_options in legacy protocol
This adds the same support previously added to LSP to the legacy protocol.

As with LSP, the value in analysis_options overrides the explicit argument (since the expectation is that the user has not specifically chosen this value for this file, but rather as a default for the project/globally).

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


[analyzer] Add support for "formatter" in analysis_options + use page_width in LSP

This adds support for validation + completion for `formatter/page_width` in analysis_options, and uses this value in preference to the client-supplied value in the LSP server.

It does not yet add support for the legacy protocol, and there are a few questions in https://github.com/dart-lang/sdk/issues/56864#issuecomment-2399289974.

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

Change-Id: Ic2be00087f78eb62c409dbc8f558d2f24b521f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-10-08 17:31:46 +00:00
Parker Lougheed a409a1c07d [analyzer/linter] Use shared enumeration for lint names
This helps to avoid any accidental mispellings, enables find usages, and potentially makes future renames easier.

The primary goal is to make future work in https://github.com/dart-lang/sdk/issues/56835 easier.

Change-Id: I684630a4d6cb145031de0dabc221f247246ea00c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388042
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-10-03 21:36:49 +00:00
Ann Marie Mossman 1c0c5f355f Issue 54063: fixed formatting issues
Issue 54063: Adding in file quick fix support for missing semicolons and associated test

R=srawlins@google.com

Bug: https://github.com/dart-lang/sdk/issues/54063
Change-Id: Ia1a20129e3c630d977ab3d40bf8e79b0ed852936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373326
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Ann Mossman <mossman@google.com>
Auto-Submit: Ann Mossman <mossman@google.com>
2024-07-02 17:30:49 +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
Konstantin Shcheglov 5c07c89a35 Enable 'unnecessary_final' in analysis_server/.
Change-Id: I71ee934b915d4aff924cf5925f87bcc9adc6c015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362901
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-16 20:04:15 +00:00
Keerti Parthasarathy 8dcb212010 Issue 53669: Remove duplicate await when inlining methods.
Fixes https://github.com/dart-lang/sdk/issues/53669

Change-Id: I64eb73d5eef4a8a8ab5184b3e67bb2303faed5e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360580
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-02 14:47:02 +00:00
Konstantin Shcheglov a09fa058d2 Completion. Issue 38235. Check if isPostfixCompletionApplicable invoked inside a comment.
Bug: https://github.com/dart-lang/sdk/issues/38235
Change-Id: I97108bb549d220d45dba35147c0e1fe53fe6b597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357985
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 18:12:24 +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
Keerti Parthasarathy 19d11a70af Add expectations for rename test.
Change-Id: I95c067030bb836416844f5334982eab152624214
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353785
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-02-22 22:09:37 +00:00
Keerti Parthasarathy 167c0a1b78 Add tests for rename with macro code.
Change-Id: Ifa0d5245918c06fa3eda1532560523263682bd43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-02-22 19:22:57 +00:00
Brian Wilkerson b204f82059 Disable fixes, assists, and refactorings in generated files
Change-Id: I5c9f36b0edc270cab774f355eec9183940b7e6ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352380
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-15 22:20:58 +00:00
Danny Tuppeny 581686b8fb [analysis_server] Consolidate some more writePackageConfig() methods
+ tidy up some redundant package versions that are inherited from the ConfigurationFiles mixin.

Change-Id: I93329cbf65af3a68ed27284903e7becac01cf5ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-01 19:11:27 +00:00
Sam Rawlins 3f91beb64f analyzer: Separate FixProcessor from built-in fix producer mappings
In order for CorrectionProducers to be used in analyzer plugins, we
need to access DartFixContributor which needs to compute fixes via
FixProcessor. So both DartFixContributor and FixProcessor need to be
moved into analyzer_plugin (eventually). For now, to support
prototyping, I am moving FixProcessor to its own library, and
separating all of the built in mappings (from diagnostic to producer
generators).

I think this separation actually stands on its own as being tidier,
simplifying fix_internal.dart, and separating code from data, as it
were.

Work towards https://github.com/dart-lang/sdk/issues/53402

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try
Change-Id: I3b4fadc7ed94c23597d72bef7dcd832380d34e9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345561
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-15 23:41:29 +00:00