Skip to main content

Notice: This Wiki is now read only and edits are no longer 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/JSDT Code Analytics"

Line 3: Line 3:
 
JSDT 2.0 is missing the content outline and content proposal functionality.
 
JSDT 2.0 is missing the content outline and content proposal functionality.
  
* In '''JSDT 1.0''' we used to parse all the .js files with Rhino and to store the AST in memory.  
+
* In '''JSDT 1.0''' we used to parse all the .js files with Rhino and to store the AST in memory. With the full AST in memory, it was easy to generate a content outline tree and then to use inference to provide the content assist.  
With the full AST in memory, it was easy to generate a content outline tree and then to use inference to provide the content assist.  
+
* In '''JSDT 2.0''' we introduced tolerant parsing, but we parse only the .js files which are open in the editor. Also, we do not load the full AST in memory, we do not generate a full content outline tree and we don't provide content assist.  
* In '''JSDT 2.0''' we introduced tolerant parsing, but we parse only the .js files which are open in the editor.  
+
Also, we do not load the full AST in memory, we do not generate a full content outline tree and we don't provide content assist.  
+
  
 
Despite JSDT 2.0 is modern and fast, we should fix content outline and content assist for making users happy,  
 
Despite JSDT 2.0 is modern and fast, we should fix content outline and content assist for making users happy,  
Line 13: Line 11:
 
== Tern ==
 
== Tern ==
  
Tern.js is a code-analysis engine for JavaScript written in javascript.  
+
Tern.js is a code-analysis engine for JavaScript written in javascript. It is a good model for the functionalities we want to improve.
It is a good model for the functionalities we want to improve.
+
As a downside, it requires loading all the source files, which should be sent POST to an http server.  
The downside is it requires loading all the source files through POST to an http server.  
+
  
The downside is it requires to load the
+
== Js Program ==
  
altough
+
We could write a .js program which loads all the available source files, and then outputs a json file with all the information needed to build a content tree and store it on disk. Then, we could use the .json file on disk to infer the suggestions.
Tern is a good model for the functionalities we want to improve.
+
Tern
+
Tern is written in javascript, and it uses its parser
+
 
+
Tern is a good model of application
+
 
+
Tern
+
Tern uses Acorn to parse
+
Looking at Tern, we have
+
 
+
despite JSDT is fase
+
Users seems unhappy, but JSDT 2.0 in
+
We can read that users are unhappy of the current behavior (ie [https://bugs.eclipse.org/bugs/show_bug.cgi?id=510677#c3 Bug 510677#c3]),
+
and
+
[https://bugs.eclipse.org/bugs/show_bug.cgi?id=510677#c3 Bug 510677#c3]
+
How we can improve
+
 
+
We also decided to not to load the full AST in memory
+
 
+
part of the .js files
+
Since JSDT 2.0, we have tolerant parsing,
+
 
+
In JSDT 2.0, we introduced tolerant parsing, and we started to parse the
+
In JSDT 2.0 (Neon.3), we use Closure Compiler to parse the open file only, and we don't consider the other files, nor we store a complete AST in memory.
+
 
+
 
+
 
+
Our current parser (Closure Compiler) parses only the open file, and doesn't consider
+
 
+
 
+
In [https://bugs.eclipse.org/bugs/show_bug.cgi?id=510677#c3 Bug 510677#c3]
+
 
+
 
+
JSDT is missing a content outli
+
  
  
 
How can we improve JSDT by restoring the content outline and the content proposal?
 
How can we improve JSDT by restoring the content outline and the content proposal?
  
I think it all starts by having a tree representing the content outline  
+
I think it all starts by having a tree representing the content outline
 
+
 
+
Think at Tern:
+
 
+
 
+
How can we improve JSDT by restoring the content outline and the content proposal?
+
 
+
 
+
Tern is able to read the
+
 
+
restore the content outline
+
 
+
restore content proposal
+

Revision as of 20:16, 18 April 2017

JSDT Code Analytics

JSDT 2.0 is missing the content outline and content proposal functionality.

  • In JSDT 1.0 we used to parse all the .js files with Rhino and to store the AST in memory. With the full AST in memory, it was easy to generate a content outline tree and then to use inference to provide the content assist.
  • In JSDT 2.0 we introduced tolerant parsing, but we parse only the .js files which are open in the editor. Also, we do not load the full AST in memory, we do not generate a full content outline tree and we don't provide content assist.

Despite JSDT 2.0 is modern and fast, we should fix content outline and content assist for making users happy, (ie Bug 510677#c3).

Tern

Tern.js is a code-analysis engine for JavaScript written in javascript. It is a good model for the functionalities we want to improve. As a downside, it requires loading all the source files, which should be sent POST to an http server.

Js Program

We could write a .js program which loads all the available source files, and then outputs a json file with all the information needed to build a content tree and store it on disk. Then, we could use the .json file on disk to infer the suggestions.


How can we improve JSDT by restoring the content outline and the content proposal?

I think it all starts by having a tree representing the content outline

Back to the top