angular_analyzer_plugin 1.0.0-alpha+1

  • Readme
  • Changelog
  • Installing
  • 83

pub package

Requires angular-5.0.0* and dart SDK 2.0.0-dev.31** or higher to work.

* Works with angular-4.0.0 by following the steps in the section "loading an exact version."

** Linux and Mac users should be able to an SDK version as old as 1.25.0-dev.12.0

Integration with Dart Analysis Server #

To provide information for DAS clients the server_plugin plugin contributes several extensions.

  • Angular analysis errors are automatically merged into normal errors notifications for Dart and HTML files.

Using this strategy allows the dart ecosystem to discover which version of our plugin will work best with your version of angular, and therefore is recommended.

Simply add to your analysis_options.yaml file:

    - angular

Then simply reboot your analysis server (inside IntelliJ this is done by clicking on the skull icon if it exists, or the refresh icon otherwise) and wait for the plugin to fully load, which can take a minute on the first run.

The plugin will self-upgrade if you update angular. Otherwise, you can get any version of the plugin you wish by following the steps in the next section.

Loading an Exact Version #

This is much like the previous step. However, you should include this project in your pubspec:

  angular_analyzer_plugin: 0.0.13

and then load the plugin as itself, rather than as a dependency of angular:

    - angular_analyzer_plugin

Like the previous installation option, you then just need to reboot your analysis server after running pub get.

Troubleshooting #

If you have any issues, filing an issue with us is always a welcome option. There are a few things you can try on your own, as well, to get an idea of what's going wrong:

  • Are you using angular 5 or newer? If not, are you loading a recent exact version of the plugin?
  • Are you using a bleeding edge SDK? The latest stable will not work correctly, and windows users require at least 2.0.0-dev-31.
  • Did you turn the plugin on correctly in your analysis options file?
  • From IntelliJ in the Dart Analysis panel, there's a gear icon that has "analyzer diagnostics," which opens a web page that has a section for loaded plugins. Are there any errors?
  • Does your editor support html+dart analysis, or is it an old version? Some (such as VSCode, vim) may have special steps to show errors surfaced by dart analysis inside your html files.
  • Check the directory ~/.dartServer/.plugin_manager (on Windows: \Users\you\AppData\Local\.dartServer\.plugin_manager). Does it have any subdirectories?
  • There should be a hash representing each plugin you've loaded. Can you run pub get from HASH/analyzer_plugin? (If you have multiple hashes, it should be safe to clear this directory & reload.)
  • If you run bin/plugin.dart from .plugin_manager/HASH/analyzer_plugin, do you get any import errors? (Note: this is expected to crash when launched in this way, but without import-related errors)

We may ask you any or all of these questions if you open an issue, so feel free to go run through these checks on your own to get a hint what might be wrong.

Upgrading #

Any Dart users on 2.0.0-dev.48 or newer will get updates on every restart of the analysis server. If you are on an older Dart version than that, check the Troubleshooting section.

Building -- For hacking on this plugin, or using the latest unpublished. #

There's an pubspec.yaml file that needs to be updated to point to your local system:

$ cd angular_analyzer_plugin/tools/analyzer_plugin
$ cp pubspec.yaml.defaults pubspec.yaml

Modify pubspec.yaml in this folder to fix the absolute paths. They must be absolute!

Then run pub get.

You can now use this in projects on your local system which a correctly configured pubspec and analysis options. For instance, playground/. Note that it imports the plugin by path, and imports it as a plugin inside analysis_options.yaml.

What's supported #

For what's currently supported, see

1.0.0-alpha+1 #

  • Maintenance release to support Angular 6.0-alpha+1.

1.0.0-alpha #

  • The Angular analyzer plugin has moved into the core angular repo, and will be developed by the Angular team going forward.

0.0.17+6 #

  • Fixed an issue where an unnecessary navigation range was added to HTML files.
  • Fixed an issue where navigation would be delayed in IntelliJ and other IDEs that use the notification pattern for navigation.
  • Change analyzer API for forwards compatibility with part files. The old API could have caused out-of-date errors to be cached for a file. The new API, however, introduces extra asynchrony. Manual testing seemed to show everything working properly however this may cause race conditions or hurt performance.

