<commit_before>const { config, packages, inSpecMode } = atom
import LinterUI from './main'
import type Intentions from './intentions'
import type { /* IntentionsListProvider, */ PackageExtra } from './types'
import type { StatusBar as StatusBarRegistry } from 'atom/status-bar'
import type { BusySignalRegistry } from 'atom-ide-base'

const idleCallbacks: Set<IdleCallbackHandle> = new Set()

const instances: Set<LinterUI> = new Set()
let signalRegistry: BusySignalRegistry | undefined
let statusBarRegistry: StatusBarRegistry | undefined

export function activate() {
  if (config.get('linter-ui-default.useBusySignal') as boolean) {
    // This is a necessary evil, see steelbrain/linter#1355
    ;(packages.getLoadedPackage('linter-ui-default') as PackageExtra).metadata['package-deps'].push('busy-signal')
  }

  const callbackID = window.requestIdleCallback(function installLinterUIDefaultDeps() {
    idleCallbacks.delete(callbackID)
    if (!inSpecMode()) {
      const { install } = require('atom-package-deps')
      install('linter-ui-default')
    }
  })
  idleCallbacks.add(callbackID)
}

export function deactivate() {
  idleCallbacks.forEach(callbackID => window.cancelIdleCallback(callbackID))
  idleCallbacks.clear()
  for (const entry of instances) {
    entry.dispose()
  }
  instances.clear()
}

export function provideUI(): LinterUI {
  const instance = new LinterUI()
  instances.add(instance)
  if (signalRegistry) {
    instance.signal.attach(signalRegistry)
  }
  return instance<commit_msg>fix: do not destructure atom.inSpecMode<commit_after>const { config, packages } = atom
import LinterUI from './main'
import type Intentions from './intentions'
import type { /* IntentionsListProvider, */ PackageExtra } from './types'
import type { StatusBar as StatusBarRegistry } from 'atom/status-bar'
import type { BusySignalRegistry } from 'atom-ide-base'

const idleCallbacks: Set<IdleCallbackHandle> = new Set()

const instances: Set<LinterUI> = new Set()
let signalRegistry: BusySignalRegistry | undefined
let statusBarRegistry: StatusBarRegistry | undefined

export function activate() {
  if (config.get('linter-ui-default.useBusySignal') as boolean) {
    // This is a necessary evil, see steelbrain/linter#1355
    ;(packages.getLoadedPackage('linter-ui-default') as PackageExtra).metadata['package-deps'].push('busy-signal')
  }

  const callbackID = window.requestIdleCallback(function installLinterUIDefaultDeps() {
    idleCallbacks.delete(callbackID)
    if (!atom.inSpecMode()) {
      const { install } = require('atom-package-deps')
      install('linter-ui-default')
    }
  })
  idleCallbacks.add(callbackID)
}

export function deactivate() {
  idleCallbacks.forEach(callbackID => window.cancelIdleCallback(callbackID))
  idleCallbacks.clear()
  for (const entry of instances) {
    entry.dispose()
  }
  instances.clear()
}

export function provideUI(): LinterUI {
  const instance = new LinterUI()
  instances.add(instance)
  if (signalRegistry) {
    instance.signal.attach(signalRegistry)
  }
  return instance
{'fraction_non_alphanumeric': 0.11668305473615208, 'fraction_numerical': 0.002622091117666339, 'mean_word_length': 4.824427480916031, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6737298', 'n_tokens_mistral': 907, 'n_tokens_neox': 910, 'n_words': 214}