Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage angular expression highlight inside JSP, JSF like HTML editor #80

Closed
angelozerr opened this issue Aug 9, 2014 · 6 comments
Closed
Assignees
Milestone

Comments

@angelozerr
Copy link
Owner

Today only HTML editor provides highlight for angular expression.

To do that an angular editor was created to use the angular highlighter which uses angular region. Those angular region comes from the JFLex parser https://github.com/angelozerr/angularjs-eclipse/blob/master/org.eclipse.angularjs.core/Resource/parserTools/highlighting/AngularTokenizer.jflex which was modified from HTML jflex to support angular expression.

I have found this idea but perhaps there is a better mean to manage highlight without override jflex?

If we find a solution for that we could manage angular highlight for any editor like JSP, JSF, etc

@vrubezhny have you some solution about that?

@angelozerr angelozerr added this to the 0.5.0 milestone Aug 22, 2014
@angelozerr
Copy link
Owner Author

Ok the solution that I have found is to use org.eclipse.wst.sse.ui.semanticHighlighting See commit at 202ed73

and screenshot at https://github.com/angelozerr/angularjs-eclipse/wiki/New-and-Noteworthy-0.5.0#user-content-highlighting

I will try to remove DOMDocumentForAngular (which is used when AngularJS Editor is opened). It will resolve several problems:

@gamerson
Copy link
Contributor

So it is not possible to have both JSP validation and JSP Angular
validation in the JSP Editor?

On Fri, Aug 22, 2014 at 5:06 PM, Angelo notifications@github.com wrote:

Ok the solution that I have found is to use
org.eclipse.wst.sse.ui.semanticHighlighting See commit at 202ed73
202ed73

and screenshot at
https://github.com/angelozerr/angularjs-eclipse/wiki/New-and-Noteworthy-0.5.0#user-content-highlighting

I will try to remove DOMDocumentForAngular (which is used when AngularJS
Editor is opened). It will resolve several problems:


Reply to this email directly or view it on GitHub
#80 (comment)
.

Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

@angelozerr
Copy link
Owner Author

Today it's not possible. It's a limitation about WTP/HTML Validator which gives you not the possibility to ignore errors for unknown elements/attributes.

Today we have "HTML Angular Syntax Validator" and "JSP Angular Content Validator" which overrides JSPContentValidator and HTMLValidator to :

  • ignore errors for angular attributes/elements
  • validate existing of module/controller.

My goal is to provide just "HTML Angular Validator" which validate existing of module/controller and continue to use the existing "HTML Syntax Validator" and "JSP Content Validator" validators (like @gamerson suggested).

To ignore errors for angular attributes/elements, WTP HTML Validator doesn't provides this feature (even with https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980). It should be very fantastic if WTP provides an extension point to ignore errors for attributes/elements.

I have written a private mail at @vrubezhny to explain the problem but here the explanation about the problem:

In AngularJS Eclipse I have managed validation, without using the feature https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980 but I think it's not an elegant mean. The basic idea is that I have override/HTMLValidationReporter https://github.com/angelozerr/angularjs-eclipse/blob/master/org.eclipse.angularjs.core/src/org/eclipse/angularjs/core/validation/HTMLAngularValidationReporter.java to ignore Angular attrubute/elements when validator set as unknown.

It works well but there is some limitation :

I cannot use the feature https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980 because with this feature :

  • attribute to ignore comes from a preferences project properties.
  • you cannot ignore errors for HTML element which are Angular directive.
  • attribute, element which are Angular directive can be dynamic (custom directive)

So to fix that it should be fantastic if we have an extension point IHTMLIgnoreValidator like this :

public interface IHTMLIgnoreValidator {

  boolean shouldValidateAttributeName(IProject project, Element target, String attrName);

  boolean shouldValidateElementName((IProject project, Element target);

}

This extension point will be used in HTMLAttributeValidator#shouldValidateAttributeName and SyntaxValidator#validateNames

This extension point will resolve my whole problem :

