analyzer_plugin 0.2.1

  • Readme
  • Changelog
  • Installing
  • 60

analyzer_plugin #

A framework for building plugins for the analysis server.

Usage #

Note: The plugin support is not currently available for general use.

Plugins are written in Dart and are run in the same VM as the analysis server. The analysis server runs each plugin in a separate isolate and communicates with the plugin using a plugin API. This API is similar to the API used by the analysis server to communicate with clients.

Plugins are automatically discovered and run by the analysis server.

This package contains support code to make it easier to write a plugin. There is a tutorial describing how to use the support in this package.

Support #

Post issues and feature requests on the issue tracker.

Questions and discussions are welcome at the Dart Analyzer Discussion Group.

License #

See the LICENSE file.

0.2.1 #

  • Bump maximum supported version of the analyzer to <0.39.0.
  • Bug fixes: #37916, #38326.

0.2.0 #

  • Change DartEditBuilder.writeOverride() to accept ExecutableElement instead of FunctionType.

0.1.0 #

  • Support the latest pkg:analyzer.
  • remove the declared type of generated setters

0.0.1-alpha.8 #

  • Support the latest pkg:analyzer.

0.0.1-alpha.7 #

  • Remove CompletionSuggestion.elementUri, replaced with AvailableSuggestionSet.
  • Remove 'importUri' from CompletionSuggestion.
  • Include type parameters into suggested code completions.

0.0.1-alpha.4 #

  • Upgrade the Dart SDK version constraint

0.0.1 #

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  analyzer_plugin: ^0.2.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:analyzer_plugin/channel/channel.dart';
import 'package:analyzer_plugin/plugin/assist_mixin.dart';
import 'package:analyzer_plugin/plugin/completion_mixin.dart';
import 'package:analyzer_plugin/plugin/fix_mixin.dart';
import 'package:analyzer_plugin/plugin/folding_mixin.dart';
import 'package:analyzer_plugin/plugin/highlights_mixin.dart';
import 'package:analyzer_plugin/plugin/kythe_mixin.dart';
import 'package:analyzer_plugin/plugin/navigation_mixin.dart';
import 'package:analyzer_plugin/plugin/occurrences_mixin.dart';
import 'package:analyzer_plugin/plugin/outline_mixin.dart';
import 'package:analyzer_plugin/plugin/plugin.dart';
import 'package:analyzer_plugin/protocol/protocol.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/protocol/protocol_constants.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/starter.dart';
import 'package:analyzer_plugin/utilities/analyzer_converter.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:analyzer_plugin/utilities/assist/assist_contributor_mixin.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_workspace.dart';
import 'package:analyzer_plugin/utilities/completion/completion_core.dart';
import 'package:analyzer_plugin/utilities/completion/inherited_reference_contributor.dart';
import 'package:analyzer_plugin/utilities/completion/relevance.dart';
import 'package:analyzer_plugin/utilities/completion/suggestion_builder.dart';
import 'package:analyzer_plugin/utilities/completion/type_member_contributor.dart';
import 'package:analyzer_plugin/utilities/fixes/fix_contributor_mixin.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/folding/folding.dart';
import 'package:analyzer_plugin/utilities/generator.dart';
import 'package:analyzer_plugin/utilities/highlights/highlights.dart';
import 'package:analyzer_plugin/utilities/kythe/entries.dart';
import 'package:analyzer_plugin/utilities/navigation/navigation.dart';
import 'package:analyzer_plugin/utilities/occurrences/occurrences.dart';
import 'package:analyzer_plugin/utilities/outline/outline.dart';
import 'package:analyzer_plugin/utilities/pair.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
import 'package:analyzer_plugin/utilities/subscriptions/subscription_manager.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
88
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Dec 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io, isolate.

Health suggestions

Fix lib/protocol/protocol_common.dart. (-94.75 points)

Analysis of lib/protocol/protocol_common.dart reported 588 hints, including:

line 15 col 1: Prefer using /// for doc comments.

line 28 col 3: Prefer using /// for doc comments.

line 33 col 3: Prefer using /// for doc comments.

line 61 col 14: Unnecessary new keyword.

line 95 col 1: Prefer using /// for doc comments.

Fix lib/protocol/protocol_generated.dart. (-91.59 points)

Analysis of lib/protocol/protocol_generated.dart reported 494 hints, including:

line 16 col 1: Prefer using /// for doc comments.

line 31 col 3: Prefer using /// for doc comments.

line 36 col 3: Prefer using /// for doc comments.

line 44 col 3: Prefer using /// for doc comments.

line 49 col 3: Prefer using /// for doc comments.

Fix lib/plugin/plugin.dart. (-41.22 points)

Analysis of lib/plugin/plugin.dart reported 106 hints, including:

line 28 col 1: Prefer using /// for doc comments.

