| 1 | import { AutoCompleteOption } from './AutoCompleteOption.js'; |
| 2 | |
| 3 | export class MacroAutoCompleteOption extends AutoCompleteOption { |
| 4 | /**@type {string}*/ fullName; |
| 5 | /**@type {string}*/ description; |
| 6 | |
| 7 | |
| 8 | constructor(name, fullName, description) { |
| 9 | super(name, '{}'); |
| 10 | this.fullName = fullName; |
| 11 | this.description = description; |
| 12 | this.nameOffset = 2; |
| 13 | } |
| 14 | |
| 15 | |
| 16 | renderItem() { |
| 17 | let li; |
| 18 | li = this.makeItem(`${this.fullName}`, '{}', true, [], [], null, this.description); |
| 19 | li.setAttribute('data-name', this.name); |
| 20 | li.setAttribute('data-option-type', 'macro'); |
| 21 | return li; |
| 22 | } |
| 23 | |
| 24 | |
| 25 | renderDetails() { |
| 26 | const frag = document.createDocumentFragment(); |
| 27 | const specs = document.createElement('div'); { |
| 28 | specs.classList.add('specs'); |
| 29 | const name = document.createElement('div'); { |
| 30 | name.classList.add('name'); |
| 31 | name.classList.add('monospace'); |
| 32 | name.textContent = this.fullName; |
| 33 | specs.append(name); |
| 34 | } |
| 35 | frag.append(specs); |
| 36 | } |
| 37 | const help = document.createElement('span'); { |
| 38 | help.classList.add('help'); |
| 39 | help.innerHTML = this.description; |
| 40 | frag.append(help); |
| 41 | } |
| 42 | return frag; |
| 43 | } |
| 44 | } |