When working on .js files in xcode, the method browser works and list traditional functions. Such as:
function OBj (e){
for (var i in e) {
enyo.log("element ", i, " is ", e[i])
}
};
or…
var OBj = function(e) {
for (var i in e) {
enyo.log("element ", i, " is ", e[i])
}
};
But what about other patterns?…. such as:
Obj.method({
init: function() {},
data: function() {},
})
This is where xcode falls short for me. So in this question/answer post, I present a shell script which I wrote in order to provide the type of method navigation which I needed for the javascript pattern type that I used. Utilizing the marker ??? feature in xcode, the shell script simply loops through all .js files in a specified folder, and by way of pattern matching it seeks out all methods that adheres to the pattern:
init: function() {},
It injects a commented matching marker so you would now have:
Obj.method({
//???:init
init: function() {},
//???:data
data: function() {},
})
Which happily shows up on xcode’s method drop down list:

I have provided the script as the answer part to my question. Simply copy and paste into a file. Put that file inside the folder where your JS files are located. From the terminal, cd to that folder and run the shell script: ./scriptname
Golden!!!
1 Answer