Here's a snippet for Komodo JavaScript macros that gives the name of the current method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | function getCurrentMethodName() {
var view = ko.views.manager.currentView;
var scimoz = view.scimoz;
var ciBuf = view.koDoc.ciBuf;
var x = ciBuf.curr_section_from_line(view.currentLine);
return x.title;
}
var s;
try {
s = getCurrentMethodName();
} catch(ex) {
s = "Failed getCurrentMethodName: " + ex;
}
alert(s);
|
This isn't perfect. If the cursor falls after the last method, it returns the name of that method.
ciBuf.curr_section_from_line(view.currentLine) returns a koICodeIntelSection object. You can explore the IDL for that class to determine other methods available on it.