0.0.17+5 #

  • Fixed an issue where a corrupt URI would crash the plugin on windows.

0.0.17+4 #

  • Refactored how non-angular expressions (new, +=, .., etc.) are detected.
  • Refactored how exports are handled in a fairly major way.
  • Typecheck the results and input of pipe expressions and the existence of a matching pipe. Optional arguments are not yet typechecked.
  • Add typechecking support for [], and ensure that a corresponding [] binding exists.
  • Fixed issues with <ng-container>, which resulted in the inner content simply being ignored instead of being validated (and also caused some problems with finding inner <ng-content> tags).
  • More checks for rejected operators like +=, ++ other unary operators and compound assignments.
  • Named arguments are no longer reported as disallowed as angular now supports them.

0.0.17+3 #

  • Fixed an issue where a cast error from certain top-level getters would crash the plugin.

0.0.17+2 #

  • Fixed an issue where pipes with a dynamic type optional parameter would crash the plugin.

0.0.17+1 #

  • Fixed an issue where standard HTML events weren't recognized due to changes made to dart:html sources on newer SDKs.

0.0.17 #

  • More dart 2 runtime support.
  • Upgrade package:analyzer to support newest dart semantics.

0.0.16 #

  • Fixed an issue where you couldn't reference a static member of the component class without a warning.
  • Support dart 2 runtimes
  • Better error message for when attribute selectors have an operator but no value.
  • In previous versions, the x*=y selector was working incorrectly. It matched attributes whose names began with x and optionally contained a value y. This has been fixed to do the correct thing: match an attribute of name x when the value contains y.
  • Support '^=' css selector syntax.
  • Upgrade package:analyzer to support newest dart semantics.

0.0.15 #

  • Refactored attribute autocompletion
  • Fixed a bug where pipes that inherited transform() got flagged.
  • Fixed a bug where parts' templateUrls should be relative to the parts' library and not the part itself.
  • Added support for === operator.

Some larger items:

Newer options config #

The required config has been changed in a backwards-compatible way. However, note that while 0.0.14's config works for 0.0.15 users, the reverse is not true.

Specifically, we no longer require enabled: true, and we are moving from configuring the plugin inside analyzer, to having its own top level. This solves a number of problems related to finding, merging, or modifying config, with a potentially large number of methods of loading the plugin.


      enabled: true
        - foo
        - bar


    - angular

    - foo
    - bar

This is encouraged for users on more recent versions than 0.0.14. Support for the old system will likely first be flagged within the dart analyzer itself, and then dropped from our plugin a while after that.

0.0.14 #

  • Fixed issues with locating sources in Windows
  • Fixed an order-of-operations bug where getting completions before errors suppressed the subsequent error notification.
  • Fixed a performance problem due to new navigation features, and correctness issue where local unsaved changes were used in html navigation line/offset info.
  • Fixed crashes in latest IntelliJ due to new navigation features
  • Upgrade package:analyzer to support newest dart semantics.
  • Fixed crash autocompleting before a comment
  • Upgraded package:analyzer for latest dart semantics + bug fixes
  • Upgraded package:analyzer_plugin for fix with autocompleting members on dynamic values

0.0.13 #

  • Fixed a memory leak cause by a stream with no listener
  • Support FutureOr-typed inputs
  • Upgrade package:analyzer to support newest dart semantics.

0.0.12 #

  • Support (focusin) and (focusout) events.
  • Fix crash autocompleting an input in a star-attr when the input name matches the star attr text exactly.
  • Bugfix regarding quotes in attribute selector values. For example, [x="y"] now correctly expects the value y for some attr x.
  • Allow (and suggest) List instead of QueryList. Note, QueryList is still supported, for now.

Some larger items:

