Developing a legal IDE based on Atom
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
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 `<li>${item}</li>` }
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() } }
|