angularjs-eclipse icon indicating copy to clipboard operation
angularjs-eclipse copied to clipboard

Enabling angularjs facet should automaticaly configure HTML validation to ignore ng-*

Open mickaelistria opened this issue 10 years ago • 5 comments

When a user enables AngularJS on a Web project, it would be convenient to configure the project HTML validation to ignore the ng-* attributes (instead of showing them as warning).

cc @alexeykazakov @dgolovin

mickaelistria avatar Nov 04 '14 14:11 mickaelistria

@mickaelistria I agree with you, but let's me explain why I don't have done that.

At first, let's me explain how works angular validator :

  • HTML Angular Syntax Validator extends HTML Syntax Validator to manages validation for unknown controller, modules and ignore ng- warning.
  • the ng- warning comes from the HTML Syntax Validator. So to remove those warning, you must uncheck HTML Syntax Validator.

Your suggestion is to uncheck with Java code the HTML Syntax Validator when project has angular nature. But how to do that?

More I think HTML Angular Syntax Validator should validate only validation for unknown controller, modules. The ignore of ng-* should be done with the future extension point (hope it will exists) described here https://issues.jboss.org/browse/JBIDE-18387?focusedCommentId=13004441&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13004441

angelozerr avatar Nov 04 '14 14:11 angelozerr

On 11/04/2014 03:39 PM, Angelo wrote:

Your suggestion is to uncheck with Java code the |HTML Syntax Validator| when project has angular nature. But how to do that? Not exactly. What I suggest is that the Angular facet configures the HTML syntax validator for current project to ignore ng-* attribute. Similarly to what user would do with Right-click on project > Properties Validation > HTML Syntax > Enable project specific setting > Ignore specified attributes name in validation > add "ng-*" to that field.

Mickael Istria Eclipse developer at JBoss, by Red Hat http://www.jboss.org/tools My blog http://mickaelistria.wordpress.com - My Tweets http://twitter.com/mickaelistria

mickaelistria avatar Nov 04 '14 14:11 mickaelistria

Similarly to what user would do with Right-click on project > Properties Validation > HTML Syntax > Enable project specific setting > Ignore specified attributes name in validation > add "ng-*" to that field.

Ok I understand, but is it possible to do that?

More as I explained you, ignore ng-* should be done inside the future extension point, because as I vace explained here https://bugs.eclipse.org/bugs/show_bug.cgi?id=443097#c2 angular validation is complex.

angelozerr avatar Nov 04 '14 14:11 angelozerr

On 11/04/2014 03:49 PM, Angelo wrote:

Similarly to what user would do with Right-click on project >
Properties
Validation > HTML Syntax > Enable project specific setting > Ignore
specified attributes name in validation > add "ng-*" to that field.

Ok I understand, but is it possible to do that?

Seems to be mainly a matter of setting project preferences. See http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2FresInt_preferences.htm and http://git.eclipse.org/c/sourceediting/webtools.sourceediting.git/tree/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLValidationPreferencePage.java for details & examples.

More as I explained you, ignore ng-* should be done inside the future extension point, because as I vace explained here https://bugs.eclipse.org/bugs/show_bug.cgi?id=443097#c2 angular validation is complex.

Not sure the HTML validation by itself is extensible to make it ignored. But if you think about an AngularJS validation that replaces (and extends) HTML Validation, then yeah, it seems to be a working solution as well.

mickaelistria avatar Nov 04 '14 16:11 mickaelistria

Seems to be mainly a matter of setting project preferences.

Thank's for the info!

Not sure the HTML validation by itself is extensible to make it ignored.

Today HTML validation doesn't provide this feature. I hope really that @vrubezhny will provide a patch for this feature to WTP with https://issues.jboss.org/browse/JBIDE-18387

angelozerr avatar Nov 04 '14 16:11 angelozerr