Can't split left with atom.workspace.open?


#1

Atom docs says [here][1] that is possible to use open to create a split panel by using split: 'right' or split: 'right'. That works as intended but only with right-spliting, using atom.workspace.open('', split:'left') opens a regular full-sized editor.
I tried this in both a test package and in init.config and none works.
Am I doing something wrong?

PD: I’m using atom v1.0.19
[1]: https://atom.io/docs/api/v1.0.19/Workspace#instance-open


#2

Actually, according to my interpretation of the documentation, it doesn’t do any “splitting” at all:

Either ‘left’ or ‘right’. If ‘left’, the item will be opened in leftmost pane of the current active pane’s row. If ‘right’, the item will be opened in the rightmost pane of the current active pane’s row.

It is just which pane do you want the item to be opened in, the leftmost or rightmost.

If you want to actually split left, you should probably use atom.workspace.getActivePane().splitLeft() and then open the item in the new pane.


#3

That makes sense, if the window is already divided, it puts the new editor in the corresponding pane (left or right). I just think that it’s weird that in the right-splitting, when it finds there is no right pane it creates a new one and puts the editor there. And in the left-splitting case if it doesn’t find another pane it just opens it. I guess atom sees the first editor as the leftmost, but for some reason not as the rightmost.

Anyway thanks, I’ll use your method


#4

It does seem a little weird. You might want to open a bug if it is behaving inconsistently.