<commit_before>{View, $$} = require 'space-pen'
SelectList = require 'select-list'
_ = require 'underscore'
$ = require 'jquery'
fs = require 'fs'
LoadPathsTask = require './load-paths-task'

module.exports =
class FuzzyFinderView extends SelectList
  filenameRegex: /[\w\.\-\/\\]+/

  @viewClass: ->
    [super, 'fuzzy-finder', 'overlay', 'from-top'].join(' ')

  allowActiveEditorChange: null
  maxItems: 10
  projectPaths: null
  reloadProjectPaths: true

  initialize: ->
    super

    @subscribe $(window), 'focus', => @reloadProjectPaths = true
    @observeConfig 'fuzzy-finder.ignoredNames', => @reloadProjectPaths = true

    @miniEditor.command 'editor:split-left', =>
      @splitOpenPath (editor, session) -> editor.splitLeft(session)
    @miniEditor.command 'editor:split-right', =>
      @splitOpenPath (editor, session) -> editor.splitRight(session)
    @miniEditor.command 'editor:split-down', =>
      @splitOpenPath (editor, session) -> editor.splitDown(session)
    @miniEditor.command 'editor:split-up', =>
      @splitOpenPath (editor, session) -> editor.splitUp(session)

  itemForElement: (path) ->
    $$ ->
      @li =>
        ext = fs.extension(path)
        if fs.isReadme(path)
          typeClass = 'readme-name'
        else if fs.isCompressedExtension(ext)
          typeClass = 'compressed-name'
        else if fs.isImageExtension(ext)
          typeClass = 'image-name'
        else if fs.isPdfExtension(ext)
          typeClass = 'pdf-name'
        else
          typeClass = 'text-name'
        @span fs.base(path), class: "file label #{typeClass}"
        if folder = fs.directory(path)<commit_msg>Rename isReadme to isReadmePath<commit_after>{View, $$} = require 'space-pen'
SelectList = require 'select-list'
_ = require 'underscore'
$ = require 'jquery'
fs = require 'fs'
LoadPathsTask = require './load-paths-task'

module.exports =
class FuzzyFinderView extends SelectList
  filenameRegex: /[\w\.\-\/\\]+/

  @viewClass: ->
    [super, 'fuzzy-finder', 'overlay', 'from-top'].join(' ')

  allowActiveEditorChange: null
  maxItems: 10
  projectPaths: null
  reloadProjectPaths: true

  initialize: ->
    super

    @subscribe $(window), 'focus', => @reloadProjectPaths = true
    @observeConfig 'fuzzy-finder.ignoredNames', => @reloadProjectPaths = true

    @miniEditor.command 'editor:split-left', =>
      @splitOpenPath (editor, session) -> editor.splitLeft(session)
    @miniEditor.command 'editor:split-right', =>
      @splitOpenPath (editor, session) -> editor.splitRight(session)
    @miniEditor.command 'editor:split-down', =>
      @splitOpenPath (editor, session) -> editor.splitDown(session)
    @miniEditor.command 'editor:split-up', =>
      @splitOpenPath (editor, session) -> editor.splitUp(session)

  itemForElement: (path) ->
    $$ ->
      @li =>
        ext = fs.extension(path)
        if fs.isReadmePath(path)
          typeClass = 'readme-name'
        else if fs.isCompressedExtension(ext)
          typeClass = 'compressed-name'
        else if fs.isImageExtension(ext)
          typeClass = 'image-name'
        else if fs.isPdfExtension(ext)
          typeClass = 'pdf-name'
        else
          typeClass = 'text-name'
        @span fs.base(path), class: "file label #{typeClass}"
        if folder = fs.directory(path)
{'fraction_non_alphanumeric': 0.143290831815422, 'fraction_numerical': 0.0012143290831815423, 'mean_word_length': 3.0982587064676617, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '7433195', 'n_tokens_mistral': 1039, 'n_tokens_neox': 1003, 'n_words': 216}