Commit Graph

59 Commits

Author SHA1 Message Date
Daco Harkes d5f4b8fff4 [deps] Roll dart-lang/native
Change-Id: I03e4bbd41641c16cf945797bdbad23734367f983
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429361
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-05-19 12:14:11 -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
Daco Harkes 245498232c [deps] Roll dart-lang/native
`package:native_assets_cli` has been split up and
`package:native_assets_builder` has been renamed.

Change-Id: Ic9d5c21bb3c7ecf7924fdee6b4281153ad37fac5
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425504
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-05-01 02:18:11 -07:00
Danny Tuppeny 9831fc4e98 [analysis_server] Rename "CodeAction" to CodeActionLiteral"
The term "CodeAction" is a bit overloaded. It could mean both an
individual result from the `textDocument/codeAction` request (which is a
`Command` or a `CodeAction`), or the `CodeAction` type defined in
the spec (which the spec refers to as a "Code Action literal").

To reduce confusion where we have similar APIs that operate on
"Code Actions" (CodeAction|Command), this renames the `CodeAction` class to
`CodeActionLiteral` and we will use the term `CodeAction` to mean either of
those types.

To make things simpler to review, this change _only_ renames the class, and also swaps the order of the types in some places that used `Either2<Command, CodeAction>` (which is opposite to the spec and some other code). Some further clean up will be done in a separate change.

