Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "JSDT"

(Future Development Plan)
(Future Development Plan)
Line 167: Line 167:
 
* Refactoring
 
* Refactoring
 
* Remove non applicable possibilities
 
* Remove non applicable possibilities
* Enhanced the inference support for 'conglomerate types' and type mixins. ((Types existing in the Global Scope should better track method/field origination and inheritence from libraries.))
+
* Enhanced the inference support for 'conglomerate types' and type mixins. ((Types existing in the Global Scope should better track method/field origination and inheritance from libraries.))
 
* Add more JavaScript specific error/warning/flow scenarios.
 
* Add more JavaScript specific error/warning/flow scenarios.
 
* Enhance HTML integration to provide HTML name/ID'ed element specific completions where applicable.
 
* Enhance HTML integration to provide HTML name/ID'ed element specific completions where applicable.
 
* Some UI cleanup (hide library paths/use names provided by library plugins, better use of library images)
 
* Some UI cleanup (hide library paths/use names provided by library plugins, better use of library images)
 +
 +
=== Obtaining JSDT ===
 +
We are working as fast as possible to make builds available and should be ready very soon. The source is available now on the Eclipse CVS.  Please note that we are an incubation project.
 +
 +
=== Contributing to JSDT ===
 +
The JSDT is championed by a very small development group with limited resources.  We do hold open meetings and conform to the Eclipse process. But our resources are limited.  ANY serious developers or contributors will be enthusiastically welcomed.  For more information follow the standard Eclipse process for becoming a project committer (see [http://www.eclipse.org/projects/dev_process/new-committer.php New Committer Election]).  For more information contact Bradley Childs (childsb@us.ibm.com) or Phil Berkland (berkland@us.ibm.com).
 +
 +
=== Reporting Bugs ===
 +
Report bugs through [https://bugs.eclipse.org/bugs/ Eclipse Bugzilla] under Webtools and select component wst.jsdt.

Revision as of 11:56, 8 August 2007

JavaScript Development Tools

Introduction

The ATF team is proposing to develop a new set JavaScript Editor/Development Tooling. The ATF team feels that a good JavaScript editor with a real JavaScript model for both AJAX and JavaScript developers. This effort would be an component of WST, since the WST project is scoped to do JavaScript development tools for the web. The JavaScript Development Tooling would be a WTP 3.0 2008 release item and would replace the existing JavaScript editor.

Description

With the advent of Web 2.0, JavaScript have become central in the creation of a richer user experience on the Web. Its use has shifted from the creation of simple functions and handlers to events, to the creation of complex Web Application frameworks. Such complexity makes it crucial that more sophisticated set of tool become available on Eclipse.

The JavaScript Development Tools's goal will be to develop a framework for development of JavaScript applications, with full support for editing, refactoring, and searching. The JavaScript editor would be designed such that is can be plugged in to the Web Tools. The JavaScript Development Tools would be also be extensible such that new language features can easily be added.

The functionality of the JavaScript Development Tools will be heavily based on the functionality of the JDT. Because JavaScript is not a fully typed or class-based language, it will not be possible to provide 100% of the JDT functionality. Configurable capabilities will be provided to infer type and class structure from the JavaScript code, so as much JDT functionality as possible can be used.

Pure JavaScript Source Editor Functionality

  • Syntax Highlighting
  • Folding / Line Numbers
  • Full Outlining showing Classes, Functions and Fields
  • Highlight and check of matching bracket / parenthesis
  • Auto-complete of brackets, parenthesies and indentation
  • Mark Occurance
  • Comment Toggle (line and block)
  • Generate Element JsDoc
  • Smart Code Completion based on real-time Javascript Model
  • Hover Help that display element declaration and JsDoc or Error message
  • Configurable Error/Warning checking includes full language syntax and type/class structure resolution
  • Flow analysis shows unreachable code, unused variables and variable hiding.
  • Quick-fix for unresolved fields and types.
  • Surround with do, for, try/catch, while
  • Completion Templates
  • Extract Function/Change function signature
  • Indentation Correction
  • Open Declaration
  • Open Type Hierarchy
  • Open Call Hierarchy
  • Extensibly customizable Code Formating
  • Full Search
  • Refactor/Rename/Move
  • Breakpoint Support
  • Browswer libraries with JsDoc for FireFox, Internet Explorer and ECMA 3
  • Support for user defined libraries using JsDoc + Javascript prototype structure definitions
  • Full extension support for Library UI and core
  • Library Image Support
  • Breakpoint and ATF Project Support for easy AJAX Integration and debug

HTML/JSP Embeded JavaScript Source File Editor Functionality

  • Syntax Highlighting
  • Folding / Line Numbers
  • Full Outlining showing Classes, Functions and Fields
  • Highlight and check of matching bracket / parenthesis
  • Auto-complete of brackets, parenthesies and indentation
  • Mark Occurance
  • Generate Element JsDoc (From outline)
  • Smart Code Completion based on real-time Javascript Model
  • Hover Help that display element declaration and JsDoc or Error message
  • Configurable Error/Warning checking includes full language syntax and type/class structure resolution
  • Flow analysis shows unreachable code, unused variables and variable hiding.
  • Completion Templates
  • Indentation Correction
  • Open Declaration (From outline)
  • Open Type Hierarchy (From outline)
  • Open Call Hierarchy (From outline)
  • Extensibly customizable Code Formating
  • Full Search
  • Breakpoint Support
  • Browswer libraries with JsDoc for FireFox, Internet Explorer and ECMA 3
  • Support for user defined libraries using JsDoc + Javascript prototype structure definitions
  • Full extension support for Library UI and core
  • Library Image Support
  • Breakpoint and ATF Project Support for easy AJAX Integration and debug

Proposed Design

The JavaScript Development Tools design would use the JDT design with the necessary adjustments made for JavaScript.

As far as the JavaScript Development Tools design is concerned, the major differences between Java and JavaScript are:

  • Javascript has no explicit typing support, whereas in Java everything is typed.
  • At the top level, a JavaScript file can contain any program statement, whereas a Java file only contains a class.
  • JavaScript has no classpath/jar file concept.

Other areas where the java/JavaScript differences will necessitate changes:

  • syntax differences - parse definitions
  • additional program elements with no correspondence in java
    • object literal
    • for (var in collection)

Inferred Types

In order for some JDT functionality (such as code completion) to work correctly, class type information needs to be available. This information is not available in JavaScript, but it can be inferred in many cases. A type inferring framework will be put in place to support this functionality. The type inferring will examine the JavaScript abstract syntax tree (AST), and generate "virtual" class information.

The type inferring will run off of a configuration will provide many options for how to infer the types/classes. The type inferring will also be extensible, so the unique conventions among various JavaScript toolkits can be handled. The type inferring will be configurable on a project basis, and possible on a file by file basis.

The type inferring configuration will also be used by the refactoring function.

Javascript file handling

Java files have a very top down structure, where files only contain classes, which only contain fields, methods, and classes, and program statements only contained within methods. Because of this, some JDT functionality will not work for JavaScript, because a program statement can be directly at the top of a JavaScript file. This will be handled by refactoring the relevant JDT code.

Variable/function resolution

In Java, everything is resolvable because of the classpath, package structure, and import statements. This has no correspondence in JavaScript. The function will be handled within JSDT by various means. When resolving functions/variables, JSDT will search all files in the same directory, files in referenced projects, files in referenced paths (configured by something like JDT "Java Build Path" page), and system API files (contained within JSDT).

Because of the "loose" nature of JavaScript, many of the validation errors produced by the resolution code will be changed to warnings, or removed altogether. It may be desirable to configure what should be errors on a (JavaScript) file by file basis.

Functionality mapping

This table shows how the JDT functionality corresponds to the JavaScript functionality. It does not include anything where there is a direct one to one correspondence.

JDT function JSDT function
Build path Global Scope
JDK level (1.4 vs 1.5) Ecma script level 3 vs 4 (v. 3 supported now)
Compile validation & flow analysis

Extension Points

The JSDT functionality is embedded. This means, for instance, that the JavaScript editing capabilities is embeddable within HTML and JSP Editors, both within script tags, and script attribute values. The JSDT is flexible so script support in other languages is possible.

The following JSDT extension points are supported :

  • Global Scope variable initializer
  • Global Scope container initializer core
  • Code formatter
  • Validation participant

In addition, the JavaScript syntax tree will be presented as an XML dom (future), so that various XML processors can be run against it for a variety of reasons, for instance, a Schematron processor could be used to do validation. Currently the JSDT is represented in an AST.

The following jsdt.ui extension points will be supported :

  • Global Scope container initializer ui (Wizzard, content assist images and type/text naming)
  • javascript element filter
  • javaScriptEditorTextHovers
  • javadocCompletionProcessor
  • quickFixProcessors
  • quickAssistProcessors
  • foldingStructureProviders
  • queryParticipants
  • javaScriptCompletionProposalComputer
  • javaScriptCompletionProposalSorters

Development Progress

  • Copied the 3.3 level JDT code.
  • refactored java -> JavaScript , org.eclipse.jdt -> org.eclipse.wst.jsdt, etc .
  • updated syntax definitions, parsing, etc to JavaScript
  • created type/class inference engine
  • update/refactor jdt junit tests to JavaScript and make work [partial]
  • update ui
  • disabled functions not applicable to a generic JavaScript model
  • added usage for non standard (but common) use cases in the inference engine
  • created extensions plugins for WST HTML/JSP editor to support JSDT features
  • changed buildpath/classpath mechanism to define and manage the projects Global Scope (libraries).
  • created Global Scope library for FireFox through by using reflection utility function to dump all visible objects/properties inside FireFox (partial needs some manual updates).
  • created Global Scope library for IE by scraping MSDN JScript docs.


Future Development Plan

The continued plan is as follows:

  • Determine what code is unchanged from JDT and figure out how to share with JDT
  • Support for one or two popular toolkits such as dojo ((partial but non-specific))
  • Expose AST as XML DOM
  • Refactoring
  • Remove non applicable possibilities
  • Enhanced the inference support for 'conglomerate types' and type mixins. ((Types existing in the Global Scope should better track method/field origination and inheritance from libraries.))
  • Add more JavaScript specific error/warning/flow scenarios.
  • Enhance HTML integration to provide HTML name/ID'ed element specific completions where applicable.
  • Some UI cleanup (hide library paths/use names provided by library plugins, better use of library images)

Obtaining JSDT

We are working as fast as possible to make builds available and should be ready very soon. The source is available now on the Eclipse CVS. Please note that we are an incubation project.

Contributing to JSDT

The JSDT is championed by a very small development group with limited resources. We do hold open meetings and conform to the Eclipse process. But our resources are limited. ANY serious developers or contributors will be enthusiastically welcomed. For more information follow the standard Eclipse process for becoming a project committer (see New Committer Election). For more information contact Bradley Childs (childsb@us.ibm.com) or Phil Berkland (berkland@us.ibm.com).

Reporting Bugs

Report bugs through Eclipse Bugzilla under Webtools and select component wst.jsdt.

Back to the top