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

[research task] manage validation with tern #37

Closed
angelozerr opened this issue Apr 3, 2014 · 12 comments
Closed

[research task] manage validation with tern #37

angelozerr opened this issue Apr 3, 2014 · 12 comments

Comments

@angelozerr
Copy link
Owner

Manage validation with tern. See start of this feature with the tern plugin https://github.com/angelozerr/tern.java/blob/master/core/tern.server.nodejs/node_modules/tern/plugin/lint.js and see demo at https://github.com/angelozerr/tern.java/blob/master/core/tern.core.tests/CodeMirror/codemirror-javascript/demo/tern-lint.html

Here a screenshot of this demo:

tern-lint

Posted this idea on tern ternjs/tern#297 and backet adobe/brackets#7090 (comment)

@angelozerr
Copy link
Owner Author

@vrubezhny do you think we could work together about this feature, or could you give me some directive to do that inside Eclipse. My need is about Eclipse Validator. I have started to create a Tern Builder, but it is called just when file is save (and not when user is typing).

Is it possible to initialize Tern Validator (which do nothing) and after I will plug then lint.js tern plugin (which is very basic for the moment). If you have not time to do that, could you give me some directive please.

Thank's!

@vrubezhny
Copy link
Contributor

Sorry, removed the topic. It was about Structured Editors.
If you need to perform as-you-type validation in JavaScript then it looks like you should plugin somehow your own reconciler into the editor.

Sometime ago I did this for Java Editor, not sure but I think (due to the fact that JavaScript editor was copied from the Java ones) the same approach should work for you. Not sure though it's easy doable (JavaScript editor is a copy of very-very old Java editor).

You can see how I'm hooking up Java Editor with my own reconciler here:
https://github.com/jbosstools/jbosstools-base/blob/master/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaEditorTracker.java

This is a class that sets up my own reconciler into each opened Java Editor instance. Then my reconciler is able to do its validation work.

@angelozerr
Copy link
Owner Author

Many thank's Victor for your information. I will study your code to adapt it to Javascript Editor and tern lint.

@angelozerr
Copy link
Owner Author

@vrubezhny I have integrate tern lint to validate property of object with tern. You can see Java code at https://github.com/angelozerr/tern.java/tree/master/eclipse/tern.eclipse.ide.ui/src/tern/eclipse/ide/internal/ui/validation and I have used your great classes. Could you tell me about license header if I must add your name or not (I have copy/paste your Java classes and update it).

@vrubezhny
Copy link
Contributor

IMHO, adding an EPL v.1.0 into header would be enough. Or you can use template that is placed in the header of https://github.com/jbosstools/jbosstools-base/blob/master/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaEditorTracker.java and add your name under the "Contributors" Section as well as an information on what was changed, updated or added by you:

/*******************************************************************************

  • Copyright (c) 2012 Red Hat, Inc.
  • Distributed under license by Red Hat, Inc. All rights reserved.
  • This program is made available under the terms of the
  • Eclipse Public License v1.0 which accompanies this distribution,
  • and is available at http://www.eclipse.org/legal/epl-v10.html
    *
  • Contributor:
  • Red Hat, Inc. - initial API and implementation
    ******************************************************************************/

Anyway, I think referencing the EPL, v.1.0 would be good enough.

@vrubezhny
Copy link
Contributor

BTW, can we remove TernBuilder then?

@angelozerr
Copy link
Owner Author

thank's @vrubezhny for your answer.

BTW, can we remove TernBuilder then?

I don't know, my idea was to implement it to manage global validation with tern lint.js. But this tern plugin must be improved again.

@vrubezhny
Copy link
Contributor

Why not to add your ValidationParticipant instead of creating a builder? Did you tried this?
(I mean org.eclipse.wst.jsdt.core.compiler.ValidationParticipant)

@angelozerr
Copy link
Owner Author

No I have not tried, but ValidationParticipant depends on JSDT. My tern validator should work with any JS editor. I would like to provide the same feature for global validation.

angelozerr added a commit that referenced this issue May 5, 2014
@angelozerr
Copy link
Owner Author

tern lint.js is integrated inside Eclipse IDE (to use it, just select lint.js in the tern plugin project properties). tern lint.js manage just warnings for "Unknow object property". It must improved a lot. Any contributions are welcome!

@angelozerr
Copy link
Owner Author

I close this issue. I have created https://github.com/angelozerr/tern.lint which contains the tern lint plugin.

@angelozerr
Copy link
Owner Author

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

No branches or pull requests

2 participants