55 Commits

Author SHA1 Message Date
Paul Berry afcfbbeba8 Migrate developer experience packages to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288)

This change migrates the packages owned by the developer experience
team to use the new constructor declaration syntax, described in
https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations.

This change was performed in an automated fashion, by (a) bumping the
packages' SDK constraints to `3.13.0-0`, (b) enabling the lints
`unnecessary_type_name_in_constructor` and
`unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint
failures using `dart fix`, and then (d) reformatting the affected
files.

To ease code review, I've reverted unrelated formatting changes.

Since this change requires bumping SDK constaints to `3.13.0-0`, it
was only performed on packages that are *not* published on
pub. (Packages that *are* published on pub should remain on lower
language versions until at least after the stable version of 3.13 is
released, so that we don't block users on the stable channel from
receiving updates to those packages.)

Change-Id: Ibb4daebafd239da58251e838ea6a3f336a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/505046
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
SLSA-Policy-Verified: SLSA Policy Verification Service <devtools-gerritcodereview-exitgate@google.com>
2026-05-27 14:52:58 -07:00
Paul Berry 2b5e655c34 [messages] Fix test failure output.
Changes the test logic in `analysis_server` and `analyzer_testing` so
that after printing `To accept the current state, expect:`, it prints
diagnostic codes in their proper camelCase format.

Also removes some bogus code from
`pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart` that
erroneously suggested passing a `name:` parameter to the top level
`error` function. This function does not accept any parameter called
`name`.

Previously, only tests in `pkg/analyzer/test` printed the diagnostic
codes correctly.

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

Change-Id: I6a6a6964b17cf798c1355e09f9a4633e1fbe388c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-02-12 10:15:31 -08:00
Danny Tuppeny 9ad2074691 [analysis_server] Add tests for primary constructors in LSP workspace symbols
Primary constructor bodies do not currently show up here. The primary constructor entry in the results navigates to the declaration.

Change-Id: I321bd4dfa5a98635987b165575d0f683a437e129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/473340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2026-01-16 10:07:25 -08:00
Paul Berry ca7780c402 [messages] Use lower case diagnostic names in analysis_server.
Changes the logic in `pkg/analysis_server` to use
`DiagnosticCode.lowerCaseName` instead of `DiagnosticCode.name`, and
`DiagnosticCode.lowerCaseUniqueName` instead of
`DiagnosticCode.uniqueName`. This ensures that diagnostic codes are
matched in a case-insensitive fashion.

This paves the way for deprecating (and eventually removing) the
`DiagnosticCode.name` and `DiagnosticCode.uniqueName` getters.

Change-Id: I6a6a69643ef19385ab43d7a04809e58305ca4f0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466185
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-12-09 06:25:01 -08:00
Keerti Parthasarathy 8eb7db130d Change the message scheduler page to display the list of messages in the order they were received.
- wait for message to be completed and then set completed (this changes the order of messages in the listener, changes test results).
- do not put lsp.ResponseMessage on the queue (we never did, but were adding it to the listener)
- store the messages in the order received, compute the display json string on demand.
- keep track of pending and active messages when an incoming message goes on the pending queue, and when it moves to active.

Change-Id: Ife8246cdc92c5f81f9db7a7c11072ee647cd2bdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-11-12 09:25:41 -08:00
Danny Tuppeny b0284db9f4 [analysis_server] Update LSP Selection Range tests to use EOL normalization
This is work towards making all tests normalize EOLs to the current platform by default.

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

Change-Id: Ie378089517698cc100d959108ed6445b901de048
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-10-20 08:23:19 -07:00
Danny Tuppeny 931a7e1797 [analysis_server] Update cider tests to use EOL normalization
This is work towards making all tests normalize EOLs to the current platform by default.

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

Change-Id: I3a7162ad59d54967dc208aa7a951a03d0405dc71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/454842
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-10-14 07:33:59 -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
FMorschel c14b6eb81c [DAS] Adds lints for boolean literals to analysis server packages and fixes occurences
Bug: https://github.com/dart-lang/sdk/issues/59789
Change-Id: I3287ab55a1b3048c5cbf7f820563fbbd5a292512
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445920
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-08-28 10:29:10 -07:00
Danny Tuppeny fb22849379 [analysis_server] Extract expected offsets in Extract Local test
Follow-up from https://dart-review.googlesource.com/c/sdk/+/441840.

Change-Id: I085099fde59fce052b01fd06a8cc41a83f55ac24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Danny Tuppeny <danny@tuppeny.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-07-29 11:45:03 -07:00
Danny Tuppeny 02ea7d0b14 [analysis_server] [lsp] Support return/yield/break/continue in Document Highlights
This adds support for keywords like `return`, `yield`, `break`, `continue` to Document Highlights. For break/continue, the matching loop keyword (`do`/`while`/`for`) is also highlighted (and this works in both directions). This behaviour matches what I see for TypeScript in VS Code.

This is only supported for LSP because the legacy protocol groups these by "Elements" which we don't have for loops (though since IntelliJ uses its own data for occurrences, it's not clear to me if anyone is using Occurrences over the legacy protocol).

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

Change-Id: I5563ec0a91a6fe33d10a6317d33e9256b3c50209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/442061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-07-24 10:47:40 -07:00
Sam Rawlins ee69f45a1f analyzer: rework AnalysisErrorListener deprecation
Work towards #60635

In this change, we rework the AnalysisErrorListener deprecation to
better support users who have their own class that implements
AnalysisErrorListener. This change introduces a sealed supertype,
DiagnosticOrErrorListener, with the old implementation,
AnalysisErrorListener, and the new implementation, DiagnosticListener,
as its sole direct subclasses. Users who have implemented
AnalysisErrorListener should be able to instead implement
DiagnosticListener, and their class is an acceptable instance of
DiagnosticOrErrorListener, wherever that is needed.

In a breaking change we can drop AnalysisErrorListener and deprecate
DiagnosticOrErrorListener, and in the next breaking change, we can drop
DiagnosticOrErrorListener.

For reference, see the first API difference when deprecating AnalysisErrorListener and introducing DiagnosticListener: https://github.com/dart-lang/sdk/commit/903d77cc8229972a424941dcb7b7b79741e833eb#diff-dec15868961d7eadcd009f49d129bebcdb747aaa8dbfde5f5a08884e0cf11e32

Change-Id: I3ccf11d54b41fbca98d020d89978d250c16b4c04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436480
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-25 06:54:20 -07:00
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
Sam Rawlins bddcddfe6b analysis_server: use new Diagnostic name over AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I5cc0cc66afd3531271eb8dc337556505cb21c074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-06 16:00:25 -07:00
Sam Rawlins 903d77cc82 analyzer: Rename ErrorListener classes to DiagnosticListener
Work towards https://github.com/dart-lang/sdk/issues/60635

I tried to keep this minimal but still sensible:

* Rename AnalysisErrorListener and all subtypes to use 'Diagnostic'.
* Rename all instantiations of such classes if they previously
  contained the word 'error'.
* Rename `RecordingDiagnosticListener.errors` to `.diagnostics`.
* Rename some _testing_ instance members that had the word 'error'
  to instead use 'diagnostic'.

Change-Id: I3948e27ba28ac2494092e04f4e1d201a20cc1135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433004
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-05 14:05:40 -07:00
Danny Tuppeny 8d36178a43 [analysis_server] Move support for locking requests to the scheduler
This removes the original `lockRequestsWhile` functionality of the LSP server which worked by pausing reading from stdin to instead pause the processing of messages in the scheduler.

Change-Id: I737e977adee11fe6fc70f44185cfaa22c22805da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:06:12 -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
Danny Tuppeny 49e7d4ac83 [analysis_server] Support "Fix" CodeActions via commands if client doesn't support CodeActionLiterals
This updates fixes to return either CodeActionLiterals or Commands based on the capabilities of the client (similar to was done previously for assists).

Change-Id: I688cb80aef415d329d65092edba247e5ec7a5a13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428783
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-15 10:54:48 -07:00
Danny Tuppeny 4b4e3f4964 [analysis_server] Update CodeActionsProducers to support either kind of CodeAction
No functional changes, just some additional refactors extracted from an upcoming CL to make it easier to review. This updates the `CodeActionProducer`s (and related code in `CodeActionComputer`) so their signatures use `CodeAction` instead of `CodeActionLiteral`, which means this code will be able to support `Command` code actions in future.

Mostly it's trivial changes, but the code that de-dupes and merges actions needed a little more updating to handle the different kinds.

Change-Id: Ic2255b2d9864b6974a542d1d3ee3b099c4d5ea32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427222
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-05-07 08:41:25 -07:00
Danny Tuppeny 3c161d3fd1 [analysis_server] Move CodeActionKind filter earlier in production of code actions
This removes a filter of CodeActionKinds from the final step (and a class named `_CodeActionSorter`!) and instead applies it earlier during building of the actions. This will help apply the filter in the case where we return bare Commands (which don't have `kind`s) instead of `CodeActionLiteral`s.

I added some TODOs because I still don't think this is filtering early enough (because in the case of invoking an action via the command, we need to not have to produce _all_ code actions just to locate the _one_ we want to execute), but it's a step closer (and easier to review this without it being lumped in with the CL that supports returning Commands).

Change-Id: Ibc73c4900d939ac833f6345e9e8f1fdf3f5d6823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427000
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-06 11:03:33 -07:00
Sam Rawlins 9ab2139df5 analyzer: Deprecate ErrorSeverity in favor of DiagnosticSeverity
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: Ic7f84584d4185e1ab7e8741052ec6694487c8c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-05 13:58:32 -07:00
Sam Rawlins eb03a1673d DAS: Use Diagnostic in place of deprecated AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I0107a65580bc41d769c2a384319225b256df2fbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-05-05 09:35:18 -07:00
Danny Tuppeny 4f3a672b00 [analysis_server] Add a CodeAction typedef for CodeActionLiteral | Command
Following on from a previous change to use the term `CodeAction` (an item returned from a `textDocument/codeAction` request) to mean either a `CodeActionLiteral` (which contains inline edits and/or a command) or a base `Command`, this adds a typedef describing the same and updates all code that used `Either2<CodeActionLiteral, Command>` to instead use the typedef.

It also renames a few additional methods/functions to be more consistent with these terms and adds a `CodeActionExtension` to simplify extracting fields like `command` and `title` from either kind of code action.

Change-Id: Iad5f77ef21229fc5c9738527f98ccf7202f83bd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425863
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-05-01 11:12:17 -07:00
Sam Rawlins 3a9f4331dd analysis_server: Use new DiagnosticCode name
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I76c3f7b3ed890b808f3831f2b7776bd1988a223d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425407
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-30 09:29:50 -07:00
Brian Wilkerson d85ab6df0c Refactor the MessageSchedulerTestView for more flexibility
There are no functional changes, just changes to the way the logging
functionality is implemented. The motivation for the changes is to
allow future CLs to explore ways of changing the expectations so that
async handling of messages won't produce flaky tests.

All references to the 'messageLog' outside the class have been replaced
by higher-level methods with a semantic meaning.

The class has been split into an interface and an implementation, which
allows the test-specific aspects to be in the `test` directory.

Some additional code cleanup was also done.

Change-Id: Ie515f71153a96fb6e92eb8e2eb05f4b5e064bbd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421965
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-04-10 16:18:39 -07: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
Konstantin Shcheglov 57392e8324 CQ. Put TreeStringSink into analyzer_utilities/ to reuse.
Change-Id: I7a1a3e6bc42830b842060fd778a6265ed614f9f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-07-30 20:32:24 +00:00
Konstantin Shcheglov 017bed7b9a CQ. Enable unnecessary_final in analysis_server/
Change-Id: Ieb62a1c774a5e8f5a22deaa8e8e5fff6f9f849dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-05-16 21:20:28 +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
Danny Tuppeny 8e1751f4ce [analysis_server] Add LSP CodeLenses for "Go to Augmented" and "Go to Augmentation"
These are on by default but can be toggled in the client with the "dart.codeLens" setting, either by disabling entirely:

```
"dart.codeLens": false
```

Or individually

```
"dart.codeLens": {
  "augmented": false,
  "augmentation": false,
}
```

They require a client-provided command to handle the navigation, so this also adds a "commands" section to the client capabilities (in "experimental", because that's the extension point for non-standard LSP) that allows the client to inform the server that it handles such a command (which is documented in the readme and implemented in Dart-Code in https://github.com/Dart-Code/Dart-Code/commit/ebe029c3f9aca724d386b3da10f414f624bc705a).

Change-Id: I91791c9f4aa5957c4ab4b9c0c5bb4fcf8ebeb717
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359640
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-25 22:32:24 +00:00
Konstantin Shcheglov 60e8519402 Rewrite test_fileSystem_changeFile_buildFile_legacy
Change-Id: Idb764aa7b2aa36a9191e10d68cb6a2351f986d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-12-01 23:27:30 +00:00
Sam Rawlins 73ab31b98a analyzer: Move the Source class to be public API.
Deprecate accessing LineInfo, Source, or SourceRange via the
old library (pkg/analyzer/lib/src/generated/source.dart).
Migrate all SDK code to the new library.

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

Change-Id: Ic7c98a5820415c92a457f9fa2756351b05520cd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335382
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-14 17:10:37 +00:00
Danny Tuppeny 17f3a6ec30 [analysis_server] Convert more LSP handlers to work over the legacy protocol
Change-Id: I9bd1f3ffd9bcdb017a4208e4aedcfb7436259fc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-07 15:27:46 +00:00
pq 05965ef720 + fix dangling library comments
Change-Id: Ia857fec46ddf83d307cd19450cea88aab8c86a38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294430
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-04-11 20:17:38 +00:00
Danny Tuppeny 1b38b7bb7b [analysis_server] Move TestCode from analysis_server to analyzer
Change-Id: I81333240d7693b66416ce6bb308f980b264a2238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264920
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-10-19 19:58:47 +00:00
Danny Tuppeny eea14037e0 [analysis_server] Add support for range marker shorthand in TestCode
Change-Id: I70efc2fd32de128351aa9fd8c10555dbd1391da4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264864
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-10-19 18:13:57 +00:00
Danny Tuppeny 5b1ca7eef1 [analysis_server] Remove string_scanner dependency from TestCode
Change-Id: Ia31efb8b5fede64d91ed1669219d11014afe25c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264863
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-10-19 16:28:25 +00:00
Brian Wilkerson c42ab25787 Refactor TestCode to prepare to move it to analyzer
This is the first phase of preparing it to be moved. The plan is for the
extensions to remain in this library along with an export of the new
library in the analyzer package.

The second phase will be to rewrite it to not use string_scanner so that
we don't have to add a dependency to the analyzer package.

Change-Id: I0d4e9c47bdcb7b825a9d3bfc76331a4e575ac664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263443
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-10-18 18:31:53 +00:00
Konstantin Shcheglov dd63e54e2c Remove fluent check().
Change-Id: I6f41efb2432ebd4a6a03638d5db0937f20386200
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261440
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-27 19:15:55 +00:00
Danny Tuppeny 64a2e5c114 [analysis_server] Add a new mechanism for marking up test code with regions/positions
Change-Id: I45ca24d2360f7201a563145a19c5291f83b9465c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259424
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-22 16:33:18 +00:00
Konstantin Shcheglov aaeb9e7acf Use check() and extensions for SourceChange/SourceFileEdit.
Change-Id: I7372fa152aa78fc6db01a11306a903e0ce38463e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219742
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-08 23:07:43 +00:00
Brian Wilkerson 1ad68b9b16 Make local variables that hide fields be final (analysis_server)
As per our earlier conversation, I looked for places where a local
variable was introduced to overcome field promotion and has the same
name as the field. Where possible I made them final; where not possible
I changed the name.

Change-Id: Iad3d2139693ca66f1eb22a3926c3b84a4115f13d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196552
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-24 18:12:07 +00:00
Paul Berry b10a592341 Add a url field to DiagnosticMessage.
This paves the way for allowing analyzer and analysis server clients
to format diagnostic message URLs in a special way (e.g. to make them
clickable).

Note that DiagnosticMessage is part of the public API of the analyzer,
so I've retained the old behavior in a deprecated fashion to avoid
breaking clients that don't yet handle diagnostic messages containing
URLs.

See
https://dart-review.googlesource.com/c/sdk/+/193749/comment/86d1ce4b_77a60b1e/
for additional discussion.

Change-Id: Iae9d43a2be7dbc67cb7cb82afe0a7824043d6113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196101
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-04-23 20:34:32 +00:00
Brian Wilkerson 0190d20bd6 Migrate some tests and test utilities in server
Change-Id: I0a37352c903bf7139af25aab255fe6a5331ce98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-04-03 19:23:44 +00:00
Konstantin Shcheglov e97f1bdbf0 Switch analysis_server to language 2.12, so null safety, but opt-out files.
This should allow doing partial migration, specifically protocol files,
which are imported by other libraries, but are a small library cycle
that does not import much outside of it.

Change-Id: I904c05d6d5b444ee9a9dbd1f7ada12aabdcc5165
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193583
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-03-30 23:39:37 +00:00
Konstantin Shcheglov 9f986d2501 Migrate package:analyzer to null safety.
Change-Id: Iffe4370431587e46a141ddc72a86ceec29c163b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176486
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-02-01 18:56:04 +00:00
Sam Rawlins 78956cb8d4 analysis_server: Remove unnecessary imports
https://github.com/dart-lang/sdk/issues/44569

Change-Id: I0b5d237f532ab99c112247e9f24392ef317575dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177222
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-12-30 04:39:25 +00:00
Konstantin Shcheglov 999321ede2 Extract TestInstrumentationService into a library, more tests.
R=brianwilkerson@google.com

Change-Id: I563304d4d278fa0755387122a7078b8f020c2d0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-12-11 19:49:29 +00:00
Sam Rawlins 69cb9f7a67 Analyzer: Remove legacy parser (replaced by Fasta).
* Replace most of the implementation of Parser with the implementation
  found in _Parser2, which uses Fasta.
* Rework Parser constructor to do exactly what the previous factory
  constructor + _Parser2 constructor did.
* Remove _Parser2 and ParserAdapter.
* Remove `useFasta` argument in several places.
* Delete tests in parser_test.dart which only used the legacy parser.
* Move ParserProxy from parser_fasta_test.dart to parser_test.dart
* Remove ~240 cases of dead code like `if (useFasta)` and `useFasta ?`
  in tests.

Change-Id: Iea29a10ff83103293902336490fbc9cd46cd20ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175560
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-12-10 23:47:48 +00:00
Paul Berry 596198fb74 Share logic of package_root.dart
This CL unifies the implementations of `package_root.dart` found in
packages `analysis_server`, `analysis_server_client`, `analyzer`, and
`analyzer_plugin`.

This should make it easier to re-use this logic in other packages,
such as `nnbd_migration`.

Change-Id: I0da44edb379b8e929dd0b1c16a6989c1e9418acb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-11-11 18:09:18 +00:00