This test was writing a package_config after starting the analysis server which causes the context roots to be rebuilt (during which there is a period when there are no roots/drivers), and then not waiting.
This change creates the file before server initialisation.
Change-Id: Id0111f16200a905dd538e217199133122be84246
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is a non-functional refactor that extracts the growing set of capabilities and options from ServerCapabilitiesComputer into files alongside the handlers they relate to.
The motivation for this is that for LSP-over-Legacy we'll need to accept client capabilities (and return server capabilities). The server capabilities will be different to the standard LSP ones (they will be a subset, and we might not support dynamic registration - at least initially). However the features we do support will have the same registration options, so to avoid duplicating them this moves the registration options away from the creation of the ServerCapabilities.
In future, we might consider further wrapping up a "feature" (which consists of these registration options, and the related handlers), but this change is already quite large and I just wanted to progress capabilities for LSP-over-Legacy so we can handle things like Code Actions (which require executeCommand and possible reverse-requests for applyEdit).
Change-Id: Iecd0aa36626fa44826f7d4dbd6e6c0d758075239
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This reverts be4189f047 plus adds an additional test to verify pkg:path to behaviour (to catch future regressions or if pkg:path has to be reverted, this will need reverting too).
This relies on the fix made at https://github.com/dart-lang/path/issues/148 which rolled into the SDK in f1de897762.
Change-Id: I1dea45e2017f7505bc4aca97f6c07c1a6e445a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319523
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The diagnostic this is testing was removed in 415ff8ece8, causing this test to fail since no diagnostic is reported anymore.
Change-Id: I4cc657094f93dd58a0750847496dccb53e3e8cde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319540
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit 1948b0a9fe.
Reason for revert: causes `promiseToFuture` to become undefined - b/295129286
Original change's description:
> [analyzer] simplify the libraries.dart file
>
> Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
> CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>
Change-Id: I4810c408b996cefd46c0a40cc36818d34aa86071
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319402
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Also renames 'removed' to 'removedIn' to better indicate it is looking for a version, not a boolean.
Change-Id: If3a6708ba32460305e89ba59c4a58ce2ad284e6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319282
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Pull the error handling outwards to _InstanceCreationEvaluator.evaluate. All errors in const constructors should point to the location of the actual exception and provide more context.
Change-Id: Iafcf46182fab698f5546c63780de6dd9a605a51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Change-Id: I86bc196eaddd9a80c02f38c8d947d3c0f4c63394
CoreLibraryReviewExempt: the sdk_library_metadata/libraries.dart is only used by the analyzer
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317803
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
No functional changes here, I'm just trying to simplify the hover implementation a little as this method had gotten quite long and deeply nested. We've discussed improving hover support for patterns and keywords and hopefully this'll make that easier.
Change-Id: I974f7fb0fbb99a967b5970f99b36ef3601df4ea3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318701
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
No functional changes, just simplifies the tests a little by calling functions to set capabilities instead of having to nest them inside `initialize()` calls.
Change-Id: I1496da221b1802c3375c32c7e0d048310769bdf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Otherwise they'll be recorded as "lsp.handle".
Change-Id: I511d5eef44d6d647fef4d0347a03f6a7a9f88f9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This is just a little refactoring towards https://github.com/Dart-Code/Dart-Code/issues/2462. It doesn't change anything, it just makes the next CL (with the functional changes) simpler.
Change-Id: I98ed5991f1abb67f86f9d4d43c27ff6ccf21847c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317940
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Originally we didn't use the LSP Request/Response classes, and just exposed the handlers through the legacy request/response.
However there were some mismatches (such as legacy protocol always returns Map<String, Object?> but some LSP requests return Lists, LSP using int|String IDs, and LSP having numeric error codes that don't match legacy string error codes).
This change uses LSP's request and Response by wrapping them inside a standard (legacy) handler. The LSP-over-Legacy handler has become a standard handler, and the params contain an "lspMessage" field that holds an LSP message, and the result contains an "lspResponse" field that contains an LSP response.
If an LSP handler returns an error, it will be returned as an error inside the LSP response, which will be in a _successful_ legacy request (since that's how we can return an LSP response - as the result).
Change-Id: I67973590ab32f3543d1a6e1b7279974e5e8832bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315201
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
I was trying out DCM and it found this bogus condition.
The only instance I can find where it triggered was adjacent interpolations in strings, and the fallback code (which compares by token type) would handle it correctly, but in case there are other cases (now or in future), I've added an assert to try to avoid reaching the fallback in case it doesn't produce the desired result.
Change-Id: I3092fa4892c812be7d3a91629c5f6ed3be627743
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
If a condition is valid, but fails in an assert, make sure we report
that and a pseudo trace with context messages for the user to link
back to the problem.
This CL also starts building the stack trace when we call a super constructor for more detailed errors.
Bug: https://github.com/dart-lang/sdk/issues/36526
Change-Id: Ib9bc9841256644d2380d3f806e3bc3c9d84b37cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316625
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Dart 3's minimum language version is 2.12. google3's is 2.9.
Change-Id: Icd892b0fcec7f2ce9fa813a108519c0bbbd29a52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317040
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
And using Future from dart:core, which was not enabled until Dart
2.1.0.
Dart 3's minimum language version is 2.12. google3's is 2.9.
Change-Id: Id31d92007e685447ff217bdccf8161c8fd6ce6e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316863
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
There's a false positive with the `prefer_const_constructors` lint where
deferred constant values in const constructors were not being reported
as an error.
This change adds the new error so that the lint doesn't fire.
Fixes https://github.com/dart-lang/sdk/issues/48991
Bug: https://github.com/dart-lang/sdk/issues/48991
Change-Id: I378093c02ec63e0c5eb5a1a8d80c1bbb0c88ba2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316842
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>