43
Supporting JavaScript Supporting JavaScript Toolkits with JSDT Toolkits with JSDT Chuck Bridgham, WTP Java EE Project Lead, PMC Chuck Bridgham, WTP Java EE Project Lead, PMC [email protected] [email protected] Nitin Dahyabhai, WTP SSE, JSDT Project Lead Nitin Dahyabhai, WTP SSE, JSDT Project Lead [email protected] [email protected]

Eclipsecon 2011 Supporting javascript toolkits with jsdt

Embed Size (px)

DESCRIPTION

JSDT is the JavaScript IDE now provided within the Web Tools Platform, a vendor neutral, standards oriented basis for web tools in Eclipse. Being vendor neutral, however, means not playing favorites among the many JavaScript toolkits being used to create Web 2.0 sites. Just as WTP offers mechanisms for application server vendors to have first class support within Eclipse, so too does JSDT offer extension points for enriching the experience when working with your JavaScript toolkit of choice. This presentation covers the limitations to JSDT's built-in language support and how to aid it in inferring type information from your sources and leveraging custom documentation formats.

Citation preview

  • 1. Supporting JavaScript Toolkits with JSDT Chuck Bridgham, WTP Java EE Project Lead, PMC [email_address] Nitin Dahyabhai, WTP SSE, JSDT Project Lead [email_address]

2. JavaScript Development Tools

  • Didnt we already have JavaScript tools?
  • History of JSDT
  • How JavaScript is not Java, and how JSDT handles those differences
  • Helping JSDT handle those differences
  • What extensions are available
  • Whats going on in JSDT project today

3. Why not our original tools?

  • WTP already had an editor, didnt it?

4. Why not our original editor?

  • Syntax coloring
  • Content assist with built-in browser objects
  • Integration with web page editors

5. Why not our original editor?

  • Syntax coloring
  • Content assist with built-in browser objects
  • Integration with web page editors
  • Trapped at old syntax level
  • Stuck with just predefined objects
  • No model to build on
  • No validation to speak of

6. Where did JSDT come from?

  • IBM Research team

7. Where did JSDT come from?

  • IBM Research team
  • JDT Fork

8. Where did JSDT come from?

  • IBM Research team
  • JDT Fork
    • Interfaces renamed
    • Parser modified and regenerated
    • Semantic analyzer and Search updated
    • Bytecode generation disabled

9. Where did JSDT come from?

  • IBM Research team
  • JDT Fork
    • Interfaces renamed
    • Parser modified and regenerated
    • Semantic analyzer and Search updated
    • Bytecode generation disabled
  • Same prereqs as JDT: just the Platform

10. Where did JSDT come from?

  • IBM Research team
  • JDT Fork
    • Interfaces renamed
    • Parser modified and regenerated
    • Semantic analyzer and Search updated
    • Bytecode generation disabled
  • Same prereqs as JDT: just the Platform
  • Okay, other parts of WTP for web pages

11. So why is Java suited for IDE support?

  • Statically Typed
    • Compiler resolves types with ease
  • Expression evaluation clearly defined
  • Methods returning known interface
  • Ordered Classpath and source file layout
  • Members of a type in single file, or inherited file

12. How is JavaScript unlike Java? 13. How is JavaScript unlike Java?

  • No CLASSPATH --which files are important?

14. How is JavaScript unlike Java?

  • No rules about which files are important
  • Noclasskeyword to rely on for Type Declarations

15. How is JavaScript unlike Java?

  • No rules about which files are important
  • Noclasskeyword to rely on
  • Types can defined in any file, any where

16. How is JavaScript unlike Java?

  • No rules about which files are important
  • Noclasskeyword to rely on
  • Types can defined in any file
  • Properties can be contributed to any Type from any file

17. How is JavaScript unlike Java?

  • No rules about which files are important
  • Noclasskeyword to rely on
  • Types can defined in any file
  • Properties can be contributed to any Type from any file
  • Dynamic typing

18. How is JavaScript unlike Java?

  • No rules about which files are important
  • Noclasskeyword to rely on
  • Types can defined in any file
  • Properties can be contributed to any Type from any file
  • Dynamic typing
  • Yet we still want to provide a JDT-like feature-rich experience

19. Include Paths

  • Unpredictable script loading in web pages

