Conosci qualche IDE che può completare automaticamente questo tipo di codice?Oo completamento del codice javascript in qualsiasi ID
Ho un generatore di classe javascript qui:
(function() {
var core = {
bind : function(method, scope) {
if (!(method instanceof Function))
throw new TypeError("Function needed as method.");
if (typeof (scope) != "object")
throw new TypeError("Object needed as scope.");
return function() {
return method.apply(scope, arguments);
};
},
require : function(source) {
if (typeof (source) != "object" || !source)
throw new TypeError("Object needed as source.");
for (var property in source)
if (source.hasOwnProperty(property) && !this.prototype.hasOwnProperty(property))
this.prototype[property] = source[property];
},
override : function(source) {
if (typeof (source) != "object" || !source)
throw new TypeError("Object needed as source.");
for (var property in source)
if (source.hasOwnProperty(property))
this.prototype[property] = source[property];
},
extend : function(source) {
var superClass = this;
var newClass = source.hasOwnProperty("constructor") ? source.constructor : function() {
superClass.apply(this, arguments);
};
newClass.superClass = superClass;
var superClone = function() {
};
superClone.prototype = superClass.prototype;
newClass.prototype = new superClone();
newClass.prototype.constructor = newClass;
if (source)
newClass.override(source);
return newClass;
}
};
core.require.call(Function, core);
Function.create = function (source){
var newClass = source.hasOwnProperty("constructor") ? source.constructor : function() {};
newClass.override(source);
return newClass;
};
})();
ho bisogno di completamento del codice (scritto nei commenti) per queste classi di esempio:
//Function.prototype: bind, require, override, extend
//Function.create
var A = Function.create({ //offer Function.[create]
test: function(){
console.log("a");
}
});
//A is a Function instance
//A.prototype: test
var B = A.extend({ //offer A.[extend]
test: function(){
console.log("b");
},
test2: function(){
console.log("b2");
}
});
//B is a Function instance
//B.prototype inherits from A.prototype
//B.prototype.test overrides A.prototype.test
var F = Function.create({ //offer Function.[create]
getA: function(){
return new A();
},
getB: function(){
return new B();
}
});
//F is a Function instance
//F.prototype getA, getB returns A and B instances
var f = new F(); //offer [F]
//f inherits from F.prototype
var a = f.getA(); //offer f.[getA]
//a inherits from A.prototype
var b = f.getB(); //offer f.[getB]
//b inhertis from B.prototype
a.test(); //offer a.[test]
b.test(); //offer b.[test]
b.test2(); //offer b.[test2]
Quindi devo lasciare l'IDE in qualche modo sa, che queste funzioni siano presenti nel Function.prototype e queste funzioni stanno creando istanze di funzione e stanno scrivendo nel prototipo di tali istanze. Questo è possibile solo con l'indicizzazione manuale del mio codice, come jsdoc, ma questo non è sufficiente per descrivere ad esempio l'ereditarietà. Quindi ho bisogno di un IDE che possa gestire almeno l'ereditarietà di js, e per il quale posso scrivere un plugin che crei automaticamente questa indicizzazione. (Forse il plugin può gestire anche l'ereditarietà, non so come funziona esattamente l'indicizzazione ...)
Quale IDE è in grado (e come)?
cosa vuoi l'IDE per completare automaticamente ? mostra un esempio .. – Baz1nga
I valori di ritorno di Function.create, ParentClass.extend e le istanze ... Ofc qualcosa come javadoc è accettabile per me. Il meglio sarebbe se potessi scavalcare il plugin di completamento del codice per interpretare queste funzioni speciali ... – inf3rno
IntelliJ di JetBrains è il miglior IDE sul mercato, a mani basse. Non sono sicuro di aver compreso le tue esigenze, ma fa un bel lavoro con JavaScript. – duffymo