Change-Id: Idcd8265f9229c3450004e68334e98a7b530330a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425300
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-04-29 20:54:58 -07:00
Daco Harkes 108e40f31b [deps] Roll dart-lang/native
Change-Id: I418ca4177b64ec566d6e5afa876f6ab23c77a4f9
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425040
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2025-04-29 05:54:11 -07:00
Danny Tuppeny 823947b857 [analysis_server] Always show type parameters in LSP type hierarchy, not type arguments
The change at 27ba8fce6c (to fix https://github.com/Dart-Code/Dart-Code/issues/4217) added type arguments to the LSP Type Hierarchy (before, neither type args or type params were shown).

Showing type arguments seemed reasonable when looking at supertypes, but behaves oddly for subtypes (and also when invoked on a type with arguments), so this partly reverts that and shows type parameters in all cases instead.

This simplified the code a bit and removed the `TypeHierarchyAnchor` class we were round-tripping in order to preserve the type arguments.

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

Change-Id: I4e0e92d4c73712fde7a9526c51699ecdae0f4ab1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423020
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-17 11:35:43 -07:00
Danny Tuppeny 5e62d29bf5 [analysis_server] Add 'range' to EditableArguments response
See https://github.com/flutter/devtools/issues/9035

Change-Id: Ia2cadea05f10f16e00d1dbf0240b16761c0c6b0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-04-01 10:50:07 -07:00
Sigurd Meldgaard 2fe05bd568 Reland "Migrate to use pub workspace"
This is a reland of commit b9b77058a9

Original change's description:
> Migrate to use pub workspace
>
> Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.
>
> All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.
>
> All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.
>
> Bug: https://github.com/dart-lang/sdk/issues/56220
> Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
> Tested: relies on CQ of existing tests. Should have no effect on functionality
> CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
> Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I29afabade2d2447dea05121cb87ff50bb21a4b76
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `//
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415561
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-20 06:19:16 -07:00
Devon Carew 3c973fb292 [lints] address diagnostics related to strict_top_level_inference
Change-Id: I228058202855900f0adba73c1ab04d35180a6e5d
Tested: this is an analyzer diagnostic only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414900
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-03-17 08:27:57 -07:00
Sigurd Meldgaard 6c4de1ab7e Revert "Migrate to use pub workspace"
This reverts commit b9b77058a9.


Revert "Add missing sample pubspec to workspace"

This reverts commit 892ea15ac7.


These seem to break the engine.

Change-Id: Ieee26deb7928c3869a1b6265326c3ce568ffe731
Tested: this is a revert.
CoreLibraryReviewExempt: this is a revert
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415582
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 09:08:20 -07:00
Sigurd Meldgaard b9b77058a9 Migrate to use pub workspace
Use `pub get` to generate `.dart_tool/package_config.json` on gclient sync.

All pkg/ (and a few third_party) packages that are developed inside the sdk repo are included in the workspace from the root `pubspec.yaml`.

All dependencies that are pulled in via DEPS are added as path dependencies via `dependency_overrides` in the root `pubspec.yaml`.

Bug: https://github.com/dart-lang/sdk/issues/56220
Change-Id: I38c12b608c68da54c57821116cf9aa6696936746
Tested: relies on CQ of existing tests. Should have no effect on functionality
CoreLibraryReviewExempt: only core library change is adding a `// ignore:` comment. Should have no influence on functionality
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397164
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2025-03-14 05:21:40 -07:00
Danny Tuppeny dbfcf55762 [analysis_server] Add isDeprecated flag to editable arguments
See https://github.com/flutter/devtools/issues/8930

Change-Id: Ia23ff0659973971393e31bc6f00bd9104bd2c67c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411686
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-03-03 10:45:44 -08:00
Danny Tuppeny af68c2d5ea [analysis_server] Add documentation to editable arguments that represent fields
If an argument is for a field parameter, this includes the documentation from that field, so that the property editor can show the same content you'd see by hovering over the argument name in the editor.

See https://github.com/flutter/devtools/issues/8938

Change-Id: Iebee757dd42fe9da2c8938c95febc99c0c96b609
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2025-02-24 11:30:28 -08:00
Paul Berry a0b38184e2 Remove OWNERS file for the analyzer team.
The code that was previously owned by the analyzer team
(OWNERS_ANALYZER) is now owned by either the Dart Model team
(OWNERS_MODEL) or the developer experience team
(OWNERS_DEVELOPER_EXPERIENCE). Accordingly, we don't need
OWNERS_ANALYZER anymore.

Change-Id: I9a4d2e2462a15ba9ec8f3046cdca77ba9d3af13c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410564
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-18 12:24:57 -08:00
Paul Berry d960dcd43c Add an OWNERS file for the Developer Experience team
Moving forward, the Developer Experience team will own the following
packages:
- analysis_server
- analysis_server_client
- analysis_server_plugin
- analyzer_plugin
- language_server_protocol
- linter
- meta
- server_plugin
- telemetry

In follow-up CLs I will create an OWNERS file for the Dart Model team,
and then remove the OWNERS files for the old analyzer and CFE teams.

Change-Id: Icc52ca75e92baf9d05de211e9e3f6c36fb19b71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409860
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2025-02-14 15:29:40 -08:00
Danny Tuppeny b0566a5773 [analysis_server] Remove isDefault and don't set value when there's no argument for EditableArguments API
Now that we have `defaultValue` against each argument, there was some redundancy here.

`isDefault` is redundant because if `hasArgument=false` it's always default, and if `hasArgument=true`, then `value` and `defaultValue` can be compared
When `hasArgument=false`, there's no value in duplicating `defaultValue` into `value`

Change-Id: I5cba055e56175565842efef815e08dd46e9ed36a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406621
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-13 09:23:32 -08:00
Danny Tuppeny 204039cdf2 [analysis_server] Add "defaultValue" to EditableArguments API
This adds a new field "defaultValue" to the API response that contains the default value for a parameter.

Change-Id: Ief11da553d57871ad1e3fab54c731cbc98d674a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406000
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-29 08:00:26 -08:00
Danny Tuppeny ecf74c5c54 [analysis_server] Add widget name + documentation to EditableArguments
Change-Id: I8b8424b77ff1f9683934c64636a9f56097be870f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405123
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-22 15:48:23 -08:00
Danny Tuppeny 9b71817072 [analysis_server] Fix duplicate reporting of some LSP type parsing errors
Parse errors for spec types were being reported twice - once by the containing object (in canParse()), and once by the nested canParse() call for the nested type.

This skips reporting the error for nested calls to a canParse() method, which will always report the error itself.

Change-Id: I03e4a9638fd6a3fc77eac918f6fd16def93327d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404105
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-01-14 08:56:41 -08:00
Devon Carew 98befcf281 [pkg] rev packages to have a min sdk verison of at least 3.0
Change-Id: I365abf095f0801bb8ce864f3bbaa57ff298164c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402881
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-01-06 14:54:35 -08:00
Danny Tuppeny 76623a6541 [analysis_server] Extract TypeHierarchyItemLocation as ElementLocation2 and use for completion resolution
This moves completion resolution off `ElementLocation` onto the class recently created as `TypeHierarchyItemLocation`, which is now renamed to `ElementLocation2` and extracted to its own file.

Change-Id: I1f0b831ded7b08d6c09f97fcfd66f38f1dd4750e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401021
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-19 14:14:53 -08:00
Danny Tuppeny c8bf2914b7 [analysis_server] Revert to short-mode formatting for pkg:language_server_protocol
This code generation was previously formatting generated files using the latest version. In 76feb10829 I re-ran the formatter to get the new formatting style.

However recently, a pre-submit hook to verify formatting was enabled and revealed that pkg:language_server_protocol still has an older SDK constraint, so the presubmit fails (if you modify these files).

There are two options:

1. Restore formatting to the previous version for pkg:language_server_protocol
2. Increase the SDK constraint for pkg:language_server_protocol

I picked the first for now, since analyzer_server_plugin also depends on pkg:language_server_protocol and currently has a constraint of 3.3, and I don't want to mess with that just to fix the format presubmit.

Change-Id: I2347577561e659825b444ef6622d646c6e513aea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401001
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-12-16 08:54:40 -08:00
Danny Tuppeny 015f872e24 [analysis_server] Add an LSP handler for editing argument values
This adds basic editing for the argument types supported by `textDocument/editableArguments`. It doesn't currently attempt to format code currently (or use multiline/raw strings where they might be more appropriate), and does not allow arbitrary values that don't match the type for the parameter.

Change-Id: Ied95d95c0de39310aef0a1153864e902d56e1910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-12-04 20:09:30 +00:00
Danny Tuppeny dcb9ec10a1 [analysis_server] Add isEditable to editableArguments results and make false for non-editable strings
Change-Id: Iac020bfe0d495f3b634b95c8c32409433e9181bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396282
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-12-02 17:52:33 +00:00
Danny Tuppeny 04641dcc53 [analysis_server] Allow the client to control whether experimental handlers are registered with DTD
This will allow testing in-dev features with a real IDE without having to run/build the server from source.

Change-Id: I62cf732e7c4935c111f312eef25afd247759ae7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394502
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-11-11 18:57:22 +00:00
Danny Tuppeny 613bfa673f [analysis_server] Add a custom LSP handler to fetch editable arguments for the invocation at a position
This currently only supports int, double, boolean, string.

Change-Id: I236db8594907d28dc5901a384fbafdb34f243528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-11-11 15:38:42 +00:00
Danny Tuppeny 76feb10829 [analysis_server] Regenerate LSP classes with new formatting
We run the formatter as part of generating these files. This just regenerates them (to get the new formatting) with no changes so that future changes to the generated files don't produce a huge unrelated diff.

Change-Id: I27e73c800c6f0a918adf29d6106e7c2985dd6241
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393862
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-11-08 15:45:10 +00:00
Danny Tuppeny 135c455d39 [dap] Update to the latest version of the DAP spec
This is a result of running `dap/tool/generate_all.dart` to get the latest version of the spec. I'm doing this to get a new value `supportsANSIStyling` that was added recently that VS Code is already using and broke our ansi colors (it's now opt-in but because was just always supported).