line 36 col 3: Prefer using /// for doc comments.

line 41 col 3: Prefer using /// for doc comments.

line 47 col 3: Prefer using /// for doc comments.

line 52 col 3: Prefer using /// for doc comments.

Fix additional 55 files with analysis or formatting issues. (-403.01 points)

Additional issues in the following files:

  • lib/src/utilities/change_builder/change_builder_dart.dart (69 hints)
  • lib/protocol/protocol.dart (53 hints)
  • lib/src/utilities/change_builder/change_builder_core.dart (52 hints)
  • lib/src/protocol/protocol_internal.dart (51 hints)
  • lib/utilities/change_builder/change_builder_dart.dart (43 hints)
  • lib/src/channel/isolate_channel.dart (36 hints)
  • lib/src/utilities/completion/completion_target.dart (33 hints)
  • lib/src/utilities/completion/optype.dart (33 hints)
  • lib/utilities/range_factory.dart (30 hints)
  • lib/utilities/completion/type_member_contributor.dart (28 hints)
  • lib/utilities/fixes/fixes.dart (27 hints)
  • lib/utilities/change_builder/change_builder_core.dart (25 hints)
  • lib/utilities/navigation/navigation.dart (25 hints)
  • lib/utilities/assist/assist.dart (24 hints)
  • lib/utilities/completion/completion_core.dart (24 hints)
  • lib/utilities/analyzer_converter.dart (23 hints)
  • lib/utilities/folding/folding.dart (18 hints)
  • lib/utilities/highlights/highlights.dart (18 hints)
  • lib/utilities/outline/outline.dart (18 hints)
  • lib/utilities/kythe/entries.dart (17 hints)
  • lib/utilities/occurrences/occurrences.dart (17 hints)
  • lib/src/utilities/completion/completion_core.dart (14 hints)
  • lib/src/utilities/completion/element_suggestion_builder.dart (14 hints)
  • lib/channel/channel.dart (10 hints)
  • lib/src/utilities/completion/suggestion_builder.dart (10 hints)
  • lib/src/utilities/navigation/navigation.dart (10 hints)
  • lib/utilities/completion/inherited_reference_contributor.dart (10 hints)
  • lib/src/utilities/visitors/local_declaration_visitor.dart (8 hints)
  • lib/plugin/navigation_mixin.dart (7 hints)
  • lib/src/utilities/fixes/fixes.dart (7 hints)
  • lib/src/utilities/occurrences/occurrences.dart (7 hints)
  • lib/src/utilities/folding/folding.dart (6 hints)
  • lib/src/utilities/highlights/highlights.dart (6 hints)
  • lib/src/utilities/outline/outline.dart (6 hints)
  • lib/utilities/fixes/fix_contributor_mixin.dart (6 hints)
  • lib/utilities/subscriptions/subscription_manager.dart (6 hints)
  • lib/plugin/assist_mixin.dart (5 hints)
  • lib/plugin/completion_mixin.dart (5 hints)
  • lib/src/utilities/kythe/entries.dart (5 hints)
  • lib/src/utilities/string_utilities.dart (5 hints)
  • lib/utilities/generator.dart (5 hints)
  • lib/plugin/fix_mixin.dart (4 hints)
  • lib/plugin/folding_mixin.dart (4 hints)
  • lib/plugin/highlights_mixin.dart (4 hints)
  • lib/plugin/kythe_mixin.dart (4 hints)
  • lib/plugin/occurrences_mixin.dart (4 hints)
  • lib/plugin/outline_mixin.dart (4 hints)
  • lib/src/driver.dart (4 hints)
  • lib/src/utilities/assist/assist.dart (4 hints)
  • lib/src/utilities/documentation.dart (4 hints)
  • lib/starter.dart (4 hints)
  • lib/utilities/assist/assist_contributor_mixin.dart (4 hints)
  • lib/utilities/completion/suggestion_builder.dart (4 hints)
  • lib/src/utilities/null_string_sink.dart (1 hint)
  • lib/utilities/pair.dart (1 hint)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (analyzer).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and analyzer_plugin.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer >=0.35.3 <0.39.0 0.38.5 0.39.1
charcode ^1.1.0 1.1.2
dart_style ^1.2.0 1.3.3
html >=0.13.1 <0.15.0 0.14.0+3
meta ^1.0.2 1.1.8
path ^1.4.1 1.6.4
pub_semver ^1.3.2 1.4.2
Transitive dependencies
args 1.5.2
async 2.4.0
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
glob 1.2.0
js 0.6.1+1
kernel 0.3.27 0.3.29
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.9.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
yaml 2.2.0
Dev dependencies
analysis_tool
front_end 0.1.27 0.1.29
test ^1.0.0
test_reflective_loader ^0.1.8