Skip to content

Commit 6d791b4

Browse files
authored
Merge branch 'main' into tyriar/185393_2__ptyhost_marks
2 parents e7d952d + 8af267c commit 6d791b4

File tree

75 files changed

+1384
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1384
-501
lines changed

build/lib/i18n.resources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@
382382
"name": "vs/workbench/services/files",
383383
"project": "vscode-workbench"
384384
},
385+
{
386+
"name": "vs/workbench/services/filesConfiguration",
387+
"project": "vscode-workbench"
388+
},
385389
{
386390
"name": "vs/workbench/services/history",
387391
"project": "vscode-workbench"

extensions/ipynb/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"dropMetadata"
1515
],
1616
"activationEvents": [
17-
"onNotebook:jupyter-notebook"
17+
"onNotebook:jupyter-notebook",
18+
"onNotebookSerializer:interactive"
1819
],
1920
"extensionKind": [
2021
"workspace",

extensions/ipynb/src/ipynbMain.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ export function activate(context: vscode.ExtensionContext) {
4343
}
4444
} as vscode.NotebookDocumentContentOptions));
4545

46+
context.subscriptions.push(vscode.workspace.registerNotebookSerializer('interactive', serializer, {
47+
transientOutputs: false,
48+
transientCellMetadata: {
49+
breakpointMargin: true,
50+
custom: false,
51+
attachments: false
52+
},
53+
cellContentMetadata: {
54+
attachments: true
55+
}
56+
} as vscode.NotebookDocumentContentOptions));
57+
4658
vscode.languages.registerCodeLensProvider({ pattern: '**/*.ipynb' }, {
4759
provideCodeLenses: (document) => {
4860
if (

src/vs/base/common/network.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export namespace Schemas {
6262
export const vscodeNotebookCell = 'vscode-notebook-cell';
6363
export const vscodeNotebookCellMetadata = 'vscode-notebook-cell-metadata';
6464
export const vscodeNotebookCellOutput = 'vscode-notebook-cell-output';
65-
export const vscodeInteractive = 'vscode-interactive';
6665
export const vscodeInteractiveInput = 'vscode-interactive-input';
6766

6867
export const vscodeSettings = 'vscode-settings';

src/vs/editor/browser/editorBrowser.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,10 @@ export interface IDiffEditor extends editorCommon.IEditor {
12601260
* @internal
12611261
*/
12621262
revealFirstDiff(): unknown;
1263+
1264+
diffReviewNext(): void;
1265+
1266+
diffReviewPrev(): void;
12631267
}
12641268

12651269
/**

src/vs/editor/browser/widget/codeEditorContributions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1010
import { EditorContributionInstantiation, IEditorContributionDescription } from 'vs/editor/browser/editorExtensions';
1111
import { IEditorContribution } from 'vs/editor/common/editorCommon';
1212
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
13+
import './diffEditor.contribution';
1314

1415
export class CodeEditorContributions extends Disposable {
1516

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
7+
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
8+
import { EditorAction, ServicesAccessor, registerEditorAction } from 'vs/editor/browser/editorExtensions';
9+
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
10+
import { localize } from 'vs/nls';
11+
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
12+
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
13+
14+
class DiffReviewNext extends EditorAction {
15+
constructor() {
16+
super({
17+
id: 'editor.action.diffReview.next',
18+
label: localize('editor.action.diffReview.next', "Go to Next Difference"),
19+
alias: 'Go to Next Difference',
20+
precondition: ContextKeyExpr.has('isInDiffEditor'),
21+
kbOpts: {
22+
kbExpr: null,
23+
primary: KeyCode.F7,
24+
weight: KeybindingWeight.EditorContrib
25+
}
26+
});
27+
}
28+
29+
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
30+
const diffEditor = findFocusedDiffEditor(accessor);
31+
diffEditor?.diffReviewNext();
32+
}
33+
}
34+
35+
class DiffReviewPrev extends EditorAction {
36+
constructor() {
37+
super({
38+
id: 'editor.action.diffReview.prev',
39+
label: localize('editor.action.diffReview.prev', "Go to Previous Difference"),
40+
alias: 'Go to Previous Difference',
41+
precondition: ContextKeyExpr.has('isInDiffEditor'),
42+
kbOpts: {
43+
kbExpr: null,
44+
primary: KeyMod.Shift | KeyCode.F7,
45+
weight: KeybindingWeight.EditorContrib
46+
}
47+
});
48+
}
49+
50+
public run(accessor: ServicesAccessor, editor: ICodeEditor): void {
51+
const diffEditor = findFocusedDiffEditor(accessor);
52+
diffEditor?.diffReviewPrev();
53+
}
54+
}
55+
56+
function findFocusedDiffEditor(accessor: ServicesAccessor): IDiffEditor | null {
57+
const codeEditorService = accessor.get(ICodeEditorService);
58+
const diffEditors = codeEditorService.listDiffEditors();
59+
const activeCodeEditor = codeEditorService.getFocusedCodeEditor() ?? codeEditorService.getActiveCodeEditor();
60+
if (!activeCodeEditor) {
61+
return null;
62+
}
63+
64+
for (let i = 0, len = diffEditors.length; i < len; i++) {
65+
const diffEditor = <IDiffEditor>diffEditors[i];
66+
if (diffEditor.getModifiedEditor().getId() === activeCodeEditor.getId() || diffEditor.getOriginalEditor().getId() === activeCodeEditor.getId()) {
67+
return diffEditor;
68+
}
69+
}
70+
return null;
71+
}
72+
73+
registerEditorAction(DiffReviewNext);
74+
registerEditorAction(DiffReviewPrev);

src/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { Range } from 'vs/editor/common/core/range';
4444
import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer';
4545
import { deepClone } from 'vs/base/common/objects';
4646
import { autorunWithStore2 } from 'vs/base/common/observableImpl/autorun';
47+
import { DiffReview2 } from 'vs/editor/browser/widget/diffEditorWidget2/diffReview';
4748

4849
const diffEditorDefaultOptions: ValidDiffEditorBaseOptions = {
4950
enableSplitViewResizing: true,
@@ -93,6 +94,8 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
9394

9495
private unchangedRangesFeature!: UnchangedRangesFeature;
9596

97+
private readonly _reviewPane: DiffReview2;
98+
9699
constructor(
97100
private readonly _domElement: HTMLElement,
98101
options: Readonly<IDiffEditorConstructionOptions>,
@@ -177,6 +180,11 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
177180
this._renderOverviewRuler,
178181
));
179182

183+
this._reviewPane = this._register(this._instantiationService.createInstance(DiffReview2, this));
184+
this.elements.root.appendChild(this._reviewPane.domNode.domNode);
185+
this.elements.root.appendChild(this._reviewPane.shadow.domNode);
186+
this.elements.root.appendChild(this._reviewPane.actionBarContainer.domNode);
187+
180188
this._createDiffEditorContributions();
181189

182190
codeEditorService.addDiffEditor(this);
@@ -217,6 +225,7 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
217225
(this._renderOverviewRuler.read(reader) ? OverviewRulerPart.ENTIRE_DIFF_OVERVIEW_WIDTH : 0),
218226
height
219227
});
228+
this._reviewPane.layout(0, width, height);
220229

221230
return {
222231
modifiedEditor: this._modifiedEditor.getLayoutInfo(),
@@ -676,6 +685,13 @@ export class DiffEditorWidget2 extends DelegatingEditor implements IDiffEditor {
676685
});
677686
}
678687

688+
public diffReviewNext(): void {
689+
this._reviewPane.next();
690+
}
691+
692+
public diffReviewPrev(): void {
693+
this._reviewPane.prev();
694+
}
679695

680696
public async waitForDiff(): Promise<void> {
681697
const diffModel = this._diffModel.get();

0 commit comments

Comments
 (0)