dart-sdk/pkg/analysis_server
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
..
benchmark Remove support for the older legacy completion protocol 2023-12-12 00:54:48 +00:00
bin
doc Remove support for the older legacy completion protocol 2023-12-12 00:54:48 +00:00
lib [analysis_server] Add experimental TextDocumentContentProvider support for virtual documents 2024-01-18 17:34:43 +00:00
test [analysis_server] Add experimental TextDocumentContentProvider support for virtual documents 2024-01-18 17:34:43 +00:00
tool [analysis_server] Add experimental TextDocumentContentProvider support for virtual documents 2024-01-18 17:34:43 +00:00
analysis_options.yaml enable flutter_style_todos in server 2023-11-14 21:08:12 +00:00
AUTHORS
CHANGELOG.md
CONTRIBUTING.md
LICENSE
OWNERS
pubspec.yaml [analysis_server] Resolve TODO in convert_to_switch_expression quick assist 2023-11-17 22:53:26 +00:00
README.md

analysis_server

A long-running process that provides analysis results to other tools.

The analysis server is designed to provide on-going analysis of one or more code bases as those code bases are changing.

Using the server

The analysis server is not intended to be used stand-alone, and therefore does not have a human-friendly user interface.

Clients (typically tools, such as an editor) are expected to run the analysis server in a separate process and communicate with it using a JSON protocol. The original protocol is specified in the file analysis_server/doc/api.html and Language Server Protocol support is documented in tool/lsp_spec/README.md.

Features and bugs

Please file feature requests and bugs at the issue tracker.