const {SelectListView} = require('atom-space-pen-views') module.exports = class SuggestedDefinition extends SelectListView { constructor () { super() this.editor = null this.addClass('overlay from-top') this.panel = atom.workspace.addModalPanel({ item: this.getElement(), visible: false }) } viewForItem (item) { return `
  • ${item}
  • ` } confirmed (item) { this.hide() const position = this.editor.getCursorBufferPosition() const definition = `${item}_ ` this.editor.insertText(definition) position.column = position.column + definition.length this.editor.setCursorBufferPosition(position) } cancelled () { this.hide() this.editor.component.didFocus() } // Returns an object that can be retrieved when package is activated serialize () {} // Tear down any state and detach destroy () { this.element.remove() } getElement () { return this.element } show (editor, items) { this.editor = editor this.setItems(items) this.panel.show() this.focusFilterEditor() } hide () { this.panel.hide() } }