问题
The problem is Komodo intelli-sense doesn't see object methods defined this way:
var App = window.App || {
method: function() {
...
}
}
Typing "App." gives no result.
However, defining an object like below works fine:
var App = {
method: function(){
}
}
How to make autocompletion working at first example pattern?
回答1:
Komodo has a macro API which can automate switching between the two patterns. Use the Add macro context menu option to create a new macro and paste the following code:
komodo.assertMacroVersion(2);
if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus(); } // bug 67103
// define visual mode pattern
var logical_or = RegExp(/\swindow.App\s\|\|/).exec(ko.views.manager.currentView.scimoz.text);
// check for visual mode pattern
if (logical_or)
{
Find_ReplaceAllInMacro(window, 0, '\\s(window.App\\s\\|\\|)', '/*\\1*/', true, 2, 0, false, false); // replace with intellisense mode pattern
// show mode in status bar
ko.statusBar.AddMessage("Intellisense Mode", "imap", 0);
}
// check for intellisense mode pattern
else
{
Find_ReplaceAllInMacro(window, 0, '/*window.App ||*/', ' window.App ||', true, 0, 0, false, false);
ko.statusBar.AddMessage("Visual Mode", "vmap", 0);
}
Click the macro in the toolbox to toggle between intellisense mode and visual mode.
As an alternative, a JSDoc comment may work as well.
来源:https://stackoverflow.com/questions/9392676/komodo-edit-autocompletion-js-object-literal