secondary-window: add support for additional views besides webviews
Feature Description:
The goal is to enhance https://github.com/eclipse-theia/theia/pull/11048 and add support for additional views besides webviews. The current implementation only supports webviews which are a minor feature in the framework, and we should enhance support to include:
- editors
- views (ex:
scm,debug)
I'm working on supporting the terminal in a scondary window. The first problem I ran into is not having the proper style information inside the secondary window.
My approach would be to have a webpack build that generates the "index.html" and associated *.css files using https://github.com/webpack-contrib/mini-css-extract-plugin. We probably don't want all the whole css to be loaded into the secondary window, so we probably need some way to mark up which CSS files need to be included: probably including all in a given package would be the way to go.
One more problem I've run into is that opening the "find" dialog does not work: keybindings only listen on events in the main window. Not sure yet what the right approach is here.
I'm also running into a single-window assumption in PhosphorJS when I attach/detach a widget: the widget search box is attached/detached from the terminal window in TerminalWidgetImpl.onBeforeAttach(). The code that borks is in PhosphorJS's `widget.js":
function detach(widget) {
if (widget.parent) {
throw new Error('Cannot detach a child widget.');
}
if (!widget.isAttached || !document.body.contains(widget.node)) {
throw new Error('Widget is not attached.');
}
Note that the document global in !document.body.contains(widget.node)) refers to the main window document. Since the main window never contains a node from a widget in the secondary window, this code always fails.