JavaScript Debugging Tools Jsdt__java

Source: Internet
Author: User
Tags visibility

Introduction to JavaScript Development Toolkit

JavaScript Eclipse Plug-ins to help you improve JavaScript productivity is in the corner

Lead: http://www.ibm.com/developerworks/cn/opensource/os-eclipse-jsdt/

JavaScript Development Toolkit (JSDT) is an open source plug-in that introduces robust JavaScript programming tools to the Eclipse platform. JSDT makes development more fluid, simplifies coding, and improves the productivity of JavaScript-only source files and HTML built in.

JavaScript development is not easy. The problem is exacerbated by the uneven browser compatibility, poor documentation, and poor tools. Fortunately, with the recent release of plug-in set JavaScript Development Toolkit (JSDT) for Eclipse, the lack of tools is expected to improve.

Eclipse is an open source IDE framework with an architecture that increases scalability and flexibility. JSDT runs as a plug-in in Eclipse. JavaScript is not a fresh concept in Eclipse, because HTML and some JavaScript support can already be obtained from other plug-ins, but JSDT's uniqueness lies in the robustness and complexity of the tools it provides, which can significantly increase the productivity of Web development.

Many of the features and core designs provided by JSDT can be found in the Java Development Toolkit (JDT). JSDT will replace the current JavaScript editor in the Web Tools Platform V3.0 release.

IDE and JavaScript

You may wonder why the JavaScript IDE is so popular. With the popularity of the WEB 2.0 and the large number of developers interested in using JavaScript in blogs and community pages, a number of new JavaScript tools are emerging. Still, the Notepad and browser Refresh buttons are the JavaScript development environment most programmers prefer.

The problem is the explanatory nature of the JavaScript language. Unlike Java™ or C languages, JavaScript is a loosely typed language and it is difficult to achieve precise modeling. For more formal languages, it is necessary to prioritize the efficiency of compiled code and to limit the flexibility of the language. JavaScript goals are not the same. Various factors attempt to differentiate the developers who tend to the same platform, which leads to language inconsistency. From a tool and development perspective, these inconsistencies complicate the problem.

Browsers are not the only problem. Object-oriented JavaScript is a complement rather than a focus of attention. The Ajax Toolbox strives to transform JavaScript toward object-oriented aspects-but each takes a different approach. This can make identifying objects and class structures difficult. The language has several serious vulnerabilities that programmers use to implement techniques that are difficult to implement in other ways, making the problem worse (or better, depending on the object you are asking). One example is to encapsulate the main block of code into a evalf (..) function so that it works only at run time. We are still overcoming this problem in order to model accurately in JSDT.

of existing JavaScript IDE

You can now use some of the less complete JavaScript tools. But many popular tools do not yet provide real context-aware content help because they lack the true JavaScript language modeling mechanism. In the IDE with fewer models, you can achieve content completion and tool functionality by listing the available types using static flat files. These types are dynamically adjusted based on some of the characters you enter, and typically do not select the object members defined in your code. Content completion is not sensitive to context, because if there is no model, the functionality that can be implemented will be greatly limited.

If there is no language model, it is difficult or impossible to put code into context. Because many programming elements depend on the context of the code, it is important to use tools to build contexts. The IDE, which lacks model and code contexts, also lacks adequate type resolution and validation, scope, visibility, or any other good validation functionality that is important for simplifying development.

JSDT Design


Figure 1. JSDT language abstraction Stack

JSDT the JavaScript language and hides the class structure in real time, which is implemented in a completely new way. First, build the basic language elements. Second, the inference engine or engine helps fill all class structures and language differences.

Basic Language Model

You can consider inference and modeling processes as an operation stack. The beginning part of the model is the JavaScript source code. Convert the source code to a private language model by using an engine similar to the Eclipse JDT. The pure model of language adheres to the ECMA-3 standard.

Types and Analogies

After modeling the JavaScript language, the next step is to manage types and class inference. Many JavaScript-based toolkits (such as Dojo, Rico, Prototype) make JavaScript object-oriented programming more convenient through their own technology. JSDT uses a custom, toolbox-aware inference engine to identify classes and type structures within the toolbox. These classes and types can then be added to the language model.

Exposing Models

Finally, the private model and its inference part are converted to the common language model. The common language model can be used for source code, refactoring, and As-you-type tools. If one of the tools needs to modify some JavaScript source code, it must be modified in the public model and eventually converted to JavaScript source code.

managing variables and member scopes

Even if the language model provides the basis for describing JavaScript source code and context, another important factor is required: environmental context. JSDT must establish the available variables and types when you run the global scope of JavaScript. These variables and types vary according to the run-time environment of JavaScript. When JavaScript is running in the context of a Web browser, objects, types, fields that represent screen data, and browser objects are available in the global scope. If your code is for something other than a browser, the entire set of objects may be different.


Figure 2. JSDT Library Configuration

JSDT uses the library mechanism to manage common objects, variables, and types in a project. You can add libraries to your project to provide the set of objects and variables that are specific to the user's target runtime environment. If there are two libraries that define conflicting members, the members are merged and annotated in the appropriate user interface. This helps you create a method that is common between browsers or environments.

Pre-packaged libraries for popular browsers are simple. Libraries are bundled into a plug-in that contains JavaScript source files that have defined objects and types. When JSDT models an open file in the source editor, it first models the source code for the file, and then adds all the source files from the project's library collection to the model. The library source file is never validated, and is used only to define the object structure, attach the jsdoc that is visible in the levitation Help and content completion.

While the main function of the library is to manage the run-time context of JavaScript, it also provides another important feature-processing source file cross-references. Pure JavaScript does not have an explicit include function. One of the bad habits of developers is to spread functions across multiple source files. The Library configuration page can help manage cross project visibility between source files. If a project folder is marked as a source file, all JavaScript in that folder is included in the global scope. Use the Exclude mode to restrict folders.

Tools

Regardless of the higher level of design, let's take a closer look at these features. Some of the less visible but very important features of JSDT include the same text highlighting, automatic closing of curly braces (and parentheses, quotes), and automatic indentation. So it can be said, "as long as the good IDE should have, JSDT provide support."

Figure content Help

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.