  • not need to ovveride HTMLValidationReporter, so I will be available to use both HTML Syntax Validator and HTML Angular Syntax validator (which will validates only module and controller)
  • for JSP I will not override JSPContentValidator.
  • we could just have Angular Validator which validates only module/controller which will work for JSP and HTML.

I have created a bug for WTP with my idea at https://bugs.eclipse.org/bugs/show_bug.cgi?id=443097

@gamerson
Copy link
Contributor

I'm worried that people will not wish to disable their JSP Content
Validator an their HTML Syntax Validator. But I guess if they are building
a AnguarJS app they just might have to. It is too bad that SSE is not
flexible enough yet to do both of these, allow HTML and JSP validators to
be extensible enough or at least configurable enough through API.

The SSE team was very responsive to @vrubezhny
https://github.com/vrubezhny 's previous contribution, maybe it can be
done again with these new requirements?

On Fri, Aug 22, 2014 at 6:05 PM, Angelo notifications@github.com wrote:

Today it's not possible. It's a limitation about WTP/HTML Validator which
gives you not the possibility to ignore errors for unknown
elements/attributes.

Today we have "HTML Angular Syntax Validator" and "JSP Angular Content
Validator" which overrides JSPContentValidator and HTMLValidator to :

  • ignore errors for angular attributes/elements
  • validate existing of module/controller.

My goal is to provide just "HTML Angular Validator" which validate
existing of module/controller and continue to use the existing "HTML Syntax
Validator" and "JSP Content Validator" validators (like @gamerson
https://github.com/gamerson suggested).

To ignore errors for angular attributes/elements, WTP HTML Validator
doesn't provides this feature (even with
https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980). It should be very
fantastic if WTP provides an extension point to ignore errors for
attributes/elements.

I have written a private mail at @vrubezhny https://github.com/vrubezhny
to explain the problem but here the explanation about the problem:

In AngularJS Eclipse I have managed validation, without using the feature
https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980 but I think it's not
an elegant mean. The basic idea is that I have
override/HTMLValidationReporter
https://github.com/angelozerr/angularjs-eclipse/blob/master/org.eclipse.angularjs.core/src/org/eclipse/angularjs/core/validation/HTMLAngularValidationReporter.java
to ignore Angular attrubute/elements when validator set as unknown.

It works well but there is some limitation :

I cannot use the feature
https://bugs.eclipse.org/bugs/show_bug.cgi?id=415980 because with this
feature :

  • attribute to ignore comes from a preferences project properties.
  • you cannot ignore errors for HTML element which are Angular
    directive.
  • attribute, element which are Angular directive can be dynamic
    (custom directive)

So to fix that it should be fantastic if we have an extension point
IHTMLIgnoreValidator like this :

public interface IHTMLIgnoreValidator {

boolean shouldValidateAttributeName(IProject project, Element target, String attrName);

boolean shouldValidateElementName((IProject project, Element target);

}

This extension point will be used in
HTMLAttributeValidator#shouldValidateAttributeName and
SyntaxValidator#validateNames

This extension point will resolve my whole problem :

  • not need to ovveride HTMLValidationReporter, so I will be available
    to use both HTML Syntax Validator and HTML Angular Syntax validator (which
    will validates only module and controller)
  • for JSP I will not override JSPContentValidator.
  • we could just have Angular Validator which validates only
    module/controller which will work for JSP and HTML.


Reply to this email directly or view it on GitHub
#80 (comment)
.

Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

@angelozerr
Copy link
Owner Author

I'm worried that people will not wish to disable their JSP Content
Validator an their HTML Syntax Validator

Today "JSP Angular Content Validator " extends "JSP Content Validator" and "HTML Angular Syntax Validator" extends "HTML Syntax Validator". So you don't loose errors.

The SSE team was very responsive to @vrubezhny

Yes I hope @vrubezhny will have time to help with this topic.

@gamerson
Copy link
Contributor

Oh! I see its a superset, well that is ok then.

On Fri, Aug 22, 2014 at 11:43 PM, Angelo notifications@github.com wrote:

I'm worried that people will not wish to disable their JSP Content
Validator an their HTML Syntax Validator

Today "JSP Angular Content Validator " extends "JSP Content Validator" and
"HTML Angular Syntax Validator" extends "HTML Syntax Validator". So you
don't loose errors.

The SSE team was very responsive to @vrubezhny
https://github.com/vrubezhny

Yes I hope @vrubezhny https://github.com/vrubezhny will have time to
help with this topic.


Reply to this email directly or view it on GitHub
#80 (comment)
.

Greg Amerson
Liferay Developer Tools
Liferay, Inc. www.liferay.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants