@codingame/monaco-vscode-katex-common 29.1.1 → 30.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +14 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityProvider.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatElicitationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +12 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +208 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +637 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.js +202 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter.js +17 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsOpener.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.d.ts +53 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.js +296 -63
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/agentsessionsviewer.css +59 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.js +55 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/implicitContextAttachment.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.js +110 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionPickerActionItem.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/searchableOptionPickerActionItem.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +384 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatAgentHover.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatArtifactsWidget.js +220 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentMarkdownRenderer.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAgentCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAnonymousRateLimitedPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatAttachmentsContentPart.js +14 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatChangesSummaryPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCodeCitationContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatCommandContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentCodePools.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatExtensionsContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatHookContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatInlineAnchorWidget.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownContentPart.js +40 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMcpServersInteractionContentPart.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMultiDiffContentPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatProgressContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuestionCarouselPart.js +97 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatQuotaExceededPart.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatReferencesContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatResourceGroupWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSuggestNextWidget.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.d.ts +15 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.js +155 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTipContentPart.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTodoListWidget.js +36 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatToolInputOutputContentPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTreeContentPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatWorkspaceEditContentPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/codeBlockPart.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatThinkingContent.css +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/abstractToolConfirmationSubPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatExtensionsInstallToolSubPart.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMcpAppSubPart.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatMissingSandboxDepsConfirmationSubPart.js +68 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatModifiedFilesConfirmationSubPart.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolConfirmationSubPart.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatTerminalToolProgressPart.js +33 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolConfirmationSubPart.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolInvocationPart.js +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolOutputPart.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPartUtilities.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/toolInvocationParts/chatToolPostExecuteConfirmationPart.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatDragAndDrop.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.d.ts +4 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.js +37 -113
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatListWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidget.js +66 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatFollowups.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.d.ts +13 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.js +103 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatModelPicker.js +35 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/modelPickerActionItem2.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/permissionPickerActionItem.js +39 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.d.ts +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.js +44 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/workspacePickerActionItem.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/media/chat.css +60 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageDetails.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatImageExtraction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatColors.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/common/widget/codeBlockModelCollection.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatOverlayWidget.js +5 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +5 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +6 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +39 -39
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +746 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +300 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +55 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +273 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1963 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +314 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +258 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +886 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +118 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +185 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +104 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +43 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +69 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +469 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +149 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +933 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +180 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +32 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +102 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +643 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +197 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +90 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +92 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.d.ts +0 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.js +0 -1317
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.d.ts +0 -47
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/internalCustomizations/internalPromptFileSystem.js +0 -95
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
|
|
2
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable, DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
5
|
+
import { MultiDiffEditorItem } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService';
|
|
6
|
+
import { DiffElementPlaceholderViewModel, NotebookDocumentMetadataViewModel, SideBySideDiffElementViewModel, SingleSideDiffElementViewModel } from './diffElementViewModel.js';
|
|
7
|
+
import { NOTEBOOK_DIFF_ITEM_DIFF_STATE, NOTEBOOK_DIFF_ITEM_KIND } from './notebookDiffEditorBrowser.js';
|
|
8
|
+
import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
|
+
import { raceCancellation } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
10
|
+
import { computeDiff } from '../../common/notebookDiff.js';
|
|
11
|
+
|
|
12
|
+
class NotebookDiffViewModel extends Disposable {
|
|
13
|
+
get items() {
|
|
14
|
+
return this._items;
|
|
15
|
+
}
|
|
16
|
+
get value() {
|
|
17
|
+
return this.diffEditorItems.filter(item => item.type !== "placeholder").filter(item => {
|
|
18
|
+
if (this._includeUnchanged) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (item instanceof NotebookMultiDiffEditorCellItem) {
|
|
22
|
+
return item.type === "unchanged" && item.containerType === "unchanged" ? false : true;
|
|
23
|
+
}
|
|
24
|
+
if (item instanceof NotebookMultiDiffEditorMetadataItem) {
|
|
25
|
+
return item.type === "unchanged" && item.containerType === "unchanged" ? false : true;
|
|
26
|
+
}
|
|
27
|
+
if (item instanceof NotebookMultiDiffEditorOutputItem) {
|
|
28
|
+
return item.type === "unchanged" && item.containerType === "unchanged" ? false : true;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}).filter(
|
|
32
|
+
item => item instanceof NotebookMultiDiffEditorOutputItem ? !this.hideOutput : true
|
|
33
|
+
).filter(
|
|
34
|
+
item => item instanceof NotebookMultiDiffEditorMetadataItem ? !this.ignoreMetadata : true
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
get hasUnchangedCells() {
|
|
38
|
+
return this._hasUnchangedCells === true;
|
|
39
|
+
}
|
|
40
|
+
get includeUnchanged() {
|
|
41
|
+
return this._includeUnchanged === true;
|
|
42
|
+
}
|
|
43
|
+
set includeUnchanged(value) {
|
|
44
|
+
this._includeUnchanged = value;
|
|
45
|
+
this._onDidChange.fire();
|
|
46
|
+
}
|
|
47
|
+
constructor(
|
|
48
|
+
model,
|
|
49
|
+
notebookEditorWorkerService,
|
|
50
|
+
configurationService,
|
|
51
|
+
eventDispatcher,
|
|
52
|
+
notebookService,
|
|
53
|
+
diffEditorHeightCalculator,
|
|
54
|
+
fontInfo,
|
|
55
|
+
excludeUnchangedPlaceholder
|
|
56
|
+
) {
|
|
57
|
+
super();
|
|
58
|
+
this.model = model;
|
|
59
|
+
this.notebookEditorWorkerService = notebookEditorWorkerService;
|
|
60
|
+
this.configurationService = configurationService;
|
|
61
|
+
this.eventDispatcher = eventDispatcher;
|
|
62
|
+
this.notebookService = notebookService;
|
|
63
|
+
this.diffEditorHeightCalculator = diffEditorHeightCalculator;
|
|
64
|
+
this.fontInfo = fontInfo;
|
|
65
|
+
this.excludeUnchangedPlaceholder = excludeUnchangedPlaceholder;
|
|
66
|
+
this.placeholderAndRelatedCells = ( new Map());
|
|
67
|
+
this._items = [];
|
|
68
|
+
this._onDidChangeItems = this._register(( new Emitter()));
|
|
69
|
+
this.onDidChangeItems = this._onDidChangeItems.event;
|
|
70
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
71
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
72
|
+
this.diffEditorItems = [];
|
|
73
|
+
this.onDidChange = this._onDidChange.event;
|
|
74
|
+
this.originalCellViewModels = [];
|
|
75
|
+
this.hideOutput = this.model.modified.notebook.transientOptions.transientOutputs || this.configurationService.getValue("notebook.diff.ignoreOutputs");
|
|
76
|
+
this.ignoreMetadata = this.configurationService.getValue("notebook.diff.ignoreMetadata");
|
|
77
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
78
|
+
let triggerChange = false;
|
|
79
|
+
let metadataChanged = false;
|
|
80
|
+
if (e.affectsConfiguration("notebook.diff.ignoreMetadata")) {
|
|
81
|
+
const newValue = this.configurationService.getValue("notebook.diff.ignoreMetadata");
|
|
82
|
+
if (newValue !== undefined && this.ignoreMetadata !== newValue) {
|
|
83
|
+
this.ignoreMetadata = newValue;
|
|
84
|
+
triggerChange = true;
|
|
85
|
+
metadataChanged = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (e.affectsConfiguration("notebook.diff.ignoreOutputs")) {
|
|
89
|
+
const newValue = this.configurationService.getValue("notebook.diff.ignoreOutputs");
|
|
90
|
+
if (newValue !== undefined && this.hideOutput !== (newValue || this.model.modified.notebook.transientOptions.transientOutputs)) {
|
|
91
|
+
this.hideOutput = newValue || !!(this.model.modified.notebook.transientOptions.transientOutputs);
|
|
92
|
+
triggerChange = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (metadataChanged) {
|
|
96
|
+
this.toggleNotebookMetadata();
|
|
97
|
+
}
|
|
98
|
+
if (triggerChange) {
|
|
99
|
+
this._onDidChange.fire();
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
dispose() {
|
|
104
|
+
this.clear();
|
|
105
|
+
super.dispose();
|
|
106
|
+
}
|
|
107
|
+
clear() {
|
|
108
|
+
this.disposables.clear();
|
|
109
|
+
dispose(Array.from(( this.placeholderAndRelatedCells.keys())));
|
|
110
|
+
this.placeholderAndRelatedCells.clear();
|
|
111
|
+
dispose(this.originalCellViewModels);
|
|
112
|
+
this.originalCellViewModels = [];
|
|
113
|
+
dispose(this._items);
|
|
114
|
+
this._items.splice(0, this._items.length);
|
|
115
|
+
}
|
|
116
|
+
async computeDiff(token) {
|
|
117
|
+
const diffResult = await raceCancellation(
|
|
118
|
+
this.notebookEditorWorkerService.computeDiff(this.model.original.resource, this.model.modified.resource),
|
|
119
|
+
token
|
|
120
|
+
);
|
|
121
|
+
if (!diffResult || token.isCancellationRequested) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
prettyChanges(
|
|
125
|
+
this.model.original.notebook,
|
|
126
|
+
this.model.modified.notebook,
|
|
127
|
+
diffResult.cellsDiff
|
|
128
|
+
);
|
|
129
|
+
const {
|
|
130
|
+
cellDiffInfo,
|
|
131
|
+
firstChangeIndex
|
|
132
|
+
} = computeDiff(this.model.original.notebook, this.model.modified.notebook, diffResult);
|
|
133
|
+
if (isEqual(cellDiffInfo, this.originalCellViewModels, this.model)) {
|
|
134
|
+
return;
|
|
135
|
+
} else {
|
|
136
|
+
await raceCancellation(
|
|
137
|
+
this.updateViewModels(cellDiffInfo, diffResult.metadataChanged, firstChangeIndex),
|
|
138
|
+
token
|
|
139
|
+
);
|
|
140
|
+
if (token.isCancellationRequested) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
this.updateDiffEditorItems();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
toggleNotebookMetadata() {
|
|
147
|
+
if (!this.notebookMetadataViewModel) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (this.ignoreMetadata) {
|
|
151
|
+
if (this._items.length && this._items[0] === this.notebookMetadataViewModel) {
|
|
152
|
+
this._items.splice(0, 1);
|
|
153
|
+
this._onDidChangeItems.fire({
|
|
154
|
+
start: 0,
|
|
155
|
+
deleteCount: 1,
|
|
156
|
+
elements: []
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
if (!this._items.length || this._items[0] !== this.notebookMetadataViewModel) {
|
|
161
|
+
this._items.splice(0, 0, this.notebookMetadataViewModel);
|
|
162
|
+
this._onDidChangeItems.fire({
|
|
163
|
+
start: 0,
|
|
164
|
+
deleteCount: 0,
|
|
165
|
+
elements: [this.notebookMetadataViewModel]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
updateDiffEditorItems() {
|
|
171
|
+
this.diffEditorItems = [];
|
|
172
|
+
const originalSourceUri = this.model.original.resource;
|
|
173
|
+
const modifiedSourceUri = this.model.modified.resource;
|
|
174
|
+
this._hasUnchangedCells = false;
|
|
175
|
+
this.items.forEach(item => {
|
|
176
|
+
switch (item.type) {
|
|
177
|
+
case "delete":
|
|
178
|
+
{
|
|
179
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorCellItem(item.original.uri, undefined, item.type, item.type)));
|
|
180
|
+
const originalMetadata = CellUri.generateCellPropertyUri(
|
|
181
|
+
originalSourceUri,
|
|
182
|
+
item.original.handle,
|
|
183
|
+
Schemas.vscodeNotebookCellMetadata
|
|
184
|
+
);
|
|
185
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorMetadataItem(originalMetadata, undefined, item.type, item.type)));
|
|
186
|
+
const originalOutput = CellUri.generateCellPropertyUri(originalSourceUri, item.original.handle, Schemas.vscodeNotebookCellOutput);
|
|
187
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorOutputItem(originalOutput, undefined, item.type, item.type)));
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case "insert":
|
|
191
|
+
{
|
|
192
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorCellItem(undefined, item.modified.uri, item.type, item.type)));
|
|
193
|
+
const modifiedMetadata = CellUri.generateCellPropertyUri(
|
|
194
|
+
modifiedSourceUri,
|
|
195
|
+
item.modified.handle,
|
|
196
|
+
Schemas.vscodeNotebookCellMetadata
|
|
197
|
+
);
|
|
198
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorMetadataItem(undefined, modifiedMetadata, item.type, item.type)));
|
|
199
|
+
const modifiedOutput = CellUri.generateCellPropertyUri(modifiedSourceUri, item.modified.handle, Schemas.vscodeNotebookCellOutput);
|
|
200
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorOutputItem(undefined, modifiedOutput, item.type, item.type)));
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case "modified":
|
|
204
|
+
{
|
|
205
|
+
const cellType = item.checkIfInputModified() ? item.type : "unchanged";
|
|
206
|
+
const containerChanged = (item.checkIfInputModified() || item.checkMetadataIfModified() || item.checkIfOutputsModified()) ? item.type : "unchanged";
|
|
207
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorCellItem(item.original.uri, item.modified.uri, cellType, containerChanged)));
|
|
208
|
+
const originalMetadata = CellUri.generateCellPropertyUri(
|
|
209
|
+
originalSourceUri,
|
|
210
|
+
item.original.handle,
|
|
211
|
+
Schemas.vscodeNotebookCellMetadata
|
|
212
|
+
);
|
|
213
|
+
const modifiedMetadata = CellUri.generateCellPropertyUri(
|
|
214
|
+
modifiedSourceUri,
|
|
215
|
+
item.modified.handle,
|
|
216
|
+
Schemas.vscodeNotebookCellMetadata
|
|
217
|
+
);
|
|
218
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorMetadataItem(
|
|
219
|
+
originalMetadata,
|
|
220
|
+
modifiedMetadata,
|
|
221
|
+
item.checkMetadataIfModified() ? item.type : "unchanged",
|
|
222
|
+
containerChanged
|
|
223
|
+
)));
|
|
224
|
+
const originalOutput = CellUri.generateCellPropertyUri(originalSourceUri, item.original.handle, Schemas.vscodeNotebookCellOutput);
|
|
225
|
+
const modifiedOutput = CellUri.generateCellPropertyUri(modifiedSourceUri, item.modified.handle, Schemas.vscodeNotebookCellOutput);
|
|
226
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorOutputItem(
|
|
227
|
+
originalOutput,
|
|
228
|
+
modifiedOutput,
|
|
229
|
+
item.checkIfOutputsModified() ? item.type : "unchanged",
|
|
230
|
+
containerChanged
|
|
231
|
+
)));
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case "unchanged":
|
|
235
|
+
{
|
|
236
|
+
this._hasUnchangedCells = true;
|
|
237
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorCellItem(item.original.uri, item.modified.uri, item.type, item.type)));
|
|
238
|
+
const originalMetadata = CellUri.generateCellPropertyUri(
|
|
239
|
+
originalSourceUri,
|
|
240
|
+
item.original.handle,
|
|
241
|
+
Schemas.vscodeNotebookCellMetadata
|
|
242
|
+
);
|
|
243
|
+
const modifiedMetadata = CellUri.generateCellPropertyUri(
|
|
244
|
+
modifiedSourceUri,
|
|
245
|
+
item.modified.handle,
|
|
246
|
+
Schemas.vscodeNotebookCellMetadata
|
|
247
|
+
);
|
|
248
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorMetadataItem(originalMetadata, modifiedMetadata, item.type, item.type)));
|
|
249
|
+
const originalOutput = CellUri.generateCellPropertyUri(originalSourceUri, item.original.handle, Schemas.vscodeNotebookCellOutput);
|
|
250
|
+
const modifiedOutput = CellUri.generateCellPropertyUri(modifiedSourceUri, item.modified.handle, Schemas.vscodeNotebookCellOutput);
|
|
251
|
+
this.diffEditorItems.push(( new NotebookMultiDiffEditorOutputItem(originalOutput, modifiedOutput, item.type, item.type)));
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
this._onDidChange.fire();
|
|
257
|
+
}
|
|
258
|
+
async updateViewModels(cellDiffInfo, metadataChanged, firstChangeIndex) {
|
|
259
|
+
const cellViewModels = await this.createDiffViewModels(cellDiffInfo, metadataChanged);
|
|
260
|
+
const oldLength = this._items.length;
|
|
261
|
+
this.clear();
|
|
262
|
+
this._items.splice(0, oldLength);
|
|
263
|
+
let placeholder = undefined;
|
|
264
|
+
this.originalCellViewModels = cellViewModels;
|
|
265
|
+
cellViewModels.forEach((vm, index) => {
|
|
266
|
+
if (vm.type === "unchanged" && !this.excludeUnchangedPlaceholder) {
|
|
267
|
+
if (!placeholder) {
|
|
268
|
+
vm.displayIconToHideUnmodifiedCells = true;
|
|
269
|
+
placeholder = ( new DiffElementPlaceholderViewModel(vm.mainDocumentTextModel, vm.editorEventDispatcher, vm.initData));
|
|
270
|
+
this._items.push(placeholder);
|
|
271
|
+
const placeholderItem = placeholder;
|
|
272
|
+
this.disposables.add(placeholderItem.onUnfoldHiddenCells(() => {
|
|
273
|
+
const hiddenCellViewModels = this.placeholderAndRelatedCells.get(placeholderItem);
|
|
274
|
+
if (!Array.isArray(hiddenCellViewModels)) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const start = this._items.indexOf(placeholderItem);
|
|
278
|
+
this._items.splice(start, 1, ...hiddenCellViewModels);
|
|
279
|
+
this._onDidChangeItems.fire({
|
|
280
|
+
start,
|
|
281
|
+
deleteCount: 1,
|
|
282
|
+
elements: hiddenCellViewModels
|
|
283
|
+
});
|
|
284
|
+
}));
|
|
285
|
+
this.disposables.add(vm.onHideUnchangedCells(() => {
|
|
286
|
+
const hiddenCellViewModels = this.placeholderAndRelatedCells.get(placeholderItem);
|
|
287
|
+
if (!Array.isArray(hiddenCellViewModels)) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const start = this._items.indexOf(vm);
|
|
291
|
+
this._items.splice(start, hiddenCellViewModels.length, placeholderItem);
|
|
292
|
+
this._onDidChangeItems.fire({
|
|
293
|
+
start,
|
|
294
|
+
deleteCount: hiddenCellViewModels.length,
|
|
295
|
+
elements: [placeholderItem]
|
|
296
|
+
});
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
const hiddenCellViewModels = this.placeholderAndRelatedCells.get(placeholder) || [];
|
|
300
|
+
hiddenCellViewModels.push(vm);
|
|
301
|
+
this.placeholderAndRelatedCells.set(placeholder, hiddenCellViewModels);
|
|
302
|
+
placeholder.hiddenCells.push(vm);
|
|
303
|
+
} else {
|
|
304
|
+
placeholder = undefined;
|
|
305
|
+
this._items.push(vm);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
this._onDidChangeItems.fire({
|
|
309
|
+
start: 0,
|
|
310
|
+
deleteCount: oldLength,
|
|
311
|
+
elements: this._items,
|
|
312
|
+
firstChangeIndex
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
async createDiffViewModels(computedCellDiffs, metadataChanged) {
|
|
316
|
+
const originalModel = this.model.original.notebook;
|
|
317
|
+
const modifiedModel = this.model.modified.notebook;
|
|
318
|
+
const initData = {
|
|
319
|
+
metadataStatusHeight: this.configurationService.getValue("notebook.diff.ignoreMetadata") ? 0 : 25,
|
|
320
|
+
outputStatusHeight: this.configurationService.getValue("notebook.diff.ignoreOutputs") || !!(modifiedModel.transientOptions.transientOutputs) ? 0 : 25,
|
|
321
|
+
fontInfo: this.fontInfo
|
|
322
|
+
};
|
|
323
|
+
const viewModels = [];
|
|
324
|
+
this.notebookMetadataViewModel = this._register(( new NotebookDocumentMetadataViewModel(
|
|
325
|
+
this.model.original.notebook,
|
|
326
|
+
this.model.modified.notebook,
|
|
327
|
+
metadataChanged ? "modifiedMetadata" : "unchangedMetadata",
|
|
328
|
+
this.eventDispatcher,
|
|
329
|
+
initData,
|
|
330
|
+
this.notebookService,
|
|
331
|
+
this.diffEditorHeightCalculator
|
|
332
|
+
)));
|
|
333
|
+
if (!this.ignoreMetadata) {
|
|
334
|
+
if (metadataChanged) {
|
|
335
|
+
await this.notebookMetadataViewModel.computeHeights();
|
|
336
|
+
}
|
|
337
|
+
viewModels.push(this.notebookMetadataViewModel);
|
|
338
|
+
}
|
|
339
|
+
const cellViewModels = await Promise.all(( computedCellDiffs.map(async diff => {
|
|
340
|
+
switch (diff.type) {
|
|
341
|
+
case "delete":
|
|
342
|
+
{
|
|
343
|
+
return ( new SingleSideDiffElementViewModel(
|
|
344
|
+
originalModel,
|
|
345
|
+
modifiedModel,
|
|
346
|
+
originalModel.cells[diff.originalCellIndex],
|
|
347
|
+
undefined,
|
|
348
|
+
"delete",
|
|
349
|
+
this.eventDispatcher,
|
|
350
|
+
initData,
|
|
351
|
+
this.notebookService,
|
|
352
|
+
this.configurationService,
|
|
353
|
+
this.diffEditorHeightCalculator,
|
|
354
|
+
diff.originalCellIndex
|
|
355
|
+
));
|
|
356
|
+
}
|
|
357
|
+
case "insert":
|
|
358
|
+
{
|
|
359
|
+
return ( new SingleSideDiffElementViewModel(
|
|
360
|
+
modifiedModel,
|
|
361
|
+
originalModel,
|
|
362
|
+
undefined,
|
|
363
|
+
modifiedModel.cells[diff.modifiedCellIndex],
|
|
364
|
+
"insert",
|
|
365
|
+
this.eventDispatcher,
|
|
366
|
+
initData,
|
|
367
|
+
this.notebookService,
|
|
368
|
+
this.configurationService,
|
|
369
|
+
this.diffEditorHeightCalculator,
|
|
370
|
+
diff.modifiedCellIndex
|
|
371
|
+
));
|
|
372
|
+
}
|
|
373
|
+
case "modified":
|
|
374
|
+
{
|
|
375
|
+
const viewModel = ( new SideBySideDiffElementViewModel(
|
|
376
|
+
this.model.modified.notebook,
|
|
377
|
+
this.model.original.notebook,
|
|
378
|
+
originalModel.cells[diff.originalCellIndex],
|
|
379
|
+
modifiedModel.cells[diff.modifiedCellIndex],
|
|
380
|
+
"modified",
|
|
381
|
+
this.eventDispatcher,
|
|
382
|
+
initData,
|
|
383
|
+
this.notebookService,
|
|
384
|
+
this.configurationService,
|
|
385
|
+
diff.originalCellIndex,
|
|
386
|
+
this.diffEditorHeightCalculator
|
|
387
|
+
));
|
|
388
|
+
await viewModel.computeEditorHeights();
|
|
389
|
+
return viewModel;
|
|
390
|
+
}
|
|
391
|
+
case "unchanged":
|
|
392
|
+
{
|
|
393
|
+
return ( new SideBySideDiffElementViewModel(
|
|
394
|
+
this.model.modified.notebook,
|
|
395
|
+
this.model.original.notebook,
|
|
396
|
+
originalModel.cells[diff.originalCellIndex],
|
|
397
|
+
modifiedModel.cells[diff.modifiedCellIndex],
|
|
398
|
+
"unchanged",
|
|
399
|
+
this.eventDispatcher,
|
|
400
|
+
initData,
|
|
401
|
+
this.notebookService,
|
|
402
|
+
this.configurationService,
|
|
403
|
+
diff.originalCellIndex,
|
|
404
|
+
this.diffEditorHeightCalculator
|
|
405
|
+
));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
})));
|
|
409
|
+
cellViewModels.forEach(vm => viewModels.push(vm));
|
|
410
|
+
return viewModels;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function prettyChanges(original, modified, diffResult) {
|
|
414
|
+
const changes = diffResult.changes;
|
|
415
|
+
for (let i = 0; i < diffResult.changes.length - 1; i++) {
|
|
416
|
+
const curr = changes[i];
|
|
417
|
+
const next = changes[i + 1];
|
|
418
|
+
const x = curr.originalStart;
|
|
419
|
+
const y = curr.modifiedStart;
|
|
420
|
+
if (curr.originalLength === 1 && curr.modifiedLength === 0 && next.originalStart === x + 2 && next.originalLength === 0 && next.modifiedStart === y + 1 && next.modifiedLength === 1 && original.cells[x].getHashValue() === modified.cells[y + 1].getHashValue() && original.cells[x + 1].getHashValue() === modified.cells[y].getHashValue()) {
|
|
421
|
+
curr.originalStart = x;
|
|
422
|
+
curr.originalLength = 0;
|
|
423
|
+
curr.modifiedStart = y;
|
|
424
|
+
curr.modifiedLength = 1;
|
|
425
|
+
next.originalStart = x + 1;
|
|
426
|
+
next.originalLength = 1;
|
|
427
|
+
next.modifiedStart = y + 2;
|
|
428
|
+
next.modifiedLength = 0;
|
|
429
|
+
i++;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function isEqual(cellDiffInfo, viewModels, model) {
|
|
434
|
+
if (cellDiffInfo.length !== viewModels.length) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
const originalModel = model.original.notebook;
|
|
438
|
+
const modifiedModel = model.modified.notebook;
|
|
439
|
+
for (let i = 0; i < viewModels.length; i++) {
|
|
440
|
+
const a = cellDiffInfo[i];
|
|
441
|
+
const b = viewModels[i];
|
|
442
|
+
if (a.type !== b.type) {
|
|
443
|
+
return false;
|
|
444
|
+
}
|
|
445
|
+
switch (a.type) {
|
|
446
|
+
case "delete":
|
|
447
|
+
{
|
|
448
|
+
if (originalModel.cells[a.originalCellIndex].handle !== b.original?.handle) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
case "insert":
|
|
454
|
+
{
|
|
455
|
+
if (modifiedModel.cells[a.modifiedCellIndex].handle !== b.modified?.handle) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
default:
|
|
461
|
+
{
|
|
462
|
+
if (originalModel.cells[a.originalCellIndex].handle !== b.original?.handle) {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
if (modifiedModel.cells[a.modifiedCellIndex].handle !== b.modified?.handle) {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
class NotebookMultiDiffEditorItem extends MultiDiffEditorItem {
|
|
475
|
+
constructor(
|
|
476
|
+
originalUri,
|
|
477
|
+
modifiedUri,
|
|
478
|
+
goToFileUri,
|
|
479
|
+
type,
|
|
480
|
+
containerType,
|
|
481
|
+
kind,
|
|
482
|
+
contextKeys
|
|
483
|
+
) {
|
|
484
|
+
super(originalUri, modifiedUri, goToFileUri, undefined, contextKeys);
|
|
485
|
+
this.type = type;
|
|
486
|
+
this.containerType = containerType;
|
|
487
|
+
this.kind = kind;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
class NotebookMultiDiffEditorCellItem extends NotebookMultiDiffEditorItem {
|
|
491
|
+
constructor(originalUri, modifiedUri, type, containerType) {
|
|
492
|
+
super(
|
|
493
|
+
originalUri,
|
|
494
|
+
modifiedUri,
|
|
495
|
+
modifiedUri || originalUri,
|
|
496
|
+
type,
|
|
497
|
+
containerType,
|
|
498
|
+
"Cell",
|
|
499
|
+
{
|
|
500
|
+
[NOTEBOOK_DIFF_ITEM_KIND.key]: "Cell",
|
|
501
|
+
[NOTEBOOK_DIFF_ITEM_DIFF_STATE.key]: type
|
|
502
|
+
}
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
class NotebookMultiDiffEditorMetadataItem extends NotebookMultiDiffEditorItem {
|
|
507
|
+
constructor(originalUri, modifiedUri, type, containerType) {
|
|
508
|
+
super(
|
|
509
|
+
originalUri,
|
|
510
|
+
modifiedUri,
|
|
511
|
+
modifiedUri || originalUri,
|
|
512
|
+
type,
|
|
513
|
+
containerType,
|
|
514
|
+
"Metadata",
|
|
515
|
+
{
|
|
516
|
+
[NOTEBOOK_DIFF_ITEM_KIND.key]: "Metadata",
|
|
517
|
+
[NOTEBOOK_DIFF_ITEM_DIFF_STATE.key]: type
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
class NotebookMultiDiffEditorOutputItem extends NotebookMultiDiffEditorItem {
|
|
523
|
+
constructor(originalUri, modifiedUri, type, containerType) {
|
|
524
|
+
super(
|
|
525
|
+
originalUri,
|
|
526
|
+
modifiedUri,
|
|
527
|
+
modifiedUri || originalUri,
|
|
528
|
+
type,
|
|
529
|
+
containerType,
|
|
530
|
+
"Output",
|
|
531
|
+
{
|
|
532
|
+
[NOTEBOOK_DIFF_ITEM_KIND.key]: "Output",
|
|
533
|
+
[NOTEBOOK_DIFF_ITEM_DIFF_STATE.key]: type
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
export { NotebookDiffViewModel, NotebookMultiDiffEditorItem, prettyChanges };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
+
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
4
|
+
export type UnchangedEditorRegionOptions = {
|
|
5
|
+
options: {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
contextLineCount: number;
|
|
8
|
+
minimumLineCount: number;
|
|
9
|
+
revealLineCount: number;
|
|
10
|
+
};
|
|
11
|
+
readonly onDidChangeEnablement: Event<boolean>;
|
|
12
|
+
};
|
|
13
|
+
export declare function getUnchangedRegionSettings(configurationService: IConfigurationService): (Readonly<UnchangedEditorRegionOptions> & IDisposable);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
3
|
+
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
|
|
5
|
+
function getUnchangedRegionSettings(configurationService) {
|
|
6
|
+
return createHideUnchangedRegionOptions(configurationService);
|
|
7
|
+
}
|
|
8
|
+
function createHideUnchangedRegionOptions(configurationService) {
|
|
9
|
+
const disposables = ( new DisposableStore());
|
|
10
|
+
const unchangedRegionsEnablementEmitter = disposables.add(( new Emitter()));
|
|
11
|
+
const result = {
|
|
12
|
+
options: {
|
|
13
|
+
enabled: configurationService.getValue("diffEditor.hideUnchangedRegions.enabled"),
|
|
14
|
+
minimumLineCount: configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),
|
|
15
|
+
contextLineCount: configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),
|
|
16
|
+
revealLineCount: configurationService.getValue("diffEditor.hideUnchangedRegions.revealLineCount")
|
|
17
|
+
},
|
|
18
|
+
onDidChangeEnablement: unchangedRegionsEnablementEmitter.event.bind(unchangedRegionsEnablementEmitter),
|
|
19
|
+
dispose: () => disposables.dispose()
|
|
20
|
+
};
|
|
21
|
+
disposables.add(configurationService.onDidChangeConfiguration(e => {
|
|
22
|
+
if (e.affectsConfiguration("diffEditor.hideUnchangedRegions.minimumLineCount")) {
|
|
23
|
+
result.options.minimumLineCount = configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount");
|
|
24
|
+
}
|
|
25
|
+
if (e.affectsConfiguration("diffEditor.hideUnchangedRegions.contextLineCount")) {
|
|
26
|
+
result.options.contextLineCount = configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount");
|
|
27
|
+
}
|
|
28
|
+
if (e.affectsConfiguration("diffEditor.hideUnchangedRegions.revealLineCount")) {
|
|
29
|
+
result.options.revealLineCount = configurationService.getValue("diffEditor.hideUnchangedRegions.revealLineCount");
|
|
30
|
+
}
|
|
31
|
+
if (e.affectsConfiguration("diffEditor.hideUnchangedRegions.enabled")) {
|
|
32
|
+
result.options.enabled = configurationService.getValue("diffEditor.hideUnchangedRegions.enabled");
|
|
33
|
+
unchangedRegionsEnablementEmitter.fire(result.options.enabled);
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { getUnchangedRegionSettings };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { INotebookDocumentMetadataTextModel, INotebookTextModel, NotebookDocumentMetadata, TransientDocumentMetadata } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
+
import { ITextBuffer } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model";
|
|
5
|
+
export declare function getFormattedNotebookMetadataJSON(transientMetadata: TransientDocumentMetadata | undefined, metadata: NotebookDocumentMetadata): string;
|
|
6
|
+
export declare class NotebookDocumentMetadataTextModel extends Disposable implements INotebookDocumentMetadataTextModel {
|
|
7
|
+
readonly notebookModel: INotebookTextModel;
|
|
8
|
+
readonly uri: URI;
|
|
9
|
+
get metadata(): NotebookDocumentMetadata;
|
|
10
|
+
private readonly _onDidChange;
|
|
11
|
+
readonly onDidChange: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
12
|
+
private _textBufferHash;
|
|
13
|
+
private _textBuffer?;
|
|
14
|
+
get textBuffer(): ITextBuffer;
|
|
15
|
+
constructor(notebookModel: INotebookTextModel);
|
|
16
|
+
getHash(): string;
|
|
17
|
+
getValue(): string;
|
|
18
|
+
private getFullModelRange;
|
|
19
|
+
}
|