<commit_before>{CompositeDisposable} = require 'atom'

cached_themes =
  ui: []
  syntax: []

module.exports = Sunset =
  config:
    daytime_syntax_theme:
      title: 'Daytime Theme (Syntax)'
      description: 'What syntax theme should I use during daylight?'
      type: 'string'
      default: 'atom-light-syntax'
    daytime_ui_theme:
      title: 'Daytime Theme (UI)'
      description: 'What UI theme should I use during daylight?'
      type: 'string'
      default: 'atom-light-ui'
    nighttime_syntax_theme:
      title: 'Nighttime Theme (Syntax)'
      description: 'What syntax theme should I use during nighttime?'
      type: 'string'
      default: 'atom-dark-syntax'
    nighttime_ui_theme:
      title: 'Nighttime Theme (UI)'
      description: 'What UI theme should I use during nighttime?'
      type: 'string'
      default: 'atom-dark-ui'
    when_does_it_get_dark:
      title: 'When does nighttime start?'
      description: 'When (in 24hr format) does the sun set?'
      default: 1800
      minimum: 0
      maximum: 2400
      type: 'number'
    when_does_it_get_light:
      title: 'When does daytime start?'
      description: 'When (in 24hr format) does the sun rise?'
      default: 500
      minimum: 0
      maximum: 2400
      type: 'number'
    has_been_configured:
      title: 'This plugin has been configured?'
      description: 'Internal state tracking. Don\'t change this yourself unless you are ok with bugs.'
      default: false
      type: 'boolean'

  subscriptions: null

  activate: (state) ->
    @tock = setInterval () =>
      @tick()
    , 1 * 60 * 1000

    @setup()
    @bindEvents()
    @tick()

    atom.themes.getLoadedThemes().forEach (theme) ->
      cached_themes.ui.push(theme.name) if theme.metadata.theme is 'ui'
      cached_themes.syntax.push(theme.name) if theme.metadata.theme is 'syntax'

    @config.daytime_syntax_theme.description =
      @config.nighttime_syntax_theme.description =
        'Values can be `' + cached_themes.syntax.join(', ') + '`'

    @config.daytime_ui_theme.description =
      @config.nighttime_ui_theme.description =
        'Values can be `' + cached_themes.ui.join(', ') + '`'

    # Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
    @subscriptions = new CompositeDisposable

  bindEvents: ->
    atom.config.observe 'sunset.nighttime_ui_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)
      @setup()
      @tick()

    atom.config.observe 'sunset.nighttime_syntax_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)
      @setup()
      @tick()

    atom.config.observe 'sunset.daytime_ui_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)<commit_msg>Harmonize with Atom's default setup and language<commit_after>{CompositeDisposable} = require 'atom'

cached_themes =
  ui: []
  syntax: []

module.exports = Sunset =
  config:
    daytime_syntax_theme:
      title: 'Daytime Syntax Theme'
      description: 'What syntax theme should I use during daylight?'
      type: 'string'
      default: 'one-light-syntax'
    daytime_ui_theme:
      title: 'Daytime UI Theme'
      description: 'What UI theme should I use during daylight?'
      type: 'string'
      default: 'one-light-ui'
    nighttime_syntax_theme:
      title: 'Night-time Syntax Theme'
      description: 'What syntax theme should I use during nighttime?'
      type: 'string'
      default: 'one-dark-syntax'
    nighttime_ui_theme:
      title: 'Night-time UI Theme'
      description: 'What UI theme should I use during nighttime?'
      type: 'string'
      default: 'one-dark-ui'
    when_does_it_get_dark:
      title: 'When does the sun set?'
      description: 'Use a 24hr format: 8:00PM equals 20:00, so type 2000'
      default: 1800
      minimum: 0
      maximum: 2400
      type: 'number'
    when_does_it_get_light:
      title: 'When does the sun rise?'
      description: 'Use a 24hr format: 8:00PM equals 20:00, so type 2000'
      default: 500
      minimum: 0
      maximum: 2400
      type: 'number'
    has_been_configured:
      title: 'This plugin has been configured?'
      description: 'Internal state tracking. Don\'t change this yourself unless you are ok with bugs.'
      default: false
      type: 'boolean'

  subscriptions: null

  activate: (state) ->
    @tock = setInterval () =>
      @tick()
    , 1 * 60 * 1000

    @setup()
    @bindEvents()
    @tick()

    atom.themes.getLoadedThemes().forEach (theme) ->
      cached_themes.ui.push(theme.name) if theme.metadata.theme is 'ui'
      cached_themes.syntax.push(theme.name) if theme.metadata.theme is 'syntax'

    @config.daytime_syntax_theme.description =
      @config.nighttime_syntax_theme.description =
        'Choose from: `' + cached_themes.syntax.join(', ') + '`'

    @config.daytime_ui_theme.description =
      @config.nighttime_ui_theme.description =
        'Choose from: `' + cached_themes.ui.join(', ') + '`'

    # Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
    @subscriptions = new CompositeDisposable

  bindEvents: ->
    atom.config.observe 'sunset.nighttime_ui_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)
      @setup()
      @tick()

    atom.config.observe 'sunset.nighttime_syntax_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)
      @setup()
      @tick()

    atom.config.observe 'sunset.daytime_ui_theme', (value) =>
      atom.config.set('sunset.has_been_configured', true)
{'fraction_non_alphanumeric': 0.11214451797531748, 'fraction_numerical': 0.013950992666785907, 'mean_word_length': 2.9519434628975265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2923931', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1711, 'n_words': 461}