vizhub-core / vzcode

Mob Programming Code Editor
MIT License
71 stars 14 forks source link

Split Pane View #705

Open curran opened 5 months ago

curran commented 5 months ago

As a VZCode user editing two files at once, I want to be able to see them side by side, so that I can easily switch, or copy-paste between them.

curran commented 5 months ago

In VSCode you can drag and drop and it looks like this:

image

image

Then you get a resizer

image

The same would be amazing in VZCode.

michaelhelper commented 4 months ago

https://codemirror.net/examples/split/

curran commented 4 months ago

image

state.pane = {
  type: 'splitPane',
  children: [
    {
      type: 'leafPane',
      tabList: [...]
    },
    {
      type: 'leafPane',
      tabList: [...]
    }
  ]
}
curran commented 4 months ago

image

curran commented 4 months ago

image

curran commented 4 months ago

Data structure ideas for changes to VZState

// The leaf node of the tree data structure
type LeafPane = {
  type: 'leafPane';
  // The list of tabs
  // Mutually exclusive with `children`.
  tabList: Array<TabState>;
};

// Internal node of the tree data structure
type SplitPane = {
  type: 'splitPane';
  // Which orientation is it? Vertical split or horizontal split?
  // Applies only to `children`
  orientation: 'vertical' | 'horizontal';

  // The children panels
  // Mutually exclusive with `tabList`.
  children: Array<Pane>;
};

// The node data structure of the split pane tree
type Pane = LeafPane | SplitPane;

// The shape of the state managed by the reducer.
export type VZState = {
  // The state of the split pane (tree data structure).
  pane: Pane;
curran commented 4 months ago

Path forward:

See https://github.com/vizhub-core/vzcode/pull/802/files#diff-7b0b8b4acf26941c196d943f9cb0288d362d834d3f643c62c25f2c71b4803bed - similar to this function

curran commented 3 months ago

From here on out:

Replace this stuff with a recursive component:

      <TabList />
      {isClient && content && activeFileId && (
        <CodeEditor
          customInteractRules={customInteractRules}
          allowGlobals={allowGlobals}
        />
      )}