Skip to content

Commit 4c17606

Browse files
committed
making inlineDiffs working with unified-file-diff and updating documentation.
1 parent 4a8738f commit 4c17606

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ app.commands.execute('jupyterlab-diff:unified-cell-diff', {
6161
cellId: 'cell-id',
6262
originalSource: 'print("Hello")',
6363
newSource: 'print("Hello, World!")',
64-
showActionButtons: true
64+
showActionButtons: true,
65+
allowInlineDiffs: false
6566
});
6667
```
6768

@@ -72,7 +73,8 @@ app.commands.execute('jupyterlab-diff:unified-file-diff', {
7273
filePath: '/path/to/file.py',
7374
originalSource: 'print("Hello")',
7475
newSource: 'print("Hello, World!")',
75-
showActionButtons: true
76+
showActionButtons: true,
77+
allowInlineDiffs: false
7678
});
7779
```
7880

@@ -117,6 +119,7 @@ window.jupyterapp.commands.execute('jupyterlab-diff:split-cell-diff', {
117119
| `originalSource` | `string` | Yes | Original source code to compare against |
118120
| `newSource` | `string` | Yes | New source code to compare with |
119121
| `showActionButtons` | `boolean` | No | Whether to show action buttons for chunk acceptance (default: `true`) |
122+
| `allowInlineDiffs` | `boolean` | No | Whether to show inline diffs in the diff widget (default: `false`) |
120123
| `notebookPath` | `string` | No | Path to the notebook containing the cell. If not provided, uses the current notebook |
121124

122125
#### `jupyterlab-diff:unified-file-diff` (File Diff)
@@ -127,6 +130,7 @@ window.jupyterapp.commands.execute('jupyterlab-diff:split-cell-diff', {
127130
| `originalSource` | `string` | Yes | Original source code to compare against |
128131
| `newSource` | `string` | Yes | New source code to compare with |
129132
| `showActionButtons` | `boolean` | No | Whether to show action buttons for chunk acceptance (default: `true`) |
133+
| `allowInlineDiffs` | `boolean` | No | Whether to show inline diffs in the diff widget (default: `false`) |
130134

131135
## Architecture
132136

src/plugin.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ const unifiedFileDiffPlugin: JupyterFrontEndPlugin<void> = {
341341
description: trans.__(
342342
'Whether to show action buttons for chunk acceptance. Defaults to true.'
343343
)
344+
},
345+
allowInlineDiffs: {
346+
type: 'boolean',
347+
description: trans.__(
348+
'Enable inline diffs (true) or disable (false)'
349+
)
344350
}
345351
},
346352
required: ['originalSource', 'newSource']
@@ -351,7 +357,8 @@ const unifiedFileDiffPlugin: JupyterFrontEndPlugin<void> = {
351357
filePath,
352358
originalSource,
353359
newSource,
354-
showActionButtons = true
360+
showActionButtons = true,
361+
allowInlineDiffs = false
355362
} = args;
356363

357364
if (!originalSource || !newSource) {
@@ -407,6 +414,7 @@ const unifiedFileDiffPlugin: JupyterFrontEndPlugin<void> = {
407414
originalSource,
408415
newSource,
409416
showActionButtons,
417+
allowInlineDiffs,
410418
trans
411419
});
412420
fileDiffManagers.set(managerKey, manager);

0 commit comments

Comments
 (0)