Workspace::open


#1

Is there a way to call workspace::open in a synchronous way, or, is there a way to put a callback on the open method?

Thanks.!


#2

As stated in the docs:

Returns: 
    (Editor) — Returns a promise that resolves to the Editor for the file URI.

Which mean you can hook onto the resulting promise like this:

promise = atom.workspace.open 'sample.js'
promise.then (editor) ->
  # do something with the new editor

Hope it helps


#3

@abe this is exactly what I was looking for, I didn’t understood what was a promise. Thanks for your help :smile: