Skip to content

Commit e2204d3

Browse files
srawlinsCommit Queue
authored andcommitted
DAS plugins: Update various docs
Work towards #61876 * Make a few notes about support beginning with Dart 3.10. * Make a few notes indicating that plugins can only analyze Dart sources. * Use the handy `> [!NOTE]` and `> [!WARNING]` syntax. * Add a note about how plugins are resolved, and the dependency on analysis_server_plugin ^0.3.0. Change-Id: I6ed5b3611a0ab4ff005917b0c5cff1b6fa9d5c95 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459240 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 21ab9e1 commit e2204d3

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

pkg/analysis_server_plugin/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# analysis\_server\_plugin package
22

3-
This package offers support for writing Dart analysis server plugins.
3+
This package offers support for writing Dart analysis server plugins, for Dart
4+
3.10 (Flutter 3.38) and later.
45

56
Analysis server plugins empower developers to contribute their own Dart static
67
analysis in IDEs and at the command line via `dart analyze` and `flutter

pkg/analysis_server_plugin/doc/using_plugins.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ root of the package or workspace source tree. Analyzer plugins cannot be
99
enabled, disabled, or otherwise specified or configured in a nested analysis
1010
options file
1111

12+
Analyzer plugins are supported starting in Dart 3.10 (Flutter 3.38).
13+
1214
Analyzer plugins are specified in the top-level `plugins` section:
1315

1416
```yaml
@@ -18,18 +20,18 @@ plugins:
1820
1921
[workspace]: https://dart.dev/tools/pub/workspaces
2022
21-
Note: This is similar to how analyzer plugins are enabled in the [legacy][]
22-
analyzer plugin system. However, in the legacy system, this `plugins` section
23-
is listed under the top-level `analyzer` section. In the new analyzer plugin
24-
system, `plugins` is a top-level section.
23+
> [!NOTE]
24+
> This is similar to how analyzer plugins are enabled in the [legacy][] analyzer
25+
plugin system. However, in the legacy system, this `plugins` section is listed
26+
under the top-level `analyzer` section. In the new analyzer plugin system,
27+
`plugins` is a top-level section.
2528

2629
Individual plugins are listed similar to how dependencies are listed in a
2730
`pubspec.yaml` file; they are listed as a key-value pair, with the package name
2831
as the key. The value can either be
2932

3033
* a package version constraint, in which case the package is downloaded from
3134
https://pub.dev,
32-
* a git dependency,
3335
* an absolute path.
3436

3537
For example, while developing a plugin locally, it can be enabled as:
@@ -40,11 +42,21 @@ plugins:
4042
path: /path/to/my_plugin
4143
```
4244

43-
Note: after any change is made to the `plugins` section of an
44-
`analysis_options.yaml` file, the Dart Analysis Server must be restarted to see
45-
the effects.
45+
When the analysis server sees that a set of plugins is enabled, it creates a
46+
synthetic package which depends on each plugin package, which is loaded into a
47+
separate isolate of the analysis server process. It uses [`dart pub upgrade`][]
48+
to resolve a compatible set of versions of the plugin packages and their
49+
dependencies. Note that Dart 3.10 (Flutter 3.38) sets its own constraint on the
50+
`analysis_server_plugin` package, `^0.3.0`. This may change with each release
51+
of Dart and Flutter.
52+
53+
> [!NOTE]
54+
> After any change is made to the `plugins` section of an
55+
> `analysis_options.yaml` file, the Dart Analysis Server must be restarted to
56+
> see the effects.
4657

4758
[legacy]: https://github.com/dart-lang/sdk/blob/main/pkg/analyzer_plugin/doc/tutorial/tutorial.md
59+
[`dart pub upgrade`]: https://dart.dev/tools/pub/cmd/pub-upgrade
4860

4961
## Enabling a lint rule
5062

pkg/analysis_server_plugin/doc/writing_rules.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Writing rules
22

33
This package gives analyzer plugin authors the ability to write static rules
4-
for source code. This document describes briefly how to write such a rule, and
5-
how to register it in an analyzer plugin.
4+
for Dart source code. This document describes briefly how to write such a rule,
5+
and how to register it in an analyzer plugin.
66

77
## Declaring an analysis rule
88

@@ -13,8 +13,8 @@ Every analysis rule is declared in two parts: a rule class that extends
1313

1414
The rule class contains some general information about the rule, like its name
1515
and the diagnostic or diagnostics that the rule reports. It also registers the
16-
various syntax tree nodes that the visitor class needs to visit. Let's see an
17-
example:
16+
various Dart syntax tree nodes that the visitor class needs to visit. Let's see
17+
an example:
1818

1919
```dart
2020
import 'package:analyzer/analysis_rule/analysis_rule.dart';
@@ -174,7 +174,8 @@ See [writing a plugin][] for information about the `Plugin` class.
174174

175175
## Testing an analysis rule
176176

177-
Writing tests for an analysis rule is very easy, and is documented at [testing rules][].
177+
Writing tests for an analysis rule is very easy, and is documented at [testing
178+
rules][].
178179

179180
[writing a plugin]: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/writing_a_plugin.md
180181
[testing rules]: https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server_plugin/doc/testing_rules.md

pkg/analyzer_plugin/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
A framework for building plugins for the analysis server.
55

6-
> **WARNING!**
7-
> This package is for **legacy support** and is **not recommended** for new plugin development.
8-
>
9-
> For modern plugin implementations, use the [`analysis_server_plugin`](https://pub.dev/packages/analysis_server_plugin) package instead.
10-
>
6+
> [!WARNING]
7+
> This package is for **legacy support** and is **not recommended** for new
8+
> plugin development.
9+
>
10+
> For modern plugin implementations, use the
11+
> [`analysis_server_plugin`](https://pub.dev/packages/analysis_server_plugin)
12+
> package instead.
13+
>
1114
> See its documentation for the latest architecture and examples.
1215
1316
## Usage

0 commit comments

Comments
 (0)