This proposal has been approved and the Eclipse N4JS project has been created.
Visit the project page for the latest information and development.

Eclipse N4JS

Friday, March 4, 2016 - 13:43 by Jens Von Pilgrim
This proposal is in the Project Proposal Phase (as defined in the Eclipse Development Process) and is written to declare its intent and scope. We solicit additional participation and input from the community. Please login and add your feedback in the comments section.
Project
Parent Project
Proposal State
Created
Background

ECMAScript, popularly known as JavaScript, has become an important programming language, not only as a scripting language for web pages, but also for larger projects, including rich web applications and even back-end software. In order to develop large projects successfully, static validation and sophisticated tooling are crucial. N4JS enriches ECMAScript with a static type system and provides extensive support for static validation hosted within a feature-rich IDE.

Scope

N4JS is an extension of ECMAScript providing a sound type system. It provides a transpiler to translate N4JS files to plain ECMAScript. The N4JS IDE enables the authoring of JS and N4JS files, providing tool support analogous to that of best-of-breed Java IDEs, e.g., Eclipse JDT.

Description

N4JS adds a static type system similar to that of Java to ECMAScript 2015. This type system support nominal and structural typing, in both cases supporting generics similar to that of Java 8. In order to capture details specific to ECMAScript,additional constructs are introduced such as union types, 'this' type, and special forms of structural types. Additional concepts required for larger projects are built in, e.g., dependency injection, test support, and various component types.

N4JS provides an extensible framework for representing and manipulating JS and N4JS files.Based on this framework, it provides integrated, extensible tooling that supports instantaneous validation, content assist, and quick fixes, as well as launch support for running the code and associated tests.

Why Here?

The N4JS IDE is based on the Eclipse platform and uses many associated Eclipse technologies, in particular Xtext. Not only does it provide a Java-based ECMAScript 2015 parser, it also produces EMF-based models for both the abstract syntax tree (AST) of JS and N4JS as well as the type model of N4JS. This makes it an ideal basis for implementing a host of interesting tools to analyze, maniuplulate, and transform JS and N4JS.

N4JS aims to build a community of contributors who will help build a powerful, feature-rich IDE.

Future Work

The current version is already stable and has been in production mode internally for over a year. Fixing bugs and adding minor improvements are on going work, of course. Additionally, the following topics are expected to be addressed:

  1. Improved UI experience, in particular customized content assist as well as more quick fixes.
  2. Improved ECMAScript 2015 support.
  3. Improved type inference.
  4. Improved refactoring capabilities.
  5. Improved node.js developer experience, e.g., support for browser-based projects.

Although tooling only supports N4JS and plain ECMAScript at the moment, it should be possible to also provide support for other ECMAScript typing approaches such as TypeScript in the future. Whether this is added or not depends on the community feedback and involvement.

Project Scheduling

The project is already using a build process similar to the one used by Eclipse projects, so it should be possible to quickly set up the Eclipse project with a nightly build once the project gets approved and the initial contribution as gone through the due diligence process.

Project Leads
Committers
Mark-Oliver Reiser (This committer does not have an Eclipse Account)
Torsten Krämer (This committer does not have an Eclipse Account)
Daniel Bölzle (This committer does not have an Eclipse Account)
Marcus Mews (This committer does not have an Eclipse Account)
Quang Tran (This committer does not have an Eclipse Account)
Mentors
Interested Parties

Sven Efftinge (Typefox GmbH, Eclipse Xtext)

Initial Contribution

The initial contribution consists of the N4JS IDE (and a headless version), tests, and a small ECMAScript runtime library. The code base consists of approximately 8,000 files. The pedigree of the code is as follows:

  1. The majority of the code is written either by NumberFour employees or by consultants working for NumberFour. This copyright holder for this code is by NumberFour AG.
  2. The ECMAScript test suite (github.com/tc39/test262, BSD License) in two versions (for ECMAScript 5 and ECMAScript 2015). For performance reasons, parts of these tests suits are archived and included in the test sources.
  3. The built-in ECMAScript APIs including some of the documentation have been copied from the ECMAScript 5 and 2015 (ed. 6) specification (ecma-international.org/../Ecma-262), License

The code has the following dependencies, which are to be resolved during build and run time:

  1. Several Eclipse projects.
  2. Third party projects found in the Eclipse orbit (e.g., ANTLR, Guava, Guice, some Apache commons projects).
  3. xpect-tests.org, Eclipse Public License; Author: Moritz Eysholdt
  4. XSemantics, xsemantics.sourceforge.net, Eclipse Public License; Author: Lorenzo Bettini
Source Repository Type