HelpQuickOpen.js 1.0 KB

123456789
  1. export class HelpQuickOpen extends QuickOpen.FilteredListWidget.Provider{constructor(){super();this._providers=[];self.runtime.extensions(QuickOpen.FilteredListWidget.Provider).forEach(this._addProvider.bind(this));}
  2. _addProvider(extension){if(extension.title()){this._providers.push({prefix:extension.descriptor()['prefix'],title:extension.title()});}}
  3. itemCount(){return this._providers.length;}
  4. itemKeyAt(itemIndex){return this._providers[itemIndex].prefix;}
  5. itemScoreAt(itemIndex,query){return-this._providers[itemIndex].prefix.length;}
  6. renderItem(itemIndex,query,titleElement,subtitleElement){const provider=this._providers[itemIndex];const prefixElement=titleElement.createChild('span','monospace');prefixElement.textContent=(provider.prefix||'\u2026')+' ';titleElement.createTextChild(provider.title);}
  7. selectItem(itemIndex,promptValue){if(itemIndex!==null){QuickOpen.QuickOpen.show(this._providers[itemIndex].prefix);}}
  8. renderAsTwoRows(){return false;}}
  9. self.QuickOpen=self.QuickOpen||{};QuickOpen=QuickOpen||{};QuickOpen.HelpQuickOpen=HelpQuickOpen;