Help diagnosing weird tab/pane attachment issue [solved]


I’m trying to get pane splitting to work in multi-wrap-guide. I modeled my package very closely on wrap-guide which does support pane splitting. Here’s what happens:

  1. Open a file in a tab.
  2. Split pane.
  3. New pane will have wrap guides, old pane will lose them.
  4. Close either pane, it doesn’t matter which, and the wrap guides are now totally gone.


I’ve instrumented my code with a bunch of diagnostic statements to try and figure out what’s going on but it just doesn’t make any sense.

When a new pane is created this is what happens:

  1. We get an onDidAttach for the editorElement of the old tab (what?) so we showGuides() again for the old tab (should be harmless).
  2. Then we observe the new text editor and go through the whole creation of MultiWrapGuide (which seems to work b/c the new pane gets the wrap guides just fine).
  3. Suddenly the wrap guides are gone from the old tab/pane and there’s no getting them back.

Creating and deleting of regular tabs works fine though. It’s just pane splitting and merging that is broken for no obvious reason. I suspect something is going wonky in attaching the the lines element maybe? I’m not sure though because it seems like I’m doing thing pretty much exactly the way that wrap-guide does things.


Another thing, if I log something like @linesView.find('div.multi-wrap-guide-view') to the console, I can hover over the context in the console after it gets logged there and it will highlight that element in the window. When I split panes however, the context element (div.lines) doesn’t get highlighted anymore for the old tab/pane. It does for the logs for the new pane. What the hell is going on here. :confounded:


That was it! Bah. I needed to re-capture the lines element in the attach callback. I guess it changes for all editors whenever a pane split event occurs.


Hey, you did great! Well done!