<commit_before>path = require 'path'

_ = require 'underscore-plus'
ipc = require 'ipc'
CSON = require 'season'
fs = require 'fs-plus'

# Public: Provides a registry for menu items that you'd like to appear in the
# application menu.
#
# An instance of this class is always available as the `atom.menu` global.
module.exports =
class MenuManager
  pendingUpdateOperation: null

  constructor: ({@resourcePath}) ->
    @template = []
    atom.keymap.on 'bundled-keymaps-loaded', => @loadPlatformItems()

  # Public: Adds the given item definition to the existing template.
  #
  # * item:
  #   An object which describes a menu item as defined by
  #   https://github.com/atom/atom-shell/blob/master/docs/api/browser/menu.md
  #
  # Returns nothing.
  add: (items) ->
    @merge(@template, item) for item in items
    @update()

  # Should the binding for the given selector be included in the menu
  # commands.
  #
  # * selector: A String selector to check.
  #
  # Returns true to include the selector, false otherwise.
  includeSelector: (selector) ->
    return true if document.body.webkitMatchesSelector(selector)

    # Simulate an .editor element attached to a body element that has the same
    # classes as the current body element.
    unless @testEditor?
      @testEditor = document.createElement('div')<commit_msg>:memo: doc parameters in menu-manager.coffee<commit_after>path = require 'path'

_ = require 'underscore-plus'
ipc = require 'ipc'
CSON = require 'season'
fs = require 'fs-plus'

# Public: Provides a registry for menu items that you'd like to appear in the
# application menu.
#
# An instance of this class is always available as the `atom.menu` global.
module.exports =
class MenuManager
  pendingUpdateOperation: null

  constructor: ({@resourcePath}) ->
    @template = []
    atom.keymap.on 'bundled-keymaps-loaded', => @loadPlatformItems()

  # Public: Adds the given item definition to the existing template.
  #
  # ## Example
  # ```coffee
  #   atom.menu.add [
  #     {
  #       label: 'Hello'
  #       submenu : [{label: 'World!', command: 'hello:world'}]
  #     }
  #   ]
  # ```
  #
  # items - An {Array} of menu item {Object}s containing the keys:
  #   :label   - The {String} menu label.
  #   :submenu - An optional {Array} of sub menu items.
  #   :command - An option {String} command to trigger when the item is clicked.
  #
  # Returns nothing.
  add: (items) ->
    @merge(@template, item) for item in items
    @update()

  # Should the binding for the given selector be included in the menu
  # commands.
  #
  # selector - A {String} selector to check.
  #
  # Returns true to include the selector, false otherwise.
  includeSelector: (selector) ->
    return true if document.body.webkitMatchesSelector(selector)

    # Simulate an .editor element attached to a body element that has the same
    # classes as the current body element.
    unless @testEditor?
      @testEditor = document.createElement('div')
{'fraction_non_alphanumeric': 0.10579514824797843, 'fraction_numerical': 0.0, 'mean_word_length': 3.2658045977011496, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 1, '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': '2815038', 'n_tokens_mistral': 888, 'n_tokens_neox': 873, 'n_words': 320}