diff --git a/lib/main.js b/lib/main.js index fc72db2..6c9de10 100644 --- a/lib/main.js +++ b/lib/main.js @@ -209,7 +209,7 @@ class JavaLanguageClient extends AutoLanguageClient { return atom.packages.getLoadedPackages() .filter(pkg => Array.isArray(pkg.metadata.javaExtensions)) .map(pkg => pkg.metadata.javaExtensions.map(p => path.resolve(pkg.path, p))) - .reduce(e => e.concat([])); + .reduce(e => e.concat([]), []); } updateInstallStatus (status) { diff --git a/lib/views/importSuggestionListView.js b/lib/views/importSuggestionListView.js index c5d239b..d3823a6 100644 --- a/lib/views/importSuggestionListView.js +++ b/lib/views/importSuggestionListView.js @@ -1,3 +1,4 @@ +const { TextEditor } = require('atom') const SelectList = require('atom-select-list') class ImportSuggestionListView { @@ -5,8 +6,6 @@ class ImportSuggestionListView { if (importSuggestions.length === 0) throw new Error('Import suggestions list cannot be empty') - this.importSuggestions = importSuggestions - let listInitializer = { items: importSuggestions, elementForItem: (itm, { index }) => { @@ -28,14 +27,22 @@ class ImportSuggestionListView { }) this.selectList = new SelectList(listInitializer) - this.panel = atom.workspace.addModalPanel({ item: this.selectList.element }) - this.selectList.focus() this.panel.show() + this.selectList.focus() } waitForConfirmOrCancel() { return this._promise } - close() { if (this.panel) this.panel.destroy() } + + close() { + if (this.panel) { + this.panel.destroy() + + const activeItem = atom.workspace.getActivePaneItem() + if (activeItem && activeItem instanceof TextEditor) + activeItem.element.focus(); + } + } } module.exports = ImportSuggestionListView