This change does not fix that issue, I wanted to keep the spec updates separate.

In order to get a fix for VS Code users, I'm shipping some middleware that forces this on in the client, but we'll need to fix properly here for the benefit of other clients (or people who haven't updated their VS Code extensions?).

See https://github.com/Dart-Code/Dart-Code/issues/5302

Change-Id: Ie066b92da177bba5565d3ed952e5518912918f40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388700
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-10-21 15:56:54 +00:00
Danny Tuppeny 2bd91e8e58 [analysis_server] Rename some LSP types to match upcoming LSP 3.18
In the upcoming LSP 3.18 spec, many types that were previously inline literal types with no names (that resulted in us auto-generating names) have been made real types with names.

In order to reduce the size of the change when LSP 3.18 arrives, this change renames some of our existing types to match the new names that they will get with LSP 3.18.

There are no functional changes here, I simple added the names to the rename list (removing any redundant values that were previously being renamed differently), regenerated the code, and then updated any remaining references (in non-generated code) to those types to match.

Change-Id: Ic556ce6e52ba94a8d42099371be18288230cd5ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389160
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-10-10 15:08:41 +00:00
Devon Carew 1f8aea0c81 Bump lints to a97011b4b031b1df94765dbacd7d92b0b765c8b9
Changes:
```
> git log --format="%C(auto) %h %s" af68bf0..a97011b
 https://dart.googlesource.com/lints.git/+/a97011b add unintended_html_in_doc_comment; rev to 5.1.0 (211)

```

Diff: https://dart.googlesource.com/lints.git/+/af68bf0cbad88002a2ae19ee8db37b64eb120c32..a97011b4b031b1df94765dbacd7d92b0b765c8b9/
Change-Id: I998d73f5f72e94d5f2922b0751d31620a837555e
Tested: analysis only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/387601
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-09-30 21:48:03 +00:00
Daco Harkes 3f17f334f0 [deps] Roll dart-lang/native
Change-Id: I1e6ccb249353f1be9a5ec764eb71fc8b9e0299d1
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/381984
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-08-28 15:10:59 +00:00
Danny Tuppeny da414c2957 [analysis_server] Allow passing a DTD URI to the analysis server so it can provide LSP functionality to DTD clients
This adds a new request `dart/connectToDtd` that lets a client pass a DTD URI to the server. The server will connect to DTD and provide a subset of LSP methods (those that are currently available over LSP-Over-Legacy, minus the `connectToDtd` method itself) to DTD clients.

This works for both LSP and Legacy servers, and the shared tests run against both (where for legacy, the `dart/connectToDtd` request uses the LSP-over-Legacy support).

This is not currently behind a flag, however it won't do much on its own because no clients will make this request. Once we're happy the functioanlity is good we can either agree an SDK version number for IDEs to gate calling this method on, or we can expose a flag in server capabilities (and some equiv for legacy) so the client knows the functionality is available.

Change-Id: I911d37745a1b2685249dd88e4b152c3196ba627c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379303
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-08-22 20:43:41 +00:00
Danny Tuppeny d12bf71eb0 [dap] Fix link to Dart DAP info
This readme was moved from DDS to third_party/pkg/dap but this link still points to the old location (now a 404).

Change-Id: I737d74085ea726e746a837537121a07bce7e4053
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/378712
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-08-08 15:13:43 +00:00
Danny Tuppeny 6411c07255 [analysis_server] Refactor initialization of LSP in both servers in preperation for DTD support
This change is just some refactoring and additional flags on handlers to reduce the size of a future CL that adds DTD support.

It:

- Slightly changes the meaning of `lspInitialized` in the server (to now mean the server is in the "initialized" state where it can handle the set of requests LSP allows after a server is initialized)
- Adds an additional future for `lspUninitialized` to track when the server moves _out_ of that state
- Removes an expando in LspOverLegacyHandler that tracked handlers against a server, because they're now available in the `lspInitialized` future (for DTD support, we need access to them without the LSP-over-Legacy handler, because we need to initialize DTD at startup regardless of whether a legacy client triggers LSP initialization)
- Adds a flag `requiresTrustedCaller` to handlers to indicate whether they can only be called by the native protocol clients. Tthis must be explicitly provided for shared handlers to ensure each choice is deliberate. The flag is unused in this CL but included here to reduce noise in the next (it touches many files)
- Changes the type of `toJson()` on generated enum clases to have the native type of the value that is returned

Change-Id: I0615cf4671b84887bf56c236d82d0fa3c26e6d87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/379304
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-08-07 21:51:15 +00:00
Devon Carew b640dffb0a [third_party] misc updates for the gitignore files
Change-Id: Ie3b816725128b27f3b48f9cb11e2c78ff3977652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370981
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-06-11 18:09:59 +00:00
Devon Carew cb64e64ccc [third_party/pkg] put package:dap and package:language_server_protocol under analysis
Change-Id: Ie1a48956055fa0f4ebcd85e5d2b762021fc074d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/370101
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
2024-06-07 19:33:13 +00:00
Danny Tuppeny adabc902ca [dap] Update the repo URL in pkg:dap pubspec
This package was moved to third_party but the URL here was not updated so the link on Pub is a 404.

This will need a new Pub release before it updates, but I'm not sure it's worth doing until there are some changes.

Change-Id: Ibd1e4ba0208f13f27e1e04ba141e8a78155bd2bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369700
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Elliott Brooks <elliottbrooks@google.com>
2024-06-05 18:19:19 +00:00
Elliott Brooks 150c24f332 [DAP] Add field showToUser to DebugAdapterException
Bug: https://github.com/dart-lang/sdk/issues/55789
Change-Id: I204672f8e4cf2d073e7640665eaaaa9c8028efe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369720
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-06-04 21:03:23 +00:00
Danny Tuppeny e588c8b379 [anaysis_server] Move ErrorOr class from LSP package to analysis_server
ErrorOr is not related to (or used by) the spec or generated spec classes. It's a utility class for the server implementations of LSP handlers.

I'd like to extend this class and add some extensions (that require access to private fields) and don't feel it belongs in `package:language_server_protocol`.

(note: `package:language_server_protocol` is not published so I believe removing it from there is not a breaking change)

Change-Id: I06799b18d61d123364711a549231134c792e70e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-04 18:51:27 +00:00
Danny Tuppeny f1a6b4025c [dds/dap] Bump package:dap and the version used by DDS
DDS relies on a new class `DartInitializeRequestArguments` added to `package:dap`.

Change-Id: I25b61a3a710c6867c55a545a6f6c4646dc4ba3f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355180
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2024-02-29 19:22:19 +00:00
Danny Tuppeny 7f63f01bbe [dds/dap] Add support for communicating with a DAP client using URIs instead of file paths
Change-Id: I90a623f924dfbeb2e82f090a6d223f080baa7e93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352280
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2024-02-27 19:10:17 +00:00
Danny Tuppeny 4c8ae57d93 [dap] Restore DAP readme
This was accidentally lost in https://dart-review.googlesource.com/c/sdk/+/344021 after the package moved from pkg to third_party/pkg.

Change-Id: I926c2c439b4015bb4cdb5b5aec12b47d6ecfe6a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350280
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-12 07:54:09 +00:00
Daco Harkes f4c3572c18 [deps] Rev native packages.
`package:ffi` has moved from dart-lang/ffi to dart-lang/native.
Stop pulling in dart-lang/ffi and update the revision for
dart-lang/native to include a revision with `package:ffi`
`tools/generate_package_config.dart` should automatically update
the toplevel `.dart_tool/package_config.json` to point to the new
checkout location the Dart SDK.

Also rolls breaking change in native_assets_cli:
https://github.com/dart-lang/native/pull/885

And rolls the move of the test projects:
https://github.com/dart-lang/native/pull/938

Change-Id: Ibc1c88026487bece2580a7d3d4ceb7ee50cd76d0
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346761
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2024-01-26 16:12:29 +00:00
Danny Tuppeny 2b713a9e4e [analysis_server] Add experimental TextDocumentContentProvider support for virtual documents
This adds support for serving the contents of virtual files to the client over a custom LSP protocol (based on the VS Code API of the same name). This is currently a custom Dart protocol but hopefully very close to something that could become standard LSP in future.

If the client advertises support for this feature (currently with an experimental flag "supportsDartTextDocumentContentProviderEXP1") we will return the set of URI schemes we can provide content for (currently "dart-macro-file"). Additionally, we will map internal analyzer macro paths (like `/foo/bar.macro.dart`) onto that scheme (`dart-macro-file://foo/bar.dart`) instead of standard `file://` URIs.

Overlays are not created for these kinds of files (because they would override the server-generated content).

Some language functionality "just works" because we can get resolved ASTs for the macro files (and many LSP features operate on these), but more testing (and tests) are required.

Included are tests for the virtual file methods (and events) and Go-to-Definition. Tests for other features are outstanding.

Change-Id: I2056699652873a12b730f565b823f187f883a1ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-01-18 17:34:43 +00:00
Alexander Thomas bc260f4d73 [dap] Move dap to third_party
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,flutter-web-try
Bug: b/286184681
Change-Id: Ic9c56e6b3c95d514cc11e2f9b743ab44af2350ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344020
Reviewed-by: Helin Shiah <helinx@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-01-09 10:45:30 +00:00
Danny Tuppeny 23e1437f6a [analysis_server] Update generated code to match latest spec
This should have been a small change to keep us in-sync with small changes so when there are bigger changes (LSP 3.18.0) the change is less noisy.

However, it turns out the meta model is built from the latest version always, so it includes 3.18.0 proposed features.

So this change not only regenerates the code with the latest spec, it also adds some handling to exclude any types (and methods) marked as proposed.

It also includes a few minor fixes to things like re-wrapping of comments where there are references.

So, it should still essentially be a non-functional change, but the CL isn't as small as planned because of the cleanup.

- The lsp_meta_model.json file is downloaded and not changes I've made
- The protocol_generated.dart file is the output of the code-gen
- All other files are changes I made manually

Change-Id: I6380f86848d2799cf94d58a419ace0bf0d5a35ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340040
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-12-05 19:58:47 +00:00
Alexander Thomas ec81ca3963 Add OWNERS for third_party/pkg/language_server_protocol
Change-Id: I5cfcf2058eb5b5afbdec4a93312eaaaf6e0951b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330060
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-11 14:55:31 +00:00
Sam Rawlins f34ddb39f4 analyzer: Sort elements in generated LSP protocol files
Change-Id: Icddd53f8a5f858d49a2a00b853cd1f824e3783ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329583
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-10-10 17:39:49 +00:00
Alexander Thomas 49f4c5f94a [analysis_server] Move language server protocol to third_party
Bug: b/286184681
Change-Id: Iabb9070e354f85d29bb94dee4bdd52a0cf664c94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326643
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-10-10 07:48:30 +00:00
Daco Harkes b64ef27dec [pkg/ffi] Roll dart-lang/native
Rolling https://github.com/dart-lang/native/pull/87 manually because
of the c_compiler -> native_toolchain_c rename.

Change-Id: I2592882a7137a40703f96a487a66d31eac7c990d
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313200
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-07-11 19:14:48 +00:00