Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 415257

Summary: [hotfeature_request] Allow to create variables, methods and references without AST
Product: [WebTools] JSDT Reporter: Dawid Pakula <zulus>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: CLOSED WONTFIX QA Contact: Chris Jaun <cmjaun>
Severity: enhancement    
Priority: P3 CC: cbridgha, nboldt, thatnitind
Version: unspecifiedKeywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Dawid Pakula CLA 2013-08-16 15:33:10 EDT
Request based on a WTP wiki
1. Project ExtJS JSDT Integration: http://marketplace.eclipse.org/content/extjs-jsdt-integration
2. When: As soon as posible.
3. Description:
I'm working on full JSDuck support for this plugin (maybe later I put it into external plugin). Sometimes only information I have while inferencing is a comment. Modified JSDuck example: 

/**
 * @class Duck
 * A duck, not just a stupid bird.
 * @extends Bird
 * @mixins Ext.util.Observable
 * @mixins Fliable
 * @singleton
 */
var x = {
   /**
    * @property {String} var1
    */
   // @cfg {Boolean} other
};
/**
 * @member Ext
 * @method myFunx
 * @inheritDoc myClassFromExternalFile#f
Ext.myFunx = myClassFromExternalFile.f;

Its ok, if variable/method exists, I can find valid comment and read what I need, but if not exists (like @property) and I'll try to add it manualy to inferred class I'll got a tons of errors (NPE etc...).

Reference to method/variable from external file is also immposible.

Another option is allow to inject some items into AST (own class aliases, special information for class etc...). If you agree, I could work on the appropriate extension/patch for JSDT
Comment 1 Dawid Pakula CLA 2014-01-08 01:18:33 EST
I'm switching to hotfeature_request. 
Another example when this feature is necessary:
Code:
Ext.define('MyClass', {
  config : {
    price : 100
  }
});


I should register methods:
MyClass.getPrice();
MyClass.setPrice(int price);

Another, create global variable/field for singletons:
Ext.define('SecondClass', {
 singleton : true
});

After registering SecondClass I should register also global variable "SecondClass" with type SecondClass.
Comment 2 Chris Jaun CLA 2014-02-06 13:20:28 EST
Hi Dawid,

I added the helpwanted tag, so if you, or someone else, provides a patch we can accept this as a hot feature.

Sounds like this is work that can be done in the inference engine. Do you have a proposal of how you would change things there?

Chris
Comment 3 Dawid Pakula CLA 2014-02-06 14:10:07 EST
Hi Chris,

Thank you. Currently is immposible due design issue.

Model and AST are always mixed on each process (FlowAnalyse, Binding, inferencing etc...):
InferredMethod is a model (off course connected to InferredType). But parameters list, return type etc.. are always readed from AST (IFunctionDeclaration).

InferredAttribute (field representation) contain field type information, but if it isn't set, JSDT trying to read it from AST.

So, as long as model will be mixed with AST, it will be not easy to register "dynamic model elements" :(
Comment 4 Dawid Pakula CLA 2014-07-15 07:55:18 EDT
As an alternative, maybe DLTK model is better?

Parse -> Compile Model (IType, IField, IMethod ...) -> TI
     \-> Index

Type Inferencing is done on demand (CA, syntax highlighting, override indicators and more), with compiled model and AST.

Each process (Compilation, Indexing, Inferencing, CA) is fully pluggable and can be easy extended.
Comment 5 Nick Boldt CLA 2018-05-24 14:22:54 EDT
Closing as won't fix after triage session in dev call on 05/24.
Comment 6 Dawid Pakula CLA 2018-06-14 05:36:38 EDT
This mean that JSDT will be slow syntax highlighter forever, or will be possible to modify inference / structure in different way?