Skip to content

Commit

Permalink
Update toggle-view.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Mar 5, 2021
1 parent c633fe2 commit 8da6aa5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/toggle-view.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CompositeDisposable, Emitter, Disposable } from 'atom'
import type { SelectListView } from "atom-select-list"

// https://github.com/atom/atom-select-list/pull/28
let SelectListView: any
let SelectListViewImport: SelectListView
type ToggleAction = 'enable' | 'disable'

export default class ToggleProviders {
Expand Down Expand Up @@ -40,19 +40,19 @@ export default class ToggleProviders {
}
atom.config.set('linter.disabledProviders', this.disabledProviders)
}
show() {
if (!SelectListView) {
SelectListView = require('atom-select-list')
async show() {
if (SelectListViewImport === undefined) {
SelectListViewImport = await import('atom-select-list')
}
const selectListView = new SelectListView({
const selectListView = new SelectListViewImport({
items: this.getItems(),
emptyMessage: 'No matches found',
elementForItem: (item: any) => {
elementForItem: (item: string) => {
const li = document.createElement('li')
li.textContent = item
return li
},
didConfirmSelection: (item: any) => {
didConfirmSelection: (item: string) => {
try {
this.process(item)
this.dispose()
Expand Down

0 comments on commit 8da6aa5

Please sign in to comment.