[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [wtp-dev] JSDT enhancements | 
Hello,
I'd like to introduce a variant of JSDT that I've been 
working on. It's goal is to improve the quality of _javascript_ content 
assist without requiring JSDoc, VJO, or otherwise constraining how one 
writes _javascript_.
The main difference to existing JSDT is that it uses NJSDoc [1] as 
the data source. NJSDoc works by executing code in a modified Rhino 
runtime and analyzing the resulting structure. The Rhino runtime is 
modified in two ways: very few things will cause an error and second it 
stores the code location of every assignment and slot creation. This 
allows the NJSDoc algorithm to calculate precise definition locations 
even in nested or indirectly created classes or structures.
JSDT integrated with the NJSDoc algorithm is efficient. For a very large 70,000 line of code project here are the costs:
- 5.5Mb of cached Rhino bytecode
- 4.5Mb for the NJSDoc structure including resolved class hierarchy and comments attached to the structure 
- 800ms to naively recreate the global NJSDoc structure after an edit
I've
 implemented basic integration with type resolution. Global variable and
 class member completion is working. Also hoverdoc and jump to 
definition is working.
Here is my plan:
- Use JSDoc comments to hint types
- Add ability to manually hint the type of a local variable (an example of this in Scheme is here [2])
- Built in support for AMD spec and maybe CommonJS modules
- Improve performance, eliminate more JDT specific code
 
Eventually
 I'd like the code to be merged back into JSDT assuming it proves useful
 to users. I'll share the code and set up an update site soon.
Let me know if you have any comments on this approach or in general. 
Regards,
John
[1] 
https://bitbucket.org/nexj/njsdoc [2] 
http://imgur.com/a/VTYAi