Komodo Edit autocompletion JS object literal

前端 未结 1 539
情书的邮戳
情书的邮戳 2021-01-16 11:18

The problem is Komodo intelli-sense doesn\'t see object methods defined this way:

var App = window.App || {
  method: function() {
    ...
  }
}


        
相关标签:
1条回答
  • 2021-01-16 12:10

    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.

    0 讨论(0)
提交回复
热议问题