-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ability to set showBase from CLI option * Use DiffPanel for diff widgets * Support merge view with 3 panels (theirs | final | ours) in addition to the current 4 panels views Fixes #682 * Add integration tests * Fix diff views * Lint the code * Fix final padding for merged editor in 3-panels view * Fix scroll synchronization for 3-panels view * Update Playwright Snapshots * Update Playwright Snapshots * Add delay to improve test robustness on Windows * Change expectation --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
40e692a
commit 228b6b0
Showing
21 changed files
with
408 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { Panel } from '@lumino/widgets'; | ||
import type { IDiffWidgetOptions, IMergeWidgetOptions } from './interfaces'; | ||
import type { CodeEditor } from '@jupyterlab/codeeditor'; | ||
|
||
/** | ||
* Common panel for diff views | ||
*/ | ||
export class DiffPanel<T> extends Panel { | ||
constructor({ model, editorFactory }: IDiffWidgetOptions<T>) { | ||
super(); | ||
this._editorFactory = editorFactory; | ||
this._model = model; | ||
} | ||
|
||
protected _editorFactory: CodeEditor.Factory | undefined; | ||
protected _model: T; | ||
} | ||
|
||
/** | ||
* Common panel for merge views | ||
*/ | ||
export class MergePanel<T> extends DiffPanel<T> { | ||
constructor({ | ||
model, | ||
editorFactory, | ||
...viewOptions | ||
}: IDiffWidgetOptions<T> & IMergeWidgetOptions) { | ||
super({ model, editorFactory }); | ||
this._viewOptions = viewOptions; | ||
} | ||
|
||
protected _viewOptions: IMergeWidgetOptions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import type { CodeEditor } from '@jupyterlab/codeeditor'; | ||
import type { IRenderMimeRegistry } from '@jupyterlab/rendermime'; | ||
|
||
/** | ||
* Common merge view options | ||
*/ | ||
export interface IMergeWidgetOptions { | ||
/** | ||
* Whether to show the base version (4-panels) or not (3-panels). | ||
*/ | ||
showBase?: boolean; | ||
} | ||
|
||
/** | ||
* Main widget constructor options | ||
*/ | ||
// TODO `T` should be scoped down but more API rework will be needed on the model to achieve that | ||
// there is definitely room to rationalize the code with more abstract or mixin classes. | ||
export interface IDiffWidgetOptions<T> { | ||
model: T; | ||
editorFactory?: CodeEditor.Factory; | ||
} | ||
|
||
export interface IMimeDiffWidgetOptions<T> { | ||
model: T; | ||
rendermime: IRenderMimeRegistry; | ||
editorFactory?: CodeEditor.Factory; | ||
} | ||
|
||
export interface ICellDiffWidgetOptions<T> extends IDiffWidgetOptions<T> { | ||
export interface ICellDiffWidgetOptions<T> extends IMimeDiffWidgetOptions<T> { | ||
// TODO this seems redundant as mimetype is part of the model | ||
mimetype: string; | ||
} |
Oops, something went wrong.