20. Include Paths

  • Unpredictable script loading in web pages
  • Server-side generated client scripts

21. Include Paths

  • Unpredictable script loading in web pages
  • Server-side generated client scripts
  • Define a project-wide Include Path, based on JDT Build path

22. Include Paths

  • Unpredictable script loading in web pages
  • Server-side generated client scripts
  • Define a project-wide Include Path, based on JDT Build path
    • Introduce Source folder and Library notions, dependencies across workspace projects
    • Reusable libraries and containers

23. Its still not Java

  • Noclasskeyword to rely on

24. Its still not Java

  • Noclasskeyword to rely on
  • Types can defined in any file

25. Its still not Java

  • Noclasskeyword to rely on
  • Types can defined in any file
  • Properties can be contributed to any Type from any file

26. That can be a good thing.

  • Noclasskeyword to rely on
  • Infer types based on usage
  • Need to make it extensible

27. Type Inference

  • org.eclipse.wst.jsdt.core.inferrenceSupport
  • org.eclipse.wst.jsdt.core.infer.IInferEngine
  • org.eclipse.wst.jsdt.core.infer.InferEngine
    • Walks the AST to discover Types, Methods, and Fields
    • Use JSDoc when found
    • One file at a time
  • org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration

28. Type Inference the model

  • org.eclipse.wst.jsdt.core.infer.InferredType
    • Specific text positions needed for desired future refactoring support
    • Only responsible for information in one file
    • Required for all references and declarations
    • Incomplete and inaccurate InferredType information is the largest cause of semantic validation problems.

29. Type Inference the model

  • o.e.w.jsdt.core.infer.InferredMethod
    • Points to a function
    • May hold modifier information in the future

30. Type Inference the model

  • o.e.w.jsdt.core.infer.InferredAttribute
    • Points to anything thats not a function
    • May also hold modifier information in the future

31. Type Inference

  • o.e.w.jsdt.core.infer.Inferred* help populate the Search Index and JavaScript Model, so good InferEngines are key.

32. Type Inference

  • o.e.w.jsdt.core.infer.Inferred* help populate the Search Index and JavaScript Model, so good InferEngines are key.
  • Use the provided library stubs as examples.
  • Multiple InferredTypes and ITypes in the model are okay.
  • Theyre merged in the UI when possible.

33. Supporting Documentation 34. Supporting Documentation

  • Its not all JSDoc

35. Supporting Documentation

  • Its not all JSDoc
  • org.eclipse.wst.jsdt.ui.documentationProvider extension point
  • org.eclipse.wst.jsdt.ui.IDocumentationReader
    • Given IType/IField/IMethod
    • Supplies Reader for raw documentation text
    • Supplies Reader for HTML-ified documentation to be shown in hovers and Documentation View

36. Whats upcoming?

  • Smart Insert functionality in web pages

37. Whats upcoming?

  • Smart Insert functionality in web pages
  • Parser updates for newer language versions

38. Whats upcoming?

  • Smart Insert functionality in web pages
  • Parser updates for newer language versions
  • Stabilize AST Rewrite (pending Parser updates)

39. Whats upcoming?

  • Smart Insert functionality in web pages
  • Parser updates for newer language versions
  • Stabilize AST Rewrite (pending Parser updates)
  • Less presumptuous validation

40. Whats upcoming?

  • Smart Insert functionality in web pages
  • Parser updates for newer language versions
  • Stabilize AST Rewrite (pending Parser updates)
  • Less presumptuous validation
  • HTML5 browser library stubs

41. Want to get involved?

  • Ask more questions in eclipse.webtools newsgroup /http://eclipse.org/forums/eclipse.webtools
  • Check-out sources from our public CVS
  • File bugs and RFEs under Classification:Webtools / Product:JSDT
  • Writing plug-ins for your favorite toolkits? Let us know how to make it easier for you.

42. Thanks! 43. Legal Notices

    • Copyright IBM Corporation, 2011. All rights reserved.Any source code in this presentation is made available under the EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license.
    • IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both.
    • Rational and the Rational logo are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries or both.
    • Oracle, Java, JavaScript, and all Java-based marks, among others, are trademarks or registered trademarks of Oracle Corporation in the United States, other countries or both.
    • Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc.
    • Other company, product and service names may be trademarks or service marks of others.
    • THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION.ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE.