<commit_before>_ = require 'underscore-plus'

{SelectListView, View} = require 'atom'

module.exports =
class SnippetsAvailable extends SelectListView

  # Public: Retrieve the active Editor.
  #
  # Returns: The active Editor as {Object}.
  editor: -> atom.workspace.getActiveEditor()

  # Public: Retrieve the active EditorView as {Object}.
  #
  # Returns: The active EditorView as {Object}.
  editorView: -> atom.workspaceView.getActiveView()

  # Public: Filter the fuzzy-search for the prefix.
  #
  # Returns: {String}
  getFilterKey: -> 'prefix'

  # Public: Initialize object.
  #
  # Returns: `undefined`
  initialize: (@snippets) ->
    super
    @addClass('overlay from-top')
    items = ({prefix, snippet} for prefix, snippet of snippets.getSnippets(@editor()))

    @setItems(items)
    atom.workspaceView.append(this)
    @focusFilterEditor()

  # Public: Implement SelectListView method to generate the view for each item.
  #
  # item - The {Object} containing the snippet information.
  #
  # Returns: `undefined`
  viewForItem: (item) ->
    View.render ->
      @li class: 'two-lines', =>
        @div class: 'primary-line', "#{item.prefix}"
        @div class: 'secondary-line', "#{item.snippet.name}"

  # Public: Implement SelectListView method to process the user selection.
  #
  # item - The {Object} to insert the snippet.
  #
  # Returns: `undefined`
  confirmed: (item) ->
    @snippets.insert item.snippet.bodyText
    @detach()
<commit_msg>Remove unused helper method<commit_after>_ = require 'underscore-plus'

{SelectListView, View} = require 'atom'

module.exports =
class SnippetsAvailable extends SelectListView

  # Public: Retrieve the active Editor.
  #
  # Returns: The active Editor as {Object}.
  editor: -> atom.workspace.getActiveEditor()

  # Public: Filter the fuzzy-search for the prefix.
  #
  # Returns: {String}
  getFilterKey: -> 'prefix'

  # Public: Initialize object.
  #
  # Returns: `undefined`
  initialize: (@snippets) ->
    super
    @addClass('overlay from-top')
    items = ({prefix, snippet} for prefix, snippet of snippets.getSnippets(@editor()))

    @setItems(items)
    atom.workspaceView.append(this)
    @focusFilterEditor()

  # Public: Implement SelectListView method to generate the view for each item.
  #
  # item - The {Object} containing the snippet information.
  #
  # Returns: `undefined`
  viewForItem: (item) ->
    View.render ->
      @li class: 'two-lines', =>
        @div class: 'primary-line', "#{item.prefix}"
        @div class: 'secondary-line', "#{item.snippet.name}"

  # Public: Implement SelectListView method to process the user selection.
  #
  # item - The {Object} to insert the snippet.
  #
  # Returns: `undefined`
  confirmed: (item) ->
    @snippets.insert item.snippet.bodyText
    @detach()

{'fraction_non_alphanumeric': 0.12737030411449016, 'fraction_numerical': 0.0, 'mean_word_length': 3.45933014354067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '3601558', 'n_tokens_mistral': 880, 'n_tokens_neox': 838, 'n_words': 246}