.

Tags:

Version 0.5 of Eclipse Orion, the web-focused IDE, has been released. One of its improved features is a better editing autocomplete, known in the Eclipse world as Content Assist or within Microsoft Visual Studio users as IntelliSense. The logic to drive the autocompletion is made possible because the parser understands syntax errors in the source text and keeps going without the need to stop immediately.

Orion autocompletion backend is based on Esprima, the fast JavaScript parser I’ve started some months ago. In the Esprima world, the ability to recover from a parsing error is denoted as tolerant mode. This is still a work-in-progress, see issue 130, although it already works to a certain extent. Orion itself uses a modified version of Esprima with a higher level of error tolerance, this will be somehow merged back into upstream at some point in the near future.

The blog post Better JavaScript content assist in Eclipse Orion from Andrew gives a detailed information how content assist works. This is a must read if you want to know what happens behind the scene and would like to apply the approach for other uses cases.

The parser in a real JavaScript engine usually will refuse to continue once it finds an error. This makes sense, there is no benefit of processing the code if it is not valid anyway. However, we can see from the above smart autocompletion feature that sometimes a tolerant parser can be really useful!

  • http://www.ronaldwidha.net/ ronaldwidha

    ya. let’s teman macet lagi yuk. next topic: Esprima

    • http://ariya.ofilabs.com/ Ariya Hidayat

      Boleh!

  • Vince

    It’s worth pointing out that Visual Studio compiles your JavaScript in a background thread giving you much better Intellisense. It’s almost as if your working with a static language. If want to be productive and you rely on autocompletion to discover your APIs then eclipse is not your best choice.

    • http://ariya.ofilabs.com/ Ariya Hidayat

      Please try Orion and see if you can elaborate its disadvantages which make it unlikely becoming the best choice.