Komodo Edit autocompletion JS object literal

雨燕双飞 提交于 2019-12-01 11:42:50
Paul Sweatte

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!