<commit_before>FindModel = require './find-model'
FindView = require './find-view'
ProjectFindView = require './project-find-view'
ResultsModel = require './project/results-model'
ResultsPaneView = require './project/results-pane'
{_, $, $$} = require 'atom'

module.exports =
  configDefaults:
    openProjectFindResultsInRightPane: false

  activate: ({viewState, projectViewState, resultsModelState, paneViewState}={}) ->
    @resultsModel = new ResultsModel(resultsModelState)
    @projectFindView = new ProjectFindView(@resultsModel, projectViewState)
    @findView = new FindView(viewState)

    # HACK: Soooo, we need to get the model to the pane view whenever it is
    # created. Creation could come from the opener below, or, more problematic,
    # from a deserialize call when splitting panes. For now, all pane views will
    # use this same model. This needs to be improved! I dont know the best way
    # to deal with this:
    # 1. How should serialization work in the case of a shared model.
    # 2. Or maybe we create the model each time a new pane is created? Then
    #    ProjectFindView needs to know about each model so it can invoke a search.
    #    And on each new model, it will run the search again.
    #
    # See https://github.com/atom/find-and-replace/issues/63
    ResultsPaneView.model = @resultsModel

    @paneView = null
    atom.project.registerOpener (filePath) =>
      if filePath is ResultsPaneView.URI
        @paneView = new ResultsPaneView() unless @paneView
        @paneView

    atom.workspaceView.command 'project-find:show', =>
      @findView.detach()
      @projectFindView.attach()

    atom.workspaceView.command 'project-find:show-in-current-directory', (e) =>
      @findView.detach()
      @projectFindView.attach()
      @projectFindView.findInCurrentlySelectedDirectory($(e.target))

    atom.workspaceView.command 'find-and-replace:use-selection-as-find-pattern', =>
      return if @projectFindView.isOnDom() or @findView.isOnDom()
      @projectFindView.detach()
      @findView.showFind()

    atom.workspaceView.command 'find-and-replace:show', =>
      @projectFindView.detach()
      @findView.showFind()

    atom.workspaceView.command 'find-and-replace:show-replace', =>
      @projectFindView.detach()
      @findView.showReplace()
<commit_msg>:lipstick:<commit_after>FindModel = require './find-model'
FindView = require './find-view'
ProjectFindView = require './project-find-view'
ResultsModel = require './project/results-model'
ResultsPaneView = require './project/results-pane'
{_, $, $$} = require 'atom'

module.exports =
  configDefaults:
    openProjectFindResultsInRightPane: false

  activate: ({viewState, projectViewState, resultsModelState, paneViewState}={}) ->
    @resultsModel = new ResultsModel(resultsModelState)
    @projectFindView = new ProjectFindView(@resultsModel, projectViewState)
    @findView = new FindView(viewState)

    # HACK: Soooo, we need to get the model to the pane view whenever it is
    # created. Creation could come from the opener below, or, more problematic,
    # from a deserialize call when splitting panes. For now, all pane views will
    # use this same model. This needs to be improved! I dont know the best way
    # to deal with this:
    # 1. How should serialization work in the case of a shared model.
    # 2. Or maybe we create the model each time a new pane is created? Then
    #    ProjectFindView needs to know about each model so it can invoke a search.
    #    And on each new model, it will run the search again.
    #
    # See https://github.com/atom/find-and-replace/issues/63
    ResultsPaneView.model = @resultsModel

    @paneView = null
    atom.project.registerOpener (filePath) =>
      @paneView ?= new ResultsPaneView() if filePath is ResultsPaneView.URI

    atom.workspaceView.command 'project-find:show', =>
      @findView.detach()
      @projectFindView.attach()

    atom.workspaceView.command 'project-find:show-in-current-directory', (e) =>
      @findView.detach()
      @projectFindView.attach()
      @projectFindView.findInCurrentlySelectedDirectory($(e.target))

    atom.workspaceView.command 'find-and-replace:use-selection-as-find-pattern', =>
      return if @projectFindView.isOnDom() or @findView.isOnDom()
      @projectFindView.detach()
      @findView.showFind()

    atom.workspaceView.command 'find-and-replace:show', =>
      @projectFindView.detach()
      @findView.showFind()

    atom.workspaceView.command 'find-and-replace:show-replace', =>
      @projectFindView.detach()
      @findView.showReplace()

{'fraction_non_alphanumeric': 0.10834968388925223, 'fraction_numerical': 0.0017440592980161324, 'mean_word_length': 3.5788423153692617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '5474300', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1320, 'n_words': 377}