Code Completion - Aptana Eclipse Plugin

I have been developing javascript for the past few weeks and have been trying JSDT and Aptana to help complete the code. JSDT was not very good, but I was more fortunate with Aptana (used as an eclipse plugin, not a separate product). The problem I am facing is that when I create javascript classes, I cannot complete the code. For example, if I use the following, then code completion does not work:

var foo = new function(value){
   this.myMethod= function(){
   }
}

I also checked that the following will not work:

function foo(value){
   this.myMethod= function(){
   }
}

I found that using JSON style really works:

var foo = {
    myMethod: function(){

    }
}

Does anyone know why Aptana works for the latter style, but not the first? Using the JSON style will not work for me, because I must have separate instances of the class in question.

, . , 3 javascript, Aptana JSON . DID ( 2 , ), , , .

.


, :

/**
* The foo function
*/
function foo() { 
}

/**
* The bar function
* @param {Object} a Object a
 * @param {Object} b Object b
 */
function bar(a, b){
};

foo.prototype.b = bar;

var x = new foo();
x.b

, . , .

/**
* The foo function
*/
var foo = new function() { 
}

/**
* The bar function
* @param {Object} a Object a
 * @param {Object} b Object b
 */
function bar(a, b){
};

foo.prototype.b = bar;

var x = new foo();
x.b

? javascript?

+3
2

, , Aptana. Aptana , :

var foo = function(){
}
foo.prototype.a = "a"
foo.prototype.b = function(){ alert(this.a) }

, .

. , , f = new foo(), f = new bar(), ol 'Object, foo bar. (b = new bar() f = new foo()) , , .

? javascript?

" ()", ` new function() ` "f" JavaScript, -

var foo = new function(){ ... }

var foo = { ... } // JSON style

var foo = function(){ ... }

. , JS "", . .

- , Aptana [JSON], ?

JSON foo, Aptana . , ​​ , Aptana, , , , . , Aptana, . ( , , , , ). http://www.phpied.com/3-ways-to-define-a-javascript-class/

+2

JavaScript Aptana ( "Windows" > "" > " " *.js)? Aptana JS, JavaScript ( - ). , .

0

Source: https://habr.com/ru/post/1737229/


All Articles