SnippetsQuickOpen.js 849 B

12345678910
  1. export default class SnippetsQuickOpen extends QuickOpen.FilteredListWidget.Provider{constructor(){super();this._snippets=[];}
  2. selectItem(itemIndex,promptValue){if(itemIndex===null){return;}
  3. Snippets.evaluateScriptSnippet(this._snippets[itemIndex]);}
  4. notFoundText(query){return Common.UIString('No snippets found.');}
  5. attach(){this._snippets=Snippets.project.uiSourceCodes();}
  6. detach(){this._snippets=[];}
  7. itemCount(){return this._snippets.length;}
  8. itemKeyAt(itemIndex){return this._snippets[itemIndex].name();}
  9. renderItem(itemIndex,query,titleElement,subtitleElement){titleElement.textContent=unescape(this._snippets[itemIndex].name());titleElement.classList.add('monospace');QuickOpen.FilteredListWidget.highlightRanges(titleElement,query,true);}}
  10. self.Snippets=self.Snippets||{};Snippets=Snippets||{};Snippets.SnippetsQuickOpen=SnippetsQuickOpen;