This adds support for the legacy server to switch to URIs using a client capability. In this mode, all "FilePaths" will be URI strings over the protocol (in both directions).
It also allows the server to send LSP notifications (wrapped inside an "lsp.notification" notification, matching how requests/responses work). Notifications are automatically enabled if the client uses any LSP methods or sends the new "supportsUris" capability.
Change-Id: I5d2b76e396862129c61de70d57397603c958a02d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349120
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This change shouldn't change any current behaviour, but means all "FilePath" types in the legacy protocol spec will go through a (currently no-op) conversion. The server will be able to replace this conversion based on client capabilities in a future CL.
Because a lot of the generated classes are in analyzer_plugin, this also moves the ClientUriConverter class there.
`pkg\analysis_server\test\src\utilities\json_test.dart` contains tests that the toJson/fromJson methods go through the converter recursively (inc. map keys/values/etc.).
Change-Id: If5aec884070128eea594540fd25a9017ada86079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349060
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: I0e7cd26dcb0c7de1b4f7e19b66719d5a73670ce7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345824
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
It also handles imports a little better than it used to: it will replace an import that has the same URI and prefix with an updated one with appropriate show and hide combinators.
Bug: https://github.com/dart-lang/sdk/issues/54496
Change-Id: Ib53275f2d58c19085fe02cb83267c8dc0c23838b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344940
Commit-Queue: Greg Spencer <gspencer@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Greg Spencer <gspencer@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
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>
This migrates the bulk of the calls to `.analysisOptions`. I'll tackle the remainder in a few follow-ups.
Change-Id: I0f4c78d88938feecaba7202e0dc299dc17e2bb35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334647
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This extracts the code that finds "examples/api" paths in code from the navigation code so that it can be re-used by LSP's DocumentLink request.
This allows the links to be more visible in the editor (they are underlined and clearly clickable like hyperlinks, whereas definition required you to hover and hold Ctrl before you'd seen an underline in VS Code).
Example: https://github.com/Dart-Code/Dart-Code/assets/1078012/be9db467-dbc9-4206-9dd5-f8ca72d95596
There may be an argument for making this more general (so that links other than example/api could be detected) but for now the goal was to make these existing links more obvious.
Fixes https://github.com/Dart-Code/Dart-Code/issues/4186
Change-Id: Id00425175b24394e565e13406ea4bac5691d2c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333082
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Change-Id: I582f956cd4b712203c2f6dd630b4e1384040446d
Tested: analysis clean (this is a lint only related change)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329400
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Previously the pattern would only be recorded as a reference to the getter. If there was a reference to the declared variable elsewhere in the visited code, it would then record the variable declaration (via the reference).
In LSP, we locate declarations by only looking at the node at the cursor, so we can't rely on the declaration being recorded by some other reference (if one even exists) so this ensure it is recorded explicitly.
Fixes https://github.com/dart-lang/sdk/issues/53554.
Change-Id: I8983d0637f2d89a427fb1fa11293eec8e06fede8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326700
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
My plan is to checkout the SDK when analyzer 6.0.0 was published,
then cherry-pick this commit, and publish analyzer_plugin.
In a test run, the package analyzes cleanly and all tests pass.
Bug: https://github.com/dart-lang/sdk/issues/52769
Change-Id: I10661dd665c612eeb82977bdf2f8432e022044b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
The change in [0] has propagated now everywhere, so we can use
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.
As the checked-in SDK has been rolled to include [0] we can now rely on
the better return type.
[0] https://github.com/dart-lang/sdk/issues/52801
TEST=ci
CoreLibraryReviewExempt: Minor cleanup.
Change-Id: I2c0144023e03b2c265582d83a7fb9469b02f1570
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313563
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This reverts commit 43db92d9ed.
Revert "Tweaks for comments of classes around augmentations."
This reverts commit 6d0fb5094f.
Change-Id: I9508169158d536302579346defebf696edfe4bec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
In following CLs I plan to add `final` and `sealed` modifiers.
Change-Id: Ia6b9091034ed9f8f6f8576dbe6029d7e72a9d6b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315249
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
The actual removal will happen in (to be rebased on top of this):
https://dart-review.googlesource.com/c/sdk/+/303280
Fixing direct uses of the deprecated `Identifier get name` is apparently
only about a half of the work. I should have followed my own advice to
the clients and prepared better.
These changes are necessary because we will stop creating and
visiting `Identifier`, and so `NamedType` should be handled directly.
Change-Id: Ie07b75b15eab277ed6c9b29a838561a7eb71f588
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303425
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Using Identifier expression inside NamedType does not make sense.
Change-Id: I4a61d2b472fd66fb7c5e6e92a80cccb391b06d49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This reverts commit 0ef7ed2ebd.
Reason for revert: Tests are failing in google3 - linter needs to be bumped
Original change's description:
> [analyzer] Move 4 more HintCodes to be WarningCodes, UNUSED_*
>
> Bug: https://github.com/dart-lang/sdk/issues/50796
> Change-Id: Ib5b153bc6e64bc433df1f05c53d82f71b470bbec
> TEST=presubmit bots
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290703
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: If1c460bdcf422033648417da5ba2f5fbc1b459c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291460
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>