dart-archive / angular_analyzer_plugin

WORK MOVED TO dart-lang/angular repository
https://github.com/dart-lang/angular/tree/master/angular_analyzer_plugin
68 stars 13 forks source link

Code compleation/errors does not work in IntelliJ in HTML template files #640

Open Antoniossss opened 5 years ago

Antoniossss commented 5 years ago

I have fresh Dart installation VM version: 2.1.0-dev.5.0 (Wed Sep 19 19:15:19 2018 +0200) on "windows_x64" IntelliJ image Stagehand 3.1.3

I have created new stagehand project using instructions from https://webdev.dartlang.org/guides/get-started

Now I am in state that application runs ok, and Dart Analysis seems to be working, but (image below)

  1. IDE does not display analisys errors
  2. Autocomplete/code suggestion does not work at all for *ngIf and other basic Angular directives
  3. Material components are not recognized as known elements

so basicly I can state that I have no dart/angular support in template files. Analisys works for dart files.

image

Analysis Server Diagnostics shows as follows image

But in code completion tab I can see no request beeing made for template file, only for todo_list_component.dart. Looks like IDE configuration issue. How to include html files for autocompletion/analisys ?

Antoniossss commented 5 years ago

Also when I check analizer web tool, I can see that there are no autocompletion requests made for HTML files just like they are made for autocomplete in dart files.

MichaelRFairhurst commented 5 years ago

I think the angular plugin maybe crashed?

For instance, the lower panel includes an error for 'somefield' in todo_list_component.html. That has to have been supplied by the plugin. Note that since its technically a warning rather than an error (it mirrors dart in this way), it is yellow in the HTML file, which makes it easy to miss.

The remaining chunks of yellow are probably there because you have IntelliJ's HTML diagnostics on. They are on by default, unfortunately, and we've explored ways to automatically turn them off but don't yet have any great ideas on that. You can turn them off from settings -> inspections -> html.

Not sure why autocomplete isn't working, I will look into that further here...

MichaelRFairhurst commented 5 years ago

It looks like the code completion diagnostics page does not track plugin completions, filed here: https://github.com/dart-lang/sdk/issues/34562

What OS are you using?

And did you by chance check the analyzer plugins section of the diagnostic page?

Antoniossss commented 5 years ago

I am on windows All required and advertised features works for .dart files but does not work for htmls. is plugin for angular dart template different then for dart files? Thats regarding plugin crash. Can I verify it somehow?

As for html validation, it is yes and no.

  1. Material components are angular specific and should be somehow covered by analyzer to (somehow) point to the right codebase in HTML just like it works for plain Angular CLI applocations. 
  2. *ngFor should be known attribute because of the same reasons like above.

All scenarios are working  fine for angular cli applications, so I would expect the same to happen here. Obviously I dont know if it should come from dart analyzer or maybe dart plugin itself.

If you would be interested i  fixing this issue (as others keeps reporting the same) I am glad to give you even life feedback on any questions or clarifications you may have till the end of this week.

MderM commented 5 years ago

I have the exact same issues with WebStorm.

MderM commented 5 years ago

Plugin page of diagnostic server is showing this after a clean install of dart sdk and cleaning the pub cache and then creating a new project from material components template:

image

MderM commented 5 years ago

Any news on this one? Tested on Linux too. Plugin is not running (it states: for unknown reason)... sooo, plein not usable from a fresh install of everything. Kind of a bummer

schnaser commented 5 years ago

@MderM I have the same issue on OSX, no luck yet - at least I'm not alone I guess?

alexander-doroshko commented 5 years ago

This should work fine in IntelliJ IDEA / WebStorm 2019.1.3. But you might need to clear Analysis Server caches after enabling 'angular' plugin in the analysis_options.yaml file. It means - delete .dartServer folder (on Windows it's in C:\Users\user_name\AppData\Local.dartServer). Filed https://github.com/dart-lang/angular_analyzer_plugin/issues/709.