dart-archive/angular_analyzer_plugin

Dart 2 Issues (if you experience general issues with the plugin comment here)

e-belair opened this issue ยท 34 comments

Hi, I open a new issue here because #602 still not working for me
I've deleted ~/.dartServer/.plugin_manager
Then I've restarted WebStorm :
image

The following result from the command line :

$ /usr/lib/dart/bin/pub run bin/plugin.dart 
Unhandled exception:
NoSuchMethodError: The method 'send' was called on null.
Receiver: null
Tried calling: send(SendPort)
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
#1      new PluginIsolateChannel (package:analyzer_plugin/src/channel/isolate_channel.dart:109:15)
#2      Driver.start (package:analyzer_plugin/src/driver.dart:30:40)
#3      start (package:angular_analyzer_plugin/starter.dart:14:8)
#4      main (file:///home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f/analyzer_plugin/bin/plugin.dart:7:3)
#5      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:275:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

The result from the Dart server :

Status
Preview-dart-2: true
Use fasta parser: false
Use common front end: false
Instrumentation enabled: false
Server process ID: 11233
Versions
Analysis server version: 1.20.3
Dart SDK: 2.0.0 (Unknown timestamp) on "linux_x64"

No exceptions encountered!

Analysis plugins
angular-5.0.0
bootstrap package path: /home/manu/.pub-cache/hosted/pub.dartlang.org/angular-5.0.0/tools/analyzer_plugin

execution path: /home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f/analyzer_plugin/bin/plugin.dart

packages file path: /home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f/analyzer_plugin/.packages

name: Angular Analysis Plugin

version: 1.0.0-alpha.0

Associated contexts:

/home/manu/www/tutos/angular_tour_of_heroes

analysis_options.yaml:

