1

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?

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
mef
  • 46
  • 4
  • So if your (implied) question is how to work around this I guess you could omit the `window.App||` part while you are editing the file and then put it back for testing/deployment. – nnnnnn Feb 22 '12 at 10:14
  • Yep, but I wish intelli-sense were more intelligent :) – mef Feb 22 '12 at 10:24

1 Answers1

2

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.

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265