में ओओ जावास्क्रिप्ट कोड पूर्णता क्या आप किसी भी आईडीई को जानते हैं जो इस तरह के कोड को स्वत: पूर्ण कर सकता है?किसी भी आईडीई
मैं यहाँ एक जावास्क्रिप्ट वर्ग जनरेटर है:
(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;
};
})();
मैं जरूरत कोड पूर्णता (टिप्पणी में लिखा था) इन उदाहरण कक्षाओं के लिए:
//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]
तो मैं आईडीई किसी भी तरह पता है चाहिए, कि ये फ़ंक्शंस फ़ंक्शन.प्रोटोटाइप में मौजूद हैं, और ये फ़ंक्शन फ़ंक्शन इंस्टेंस बना रहे हैं और वे उन उदाहरणों के प्रोटोटाइप में लिख रहे हैं। यह केवल मेरे कोड की मैन्युअल इंडेक्सिंग के साथ ही संभव है, जैसे jsdoc, लेकिन उदाहरण विरासत के लिए वर्णन करने के लिए पर्याप्त नहीं है। इसलिए मुझे एक आईडीई की आवश्यकता है जो कम से कम जेएस विरासत को संभाल सके, और जिसके लिए मैं एक प्लगइन लिख सकता हूं जो स्वचालित रूप से इस इंडेक्सिंग को बनाता है। (शायद प्लगइन विरासत को भी संभाल सकता है, मुझे नहीं पता कि यह इंडेक्सिंग वास्तव में कैसे काम करता है ...)
कौन सा आईडीई उस (और कैसे) में सक्षम है?
क्या आप आईडीई स्वत: पूर्ण करना चाहते हैं: webstorm में jsdoc 3 के साथ मूल उदाहरण (Resharper दृश्य स्टूडियो के लिए परीक्षण नहीं किया, लेकिन यह या तो जेटब्रेन्स उत्पाद है, तो यह संभवतः भी काम करता है।)
? एक उदाहरण दिखाएं .. – Baz1nga
Function.create, ParentClass.extend, और उदाहरणों के वापसी मान ... javadoc की तरह कुछ भी मेरे लिए स्वीकार्य है। सबसे अच्छा होगा अगर मैं इन विशेष कार्यों की व्याख्या करने के लिए कोड पूर्णता प्लगइन को ओवरराइड कर सकता हूं ... – inf3rno
जेटब्रेन से इंटेलिजे बाजार पर हाथों का सबसे अच्छा आईडीई है। मुझे यकीन नहीं है कि मैं आपकी आवश्यकता को समझता हूं, लेकिन यह जावास्क्रिप्ट के साथ एक सुंदर काम करता है। – duffymo