Allow custom events with custom types to be specified. (#485) #

Example syntax:

        enabled: true
            type: DoodleEvent
            path: 'package:doodle/events.dart'
            type: PoodleEvent
            path: 'package:doodle/events.dart'

Add new options for ContentChild(ren) in prep for deprecating ElementRef; #

Accept (for the moment) ElementRef, Element, and HtmlElement (the latter two being from dart:html).

Ensure HtmlElement and Element use read: x when @ContentChild('foo'), and check assignability for the read: type.

Note, we currently don't differentiate SVG and HTML, so we accept either type for either case at the moment.

0.0.11 #

  • @View no longer supported.
  • Clearer error for templates that are included from unconventional components. Usually, this is from test components where this occurs.
  • Allow directives: VARIABLE in addition to directives: const [VARIABLE].
  • Functional Directive support
  • Handle optional parameters in pipes
  • Change "overcomplicated templates" error (templates set to const strings that are calculated rather than defined full-form, making error ranges difficult or impossible to provide) to a hint from an error.
  • Expect angular classes to be in package:angular (though still look at package:angular2 if that is missing).
  • Check that reductions (ie, ( are only on key events.
  • Support angular security, which otherwise produces assignment errors.
  • Plugin loading mechanism changed.
  • Support <audio> tag.
  • Handle directive inheritance.

Some larger items:

Allow custom tag names #

Example syntax:

        enabled: true
          - foo
          - bar
          - baz

Most errors related to custom tags are suppressed, because custom tags are often handled by other frameworks (ie, polymer).

0.0.10 #

Started changelog.

Use this package as a library

1. Depend on it

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

  angular_analyzer_plugin: ^1.0.0-alpha+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:angular_analyzer_plugin/ast.dart';
import 'package:angular_analyzer_plugin/errors.dart';
import 'package:angular_analyzer_plugin/plugin.dart';
import 'package:angular_analyzer_plugin/starter.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/completion/template_completer.dart. (-1 points)

Analysis of lib/src/completion/template_completer.dart reported 2 hints:

line 332 col 39: 'isAssignableTo' is deprecated and shouldn't be used. Use TypeSystem.isAssignableTo() instead..

line 363 col 37: 'isAssignableTo' is deprecated and shouldn't be used. Use TypeSystem.isAssignableTo() instead..

Fix lib/src/link/content_child_linker.dart. (-1 points)

Analysis of lib/src/link/content_child_linker.dart reported 2 hints:

line 198 col 43: 'isSupertypeOf' is deprecated and shouldn't be used. Use TypeSystem.isSubtypeOf() instead..

line 265 col 21: 'isSupertypeOf' is deprecated and shouldn't be used. Use TypeSystem.isSubtypeOf() instead..

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

Analysis of lib/plugin.dart reported 1 hint:

line 3 col 1: 'package:analyzer/context/context_root.dart' is deprecated and shouldn't be used.

Fix lib/src/resolver/directive_resolver.dart. (-0.50 points)

Analysis of lib/src/resolver/directive_resolver.dart reported 1 hint:

line 289 col 45: 'isSupertypeOf' is deprecated and shouldn't be used. Use TypeSystem.isSubtypeOf() instead..

Fix lib/src/standard_components.dart. (-0.50 points)

Analysis of lib/src/standard_components.dart reported 1 hint:

line 113 col 64: 'element' is deprecated and shouldn't be used.

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (analyzer, analyzer_plugin).

Homepage URL isn't helpful. (-10 points)

Update the homepage field from pubspec.yaml: link to a website about the package or use the source repository URL.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 angular_analyzer_plugin.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0-dev.1.0 <3.0.0
analyzer ^0.37.0 0.37.1+1 0.39.4
analyzer_plugin ^0.1.0 0.1.0 0.2.1
angular_ast 0.5.11 0.5.11
crypto >=1.1.1 <3.0.0 2.1.4
meta ^1.1.4 1.1.8
plugin ^0.2.0 0.2.0+3
yaml ^2.1.2 2.2.0
Transitive dependencies
args 1.5.3
async 2.4.0
charcode 1.1.3
collection 1.14.12
convert 2.1.1
csslib 0.16.1
front_end 0.1.21+1 0.1.29
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
kernel 0.3.21+1 0.3.29
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.1
path 1.6.4
pedantic 1.9.0
pub_semver 1.4.3
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+14
Dev dependencies
mockito ^3.0.0
test ^1.2.0
test_reflective_loader ^0.1.0