<commit_before>{CompositeDisposable} = require 'atom'

alloyRegExp = ///
  \/(controllers|views|styles)\/ # type directory
  (.*)?\. # filename
  (.*)  # ext
///

alloyDirectoryMap =
  xml : "views"
  tss : "styles"
  js : "controllers"
  
module.exports =
  activate: ->
    atom.commands.add 'atom-workspace', 'titanium:openView': => @openFile('xml')
    atom.commands.add 'atom-workspace', 'titanium:openStyle': => @openFile('tss')
    atom.commands.add 'atom-workspace', 'titanium:openController': => @openFile('js')

  openFile: (type)->
    currentFilePath = atom.workspace.getActiveTextEditor().getPath()
    
    targetPath = currentFilePath.replace alloyRegExp, (match, p1, p2, p3, offset, string)->
      return "/#{alloyDirectoryMap[type]}/#{p2}.#{type}"
      
    atom.workspace.open targetPath<commit_msg>add option searchAllPanes (open exist editor)<commit_after>{CompositeDisposable} = require 'atom'

alloyRegExp = ///
  \/(controllers|views|styles)\/ # type directory
  (.*)?\. # filename
  (.*)  # ext
///

alloyDirectoryMap =
  xml : "views"
  tss : "styles"
  js : "controllers"
  
module.exports =
  activate: ->
    atom.commands.add 'atom-workspace', 'titanium:openView': => @openFile('xml')
    atom.commands.add 'atom-workspace', 'titanium:openStyle': => @openFile('tss')
    atom.commands.add 'atom-workspace', 'titanium:openController': => @openFile('js')


  openFile: (type)->
    currentFilePath = atom.workspace.getActiveTextEditor().getPath()

    targetPath = currentFilePath.replace alloyRegExp, (match, p1, p2, p3, offset, string)->
      return "/#{alloyDirectoryMap[type]}/#{p2}.#{type}"
    
    atom.workspace.open targetPath,
      searchAllPanes : true
{'fraction_non_alphanumeric': 0.17473435655253838, 'fraction_numerical': 0.004722550177095631, 'mean_word_length': 3.927325581395349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6156297', 'n_tokens_mistral': 580, 'n_tokens_neox': 570, 'n_words': 100}