analyzer:
  exclude: [build/**]
  errors:
    uri_has_not_been_generated: ignore
  plugins:
    - angular

# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
linter:
  rules:
    - cancel_subscriptions
    - hash_and_equals
    - iterable_contains_unrelated_type
    - list_remove_unrelated_type
    - test_types_in_equals
    - unnecessary_const
    - unnecessary_new
    - unrelated_type_equality_checks
    - valid_regexps

Please let me know if you need more details

Thanks for opening @manuscle ! I was going to open one myself. I renamed this to general Dart 2 issues, which seem to still be around, quite unfortunately.

I just published 0.0.17+3 (#617) but I would not recommend testing again unless you are willing for it to not work despite sinking more time into this.

I'll follow up when I'm more confident than that!

I am ready to test the plugin and check if it's working or not.
Can you just explain how to update to 0.0.17+3, please?

It should be enough to run rm -r /home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f and click "restart analysis server"!

I have used it a lot lately, and it has been working for me. If you do have time to try again I would be extremely grateful to hear if it works for you or not now!

Hi, the Dart plugin is not working for me either, on Webstorm, running on Windows 10. HTML file doesn't have dart autocomplete + checking, and lots of "*ngFor is not allowed here".

Server seems to work fine as console shows errors like ngif eithout star etc, but for some reasons intellij is ignoring analyzer feedback for template file. Works for dart files. Any news on that? I would rather not switch to VCode for this.....

MderM commented

Never got this to work. Commented on other issues, but this one seems to be the right one?

Analysis plugins
angular_analyzer_plugin-0.0.17+3
bootstrap package path: C:\Users\mmewes\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\angular_analyzer_plugin-0.0.17+3\tools\analyzer_plugin

execution path: C:\Users\mmewes\AppData\Local.dartServer.plugin_manager\9e2be0c66c8b68bc4ecd1a706ea973f3\analyzer_plugin\bin\plugin.dart

packages file path: C:\Users\mmewes\AppData\Local.dartServer.plugin_manager\9e2be0c66c8b68bc4ecd1a706ea973f3\analyzer_plugin.packages

not running for unknown reason

@MichaelRFairhurst what's up?
I did not work on it for a while, tried today but ... still not working for me

Running Dart 2.1, Angulart 5.1 and Analyzer 0.33.6 I have the same issue on Windows 10. Removed everything under .dartServer/.plugin_manager, restarted the Analysis server. When I view Analyzer Diagnostics, I see the following under plugins:

  1. right after the server restart

Analysis plugins
angular-5.1.0
bootstrap package path: C:\Users\XXX\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\angular-5.1.0\tools\analyzer_plugin

execution path: C:\Users\XXX\AppData\Local.dartServer.plugin_manager\b0f949daf1f5e922a7a2f24535e984f7\analyzer_plugin\bin\plugin.dart

packages file path: C:\Users\XXX\AppData\Local.dartServer.plugin_manager\b0f949daf1f5e922a7a2f24535e984f7\analyzer_plugin.packages

not running for unknown reason

  1. About 30 seconds after server restart

Analysis plugins
angular-5.1.0
bootstrap package path: C:\Users\XXX\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\angular-5.1.0\tools\analyzer_plugin

execution path: C:\Users\XXX\AppData\Local.dartServer.plugin_manager\b0f949daf1f5e922a7a2f24535e984f7\analyzer_plugin\bin\plugin.dart

packages file path: C:\Users\XXX\AppData\Local.dartServer.plugin_manager\b0f949daf1f5e922a7a2f24535e984f7\analyzer_plugin.packages

name: Angular Analysis Plugin

version: 1.0.0-alpha.0

Associated contexts:

C:\Users\XXX\IdeaProjects\YYY\frontend

  1. About a minute after server restart

No known analysis plugins.

I had this working with Dart 2.0 and Angular 5.0 (not sure about the Analyzer version), I had to frequently delete the .plugin_manager directory, but that helped. Now the updated environment does not work at all. I saw there is a 0.34.0 version but can't depend on it due to various conflicting dependency constrainst from build and other packages.

@MichaelRFairhurst Is there anything we can do to narrow down this issue? It is quite frustrating that we can't get the Angular plugin up and running - this is a major productivity issue for us.

Just upgraded to angular 5.2.0 and analyzer 0.34.0. Issue is still present. Angular plugin is not running. Any help would be highly appreciated.

I've also upgraded to angular 5.2.0 an analyser 0.34.0 but nothing changed. I'm also wondering if is there anybody in there... No life signal from August ๐Ÿ˜•

Hey everyone sorry for my slow responses on this.

I have tried a number of times to repro this, and it seems like its working for most people, but something specific to either certain projects or setups is causing it to not work.

Thanks for sharing so much debug info, I'm taking a look now

This seems fishy, its missing a slash before .packages:

C:\Users\mmewes\AppData\Local.dartServer.plugin_manager\9e2be0c66c8b68bc4ecd1a706ea973f3\analyzer_plugin.packages

Its also possible that this is a windows only issue, that it only appeared non-OS-specific when there were previously other issues as well affecting other OS-s which have maybe all been fixed.

If that's the case, it will take me a bit of time to get my hands on a windows system to test but shouldn't be a major slowdown.

MderM commented

I tried with (vm) ubuntu and had the same issue...

I'm using Ubuntu 18.04.1 LTS and I get the error on all projects

@MichaelRFairhurst If you need any additional help to hunt this down, just holler. I'd be happy to do a TeamViewer or some other remote session with you, should you have trouble reproducing the issue.

Thanks @manuscle, that saved me a lot of time doing windows specific debugging! :)

It does seem like the missing / is likely the issue. Trying to find an underlying cause of that, I think I've found the bug but I'm a bit confused about how it could be being triggered.

Is anyone here using bazel or gn? We would be trying to detect these things based on either the presence of a folder named READONLY, or a folder named .jiri_root.

If that's not it, I may either be missing a case that causes what I think is happening, or what I think is happening is unrelated to the real problem.

Thanks @manuscle, that saved me a lot of time doing windows specific debugging! :)

You're welcome!

It does seem like the missing / is likely the issue. Trying to find an underlying cause of that, I think I've found the bug but I'm a bit confused about how it could be being triggered.

If I'm not wrong, you mean the / for the .package path. Don't forget my first message above, especialy the "response from the server" that mention the path to the .package file. It seems to be correct. Maybe that could help.

Is anyone here using bazel or gn? We would be trying to detect these things based on either the presence of a folder named READONLY, or a folder named .jiri_root.

I'm using the default installation from the original toh tutorial, I can try to use bazel or gn if you need but I realy don't know how to do (I'm noob)

Thanks @manuscle! OK, don't use bazel or gn. I thought those were the problem, but it seems not.

If anyone else here is having issues because they're using bazel or gn do speak up!

Otherwise I will keep digging into other possibilities.

MderM commented

I'm now on Mac and tried this, but I'm not sure what this should do, at all. According to the Medium announcement it should give me all kinds of code completions, at least for angular, not sure about angular-components library (although this library + dart lang is the main reason to try out angular dart at all).

So again, clean installed webstorm and dart sdk, created the example project. And as always it complained about all the unknown tags and not allowed attributes (how to disable that, by the way?).

It gives me no completion, apart from the ones already used in the project. Looking into the diagnostics gives me no errors and states:

Plugins
Plugins in use.

Analysis plugins
angular-5.2.0
bootstrap package path: /Users/maikmewes/.pub-cache/hosted/pub.dartlang.org/angular-5.2.0/tools/analyzer_plugin

execution path: /Users/maikmewes/.dartServer/.plugin_manager/6ea19c00cea9a3eae113156da0dbd55f/analyzer_plugin/bin/plugin.dart

packages file path: /Users/maikmewes/.dartServer/.plugin_manager/6ea19c00cea9a3eae113156da0dbd55f/analyzer_plugin/.packages

name: Angular Analysis Plugin

version: 1.0.0-alpha.0

Associated contexts:

/Users/maikmewes/WebstormProjects/untitled

Sooo... everything good, I guess. But the completions page shows not a single completion. I do not know what I'm doing wrong???

@MderM Hmm, well this is a different error on a mac, so maybe @manuscle is experiencing one issue and all the windows users are experiencing another.

how do disable that, by the way?

You want to go into Settings -> Editor -> Inspections, search for "unknown html" and check the boxes to turn them off. You can also turn off "missing required attribute," I'm not sure if that's something angular code would trigger, and you can turn off "missing close tag" because the plugin should provide that and you'd get it twice. I might leave it on though just in case.

The .packages path is no longer missing a slash, just like it didn't originally for @manuscle, so I'm thinking perhaps windows users are not getting the slash and that's causing their problems, though I couldn't see anywhere in the code that would explain that kind of discrepancy.

But the completions page shows not a single completion

The analyzer completion page only logs regular dart completions, not html completions: dart-lang/sdk#34562

What do you mean by "no completion apart from the ones already used in the project" ? The plugin should autocomplete everything based on what's in the directives list in your component.

not sure about angular-components library (although this library + dart lang is the main reason to try out angular dart at all).

Currently it won't suggest, for instance, <material-input, if you don't have MaterialInputComponent in your directives list. However once you do but it in there, it should select the tag name, inputs, outputs, some attributes, and more.

@MichaelRFairhurst any updates on this? Thanks.

I reproduced and fixed an issue on windows.

The bots are apparently broken right now so I will fix that, land the change, and hopefully it will solve everyone's issues here!

The build is now fixed so hopefully I can land the corrupt URI issue I found and fixed, then publish and hope for the best! :)

@MichaelRFairhurst Thanks for your work. Unfortunately, it seems to not working for me.
Upgraded packages, deleted the .plugin_manager folder ....
I still get the same error as above.

@MichaelRFairhurst this fixed the issue I was experiencing. Thanks. It's nice to have template analysis up and running again.

@szepeshazi Are you on windows or linux ?

@manuscle I am on Windows 10.

@manuscle To confirm, you're still getting

$ /usr/lib/dart/bin/pub run bin/plugin.dart 
Unhandled exception:
NoSuchMethodError: The method 'send' was called on null.
Receiver: null
Tried calling: send(SendPort)
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
#1      new PluginIsolateChannel (package:analyzer_plugin/src/channel/isolate_channel.dart:109:15)
#2      Driver.start (package:analyzer_plugin/src/driver.dart:30:40)
#3      start (package:angular_analyzer_plugin/starter.dart:14:8)
#4      main (file:///home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f/analyzer_plugin/bin/plugin.dart:7:3)
#5      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:275:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

when you run dart /home/manu/.dartServer/.plugin_manager/33cbfe83eac30f8a2acdc2fa0aeecc3f/analyzer_plugin/bin/plugin.dart, and no support in your IDE?

@manuscle to be clear, the method 'send' was called on null is expected behavior. It is only import-related errors that indicate a problem:

https://github.com/dart-lang/angular_analyzer_plugin#troubleshooting

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)

@MichaelRFairhurst Yes I've deleted the folder ~/.dartServer/.plugin_manager/9f444841388878ede442d80d5c9c6009
then restarted WebStorm. I'm getting the same error when I run pub run bin/plugin.dart
In the IDE still same behavior:
selection_012
image

There is the output of the run command:

# manu @ manu-ThinkPad-X230 in ~/.dartServer/.plugin_manager/9f444841388878ede442d80d5c9c6009/analyzer_plugin [9:28:43] 
$ pub run bin/plugin.dart 
Unhandled exception:
NoSuchMethodError: The method 'send' was called on null.
Receiver: null
Tried calling: send(SendPort)
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1      new PluginIsolateChannel (package:analyzer_plugin/src/channel/isolate_channel.dart:109:15)
#2      Driver.start (package:analyzer_plugin/src/driver.dart:30:40)
#3      start (package:angular_analyzer_plugin/starter.dart:14:8)
#4      main (file:///home/manu/.dartServer/.plugin_manager/9f444841388878ede442d80d5c9c6009/analyzer_plugin/bin/plugin.dart:7:3)
#5      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:285:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Also, How I can check that the analyser plugin version is the good one?
EDIT: I found this:

$ cat pubspec.lock 
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
  analyzer:
    dependency: transitive
    description:
      name: analyzer
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.33.1"
  analyzer_plugin:
    dependency: transitive
    description:
      name: analyzer_plugin
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.1-alpha.5"
  angular_analyzer_plugin:
    dependency: "direct main"
    description:
      name: angular_analyzer_plugin
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.0.17+5"

OK @manuscle so it looks like the plugin is loading for you but autocompletions are timing out. I'll keep trying to fix, this time in #671. One thing you can do to potentially fix it is to check places where you're loading large directive lists that mostly go unused (CORE_DIRECTIVES, materialDirectives, etc). Currently, every directive in those lists get "linked" before completing, even if you don't use them.

"Attribute *ngIf is not allowed here" comes from IntelliJ's diagnostics. You can turn them off in IntelliJ. You want to go into Settings -> Editor -> Inspections, search for "unknown html" and check the boxes to turn them off. You can also turn off "missing required attribute," I'm not sure if that's something angular code would trigger, and you can turn off "missing close tag" because the plugin should provide that and you'd get it twice. I might leave it on though just in case.

Ok, I've disabled all inspections settings that you suggest then switched to #671 and waiting for improvement now.
Thanks for your kindly help :-)