Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split view? #3

Closed
m1ga opened this issue Oct 27, 2014 · 1 comment
Closed

Split view? #3

m1ga opened this issue Oct 27, 2014 · 1 comment

Comments

@m1ga
Copy link
Contributor

m1ga commented Oct 27, 2014

not sure if this would be an option or not:

  • create a splitview (right with top+bottom)
  • will work no matter which file you select (js, tss, xml)

splitview

if that's fine, here is the code:

module.exports =
  activate: ->
    atom.workspaceView.command "ti-alloy-related:openRelated", => @openRelated()

  openRelated: ->
    editor = atom.workspace.getActiveEditor()
    return unless editor?

    previousActivePane = atom.workspace.getActivePane()
    uri = "#{editor.getPath()}"

    if uri.indexOf('.js') > 0
      view = uri.replace('/controllers/', '/views/')
      view = view.replace('.js', '.xml')
      style = uri.replace('/controllers/', '/styles/')
      style = style.replace('.js', '.tss')
    else if uri.indexOf('.xml') > 0
      view = uri.replace('/views/', '/controllers/')
      view = view.replace('.xml', '.js')
      style = uri.replace('/views/', '/styles/')
      style = style.replace('.xml', '.tss')
    else if uri.indexOf('.tss') > 0
      view = uri.replace('/styles/', '/views/')
      view = view.replace('.tss', '.xml')
      style = uri.replace('/styles/', '/controllers/')
      style = style.replace('.tss', '.js')

    atom.workspaceView.getActivePane().splitRight()
    atom.workspace.open(view)
    atom.workspaceView.getActivePane().splitDown()
    atom.workspace.open(style)

@davrosull
Copy link
Owner

I like it! I've committed the change now...Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants