<commit_before>import React, { PropTypes, Component } from 'react'
import loadThemes from 'lib/loadThemes'
import styles from './styles.css'
import hotkeyStyles from './Hotkey/styles.css'
import { Checkbox, Input, Select, Options } from './components'

export default class ExternalSettings extends Component {
  static propTypes = {
    settings: PropTypes.object.isRequired,
    onChange: PropTypes.func.isRequired,
  }

  changeSetting(plugin, label, value) {
    this.props.settings[plugin][label].value = value
    this.props.onChange(this.props.settings)
  }

  renderSetting(label, setting, plugin) {
    const { type, value, description } = setting

    if (type == 'bool') {
      return (
        <Checkbox
          key={label}
          value={value}
          onChange={({ target }) => this.changeSetting(plugin, label, target.checked)}
          description={description}
        />
      )
    }

    if (type == 'array') {
      return (<commit_msg>Show default value if value is not present<commit_after>import React, { PropTypes, Component } from 'react'
import loadThemes from 'lib/loadThemes'
import styles from './styles.css'
import hotkeyStyles from './Hotkey/styles.css'
import { Checkbox, Input, Select, Options } from './components'

export default class ExternalSettings extends Component {
  static propTypes = {
    settings: PropTypes.object.isRequired,
    onChange: PropTypes.func.isRequired,
  }

  changeSetting(plugin, label, value) {
    this.props.settings[plugin][label].value = value
    this.props.onChange(this.props.settings)
  }

  renderSetting(label, setting, plugin) {
    const { type, description } = setting
    const value = setting.value || setting.defaultValue

    if (type == 'bool') {
      return (
        <Checkbox
          key={label}
          value={value}
          onChange={({ target }) => this.changeSetting(plugin, label, target.checked)}
          description={description}
        />
      )
    }

    if (type == 'array') {
      return (
{'fraction_non_alphanumeric': 0.1205179282868526, 'fraction_numerical': 0.0, 'mean_word_length': 3.0585858585858587, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6440607', 'n_tokens_mistral': 557, 'n_tokens_neox': 557, 'n_words': 146}