@codingame/monaco-vscode-katex-common 29.1.1 → 30.0.0
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,41 @@
|
|
|
1
|
+
import { Emitter } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { PrefixSumComputer } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/model/prefixSumComputer";
|
|
4
|
+
import { IDiffNestedCellViewModel } from "./notebookDiffEditorBrowser.js";
|
|
5
|
+
import { ICellOutputViewModel, IGenericCellViewModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
6
|
+
import { CellViewModelStateChangeEvent } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookViewEvents";
|
|
7
|
+
import { NotebookCellTextModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
|
|
8
|
+
import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
|
|
9
|
+
export declare class DiffNestedCellViewModel extends Disposable implements IDiffNestedCellViewModel, IGenericCellViewModel {
|
|
10
|
+
readonly textModel: NotebookCellTextModel;
|
|
11
|
+
private _notebookService;
|
|
12
|
+
private _id;
|
|
13
|
+
get id(): string;
|
|
14
|
+
get outputs(): import("@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon").ICellOutput[];
|
|
15
|
+
get language(): string;
|
|
16
|
+
get metadata(): import("@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon").NotebookCellMetadata;
|
|
17
|
+
get uri(): import("@codingame/monaco-vscode-api/vscode/vs/base/common/uri").URI;
|
|
18
|
+
get handle(): number;
|
|
19
|
+
protected readonly _onDidChangeState: Emitter<CellViewModelStateChangeEvent>;
|
|
20
|
+
private _hoveringOutput;
|
|
21
|
+
get outputIsHovered(): boolean;
|
|
22
|
+
set outputIsHovered(v: boolean);
|
|
23
|
+
private _focusOnOutput;
|
|
24
|
+
get outputIsFocused(): boolean;
|
|
25
|
+
set outputIsFocused(v: boolean);
|
|
26
|
+
private _focusInputInOutput;
|
|
27
|
+
get inputInOutputIsFocused(): boolean;
|
|
28
|
+
set inputInOutputIsFocused(v: boolean);
|
|
29
|
+
private _outputViewModels;
|
|
30
|
+
get outputsViewModels(): ICellOutputViewModel[];
|
|
31
|
+
protected _outputCollection: number[];
|
|
32
|
+
protected _outputsTop: PrefixSumComputer | null;
|
|
33
|
+
protected readonly _onDidChangeOutputLayout: Emitter<void>;
|
|
34
|
+
readonly onDidChangeOutputLayout: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
35
|
+
constructor(textModel: NotebookCellTextModel, _notebookService: INotebookService);
|
|
36
|
+
private _ensureOutputsTop;
|
|
37
|
+
getOutputOffset(index: number): number;
|
|
38
|
+
updateOutputHeight(index: number, height: number): void;
|
|
39
|
+
getOutputTotalHeight(): number;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
6
|
+
import { PrefixSumComputer } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/prefixSumComputer';
|
|
7
|
+
import { CellOutputViewModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel';
|
|
8
|
+
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
9
|
+
|
|
10
|
+
let DiffNestedCellViewModel = class DiffNestedCellViewModel extends Disposable {
|
|
11
|
+
get id() {
|
|
12
|
+
return this._id;
|
|
13
|
+
}
|
|
14
|
+
get outputs() {
|
|
15
|
+
return this.textModel.outputs;
|
|
16
|
+
}
|
|
17
|
+
get language() {
|
|
18
|
+
return this.textModel.language;
|
|
19
|
+
}
|
|
20
|
+
get metadata() {
|
|
21
|
+
return this.textModel.metadata;
|
|
22
|
+
}
|
|
23
|
+
get uri() {
|
|
24
|
+
return this.textModel.uri;
|
|
25
|
+
}
|
|
26
|
+
get handle() {
|
|
27
|
+
return this.textModel.handle;
|
|
28
|
+
}
|
|
29
|
+
get outputIsHovered() {
|
|
30
|
+
return this._hoveringOutput;
|
|
31
|
+
}
|
|
32
|
+
set outputIsHovered(v) {
|
|
33
|
+
this._hoveringOutput = v;
|
|
34
|
+
this._onDidChangeState.fire({
|
|
35
|
+
outputIsHoveredChanged: true
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
get outputIsFocused() {
|
|
39
|
+
return this._focusOnOutput;
|
|
40
|
+
}
|
|
41
|
+
set outputIsFocused(v) {
|
|
42
|
+
this._focusOnOutput = v;
|
|
43
|
+
this._onDidChangeState.fire({
|
|
44
|
+
outputIsFocusedChanged: true
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
get inputInOutputIsFocused() {
|
|
48
|
+
return this._focusInputInOutput;
|
|
49
|
+
}
|
|
50
|
+
set inputInOutputIsFocused(v) {
|
|
51
|
+
this._focusInputInOutput = v;
|
|
52
|
+
}
|
|
53
|
+
get outputsViewModels() {
|
|
54
|
+
return this._outputViewModels;
|
|
55
|
+
}
|
|
56
|
+
constructor(textModel, _notebookService) {
|
|
57
|
+
super();
|
|
58
|
+
this.textModel = textModel;
|
|
59
|
+
this._notebookService = _notebookService;
|
|
60
|
+
this._onDidChangeState = this._register(( new Emitter()));
|
|
61
|
+
this._hoveringOutput = false;
|
|
62
|
+
this._focusOnOutput = false;
|
|
63
|
+
this._focusInputInOutput = false;
|
|
64
|
+
this._outputCollection = [];
|
|
65
|
+
this._outputsTop = null;
|
|
66
|
+
this._onDidChangeOutputLayout = this._register(( new Emitter()));
|
|
67
|
+
this.onDidChangeOutputLayout = this._onDidChangeOutputLayout.event;
|
|
68
|
+
this._id = generateUuid();
|
|
69
|
+
this._outputViewModels = ( this.textModel.outputs.map(output => ( new CellOutputViewModel(this, output, this._notebookService))));
|
|
70
|
+
this._register(this.textModel.onDidChangeOutputs(splice => {
|
|
71
|
+
this._outputCollection.splice(splice.start, splice.deleteCount, ...( splice.newOutputs.map(() => 0)));
|
|
72
|
+
const removed = this._outputViewModels.splice(splice.start, splice.deleteCount, ...( splice.newOutputs.map(output => ( new CellOutputViewModel(this, output, this._notebookService)))));
|
|
73
|
+
removed.forEach(vm => vm.dispose());
|
|
74
|
+
this._outputsTop = null;
|
|
75
|
+
this._onDidChangeOutputLayout.fire();
|
|
76
|
+
}));
|
|
77
|
+
this._outputCollection = ( new Array(this.textModel.outputs.length));
|
|
78
|
+
}
|
|
79
|
+
_ensureOutputsTop() {
|
|
80
|
+
if (!this._outputsTop) {
|
|
81
|
+
const values = ( new Uint32Array(this._outputCollection.length));
|
|
82
|
+
for (let i = 0; i < this._outputCollection.length; i++) {
|
|
83
|
+
values[i] = this._outputCollection[i];
|
|
84
|
+
}
|
|
85
|
+
this._outputsTop = ( new PrefixSumComputer(values));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
getOutputOffset(index) {
|
|
89
|
+
this._ensureOutputsTop();
|
|
90
|
+
if (index >= this._outputCollection.length) {
|
|
91
|
+
throw ( new Error("Output index out of range!"));
|
|
92
|
+
}
|
|
93
|
+
return this._outputsTop.getPrefixSum(index - 1);
|
|
94
|
+
}
|
|
95
|
+
updateOutputHeight(index, height) {
|
|
96
|
+
if (index >= this._outputCollection.length) {
|
|
97
|
+
throw ( new Error("Output index out of range!"));
|
|
98
|
+
}
|
|
99
|
+
this._ensureOutputsTop();
|
|
100
|
+
this._outputCollection[index] = height;
|
|
101
|
+
if (this._outputsTop.setValue(index, height)) {
|
|
102
|
+
this._onDidChangeOutputLayout.fire();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
getOutputTotalHeight() {
|
|
106
|
+
this._ensureOutputsTop();
|
|
107
|
+
return this._outputsTop?.getTotalSum() ?? 0;
|
|
108
|
+
}
|
|
109
|
+
dispose() {
|
|
110
|
+
super.dispose();
|
|
111
|
+
this._outputViewModels.forEach(output => {
|
|
112
|
+
output.dispose();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
DiffNestedCellViewModel = ( __decorate([( __param(1, INotebookService))], DiffNestedCellViewModel));
|
|
117
|
+
|
|
118
|
+
export { DiffNestedCellViewModel };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
+
import { IEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service";
|
|
3
|
+
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
4
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
export interface IDiffEditorHeightCalculatorService {
|
|
6
|
+
diffAndComputeHeight(original: URI, modified: URI): Promise<number>;
|
|
7
|
+
computeHeightFromLines(lineCount: number): number;
|
|
8
|
+
}
|
|
9
|
+
export declare class DiffEditorHeightCalculatorService {
|
|
10
|
+
private readonly lineHeight;
|
|
11
|
+
private readonly textModelResolverService;
|
|
12
|
+
private readonly editorWorkerService;
|
|
13
|
+
private readonly configurationService;
|
|
14
|
+
constructor(lineHeight: number, textModelResolverService: ITextModelService, editorWorkerService: IEditorWorkerService, configurationService: IConfigurationService);
|
|
15
|
+
diffAndComputeHeight(original: URI, modified: URI): Promise<number>;
|
|
16
|
+
computeHeightFromLines(lineCount: number): number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { UnchangedRegion } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/diffEditorViewModel';
|
|
4
|
+
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
|
|
5
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
6
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
|
+
import { getEditorPadding } from './diffCellEditorOptions.js';
|
|
8
|
+
import { HeightOfHiddenLinesRegionInDiffEditor } from './diffElementViewModel.js';
|
|
9
|
+
|
|
10
|
+
let DiffEditorHeightCalculatorService = class DiffEditorHeightCalculatorService {
|
|
11
|
+
constructor(
|
|
12
|
+
lineHeight,
|
|
13
|
+
textModelResolverService,
|
|
14
|
+
editorWorkerService,
|
|
15
|
+
configurationService
|
|
16
|
+
) {
|
|
17
|
+
this.lineHeight = lineHeight;
|
|
18
|
+
this.textModelResolverService = textModelResolverService;
|
|
19
|
+
this.editorWorkerService = editorWorkerService;
|
|
20
|
+
this.configurationService = configurationService;
|
|
21
|
+
}
|
|
22
|
+
async diffAndComputeHeight(original, modified) {
|
|
23
|
+
const [originalModel, modifiedModel] = await Promise.all([
|
|
24
|
+
this.textModelResolverService.createModelReference(original),
|
|
25
|
+
this.textModelResolverService.createModelReference(modified)
|
|
26
|
+
]);
|
|
27
|
+
try {
|
|
28
|
+
const diffChanges = await this.editorWorkerService.computeDiff(original, modified, {
|
|
29
|
+
ignoreTrimWhitespace: true,
|
|
30
|
+
maxComputationTimeMs: 0,
|
|
31
|
+
computeMoves: false
|
|
32
|
+
}, "advanced").then(diff => diff?.changes || []);
|
|
33
|
+
const unchangedRegionFeatureEnabled = this.configurationService.getValue("diffEditor.hideUnchangedRegions.enabled");
|
|
34
|
+
const minimumLineCount = this.configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount");
|
|
35
|
+
const contextLineCount = this.configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount");
|
|
36
|
+
const originalLineCount = originalModel.object.textEditorModel.getLineCount();
|
|
37
|
+
const modifiedLineCount = modifiedModel.object.textEditorModel.getLineCount();
|
|
38
|
+
const unchanged = unchangedRegionFeatureEnabled ? UnchangedRegion.fromDiffs(
|
|
39
|
+
diffChanges,
|
|
40
|
+
originalLineCount,
|
|
41
|
+
modifiedLineCount,
|
|
42
|
+
minimumLineCount ?? 3,
|
|
43
|
+
contextLineCount ?? 3
|
|
44
|
+
) : [];
|
|
45
|
+
const numberOfNewLines = diffChanges.reduce((prev, curr) => {
|
|
46
|
+
if (curr.original.isEmpty && !curr.modified.isEmpty) {
|
|
47
|
+
return prev + curr.modified.length;
|
|
48
|
+
}
|
|
49
|
+
if (!curr.original.isEmpty && !curr.modified.isEmpty && curr.modified.length > curr.original.length) {
|
|
50
|
+
return prev + curr.modified.length - curr.original.length;
|
|
51
|
+
}
|
|
52
|
+
return prev;
|
|
53
|
+
}, 0);
|
|
54
|
+
const orginalNumberOfLines = originalModel.object.textEditorModel.getLineCount();
|
|
55
|
+
const numberOfHiddenLines = unchanged.reduce((prev, curr) => prev + curr.lineCount, 0);
|
|
56
|
+
const numberOfHiddenSections = unchanged.length;
|
|
57
|
+
const unchangeRegionsHeight = numberOfHiddenSections * HeightOfHiddenLinesRegionInDiffEditor;
|
|
58
|
+
const visibleLineCount = orginalNumberOfLines + numberOfNewLines - numberOfHiddenLines;
|
|
59
|
+
return (visibleLineCount * this.lineHeight) + getEditorPadding(visibleLineCount).top + getEditorPadding(visibleLineCount).bottom + unchangeRegionsHeight;
|
|
60
|
+
} finally {
|
|
61
|
+
originalModel.dispose();
|
|
62
|
+
modifiedModel.dispose();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
computeHeightFromLines(lineCount) {
|
|
66
|
+
return lineCount * this.lineHeight + getEditorPadding(lineCount).top + getEditorPadding(lineCount).bottom;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
DiffEditorHeightCalculatorService = ( __decorate([( __param(1, ITextModelService)), ( __param(2, IEditorWorkerService)), ( __param(3, IConfigurationService))], DiffEditorHeightCalculatorService));
|
|
70
|
+
|
|
71
|
+
export { DiffEditorHeightCalculatorService };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Emitter } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IDiffElementLayoutInfo } from "./notebookDiffEditorBrowser.js";
|
|
4
|
+
import { NotebookLayoutChangeEvent, NotebookLayoutInfo } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookViewEvents";
|
|
5
|
+
export declare enum NotebookDiffViewEventType {
|
|
6
|
+
LayoutChanged = 1,
|
|
7
|
+
CellLayoutChanged = 2
|
|
8
|
+
}
|
|
9
|
+
export declare class NotebookDiffLayoutChangedEvent {
|
|
10
|
+
readonly source: NotebookLayoutChangeEvent;
|
|
11
|
+
readonly value: NotebookLayoutInfo;
|
|
12
|
+
readonly type = NotebookDiffViewEventType.LayoutChanged;
|
|
13
|
+
constructor(source: NotebookLayoutChangeEvent, value: NotebookLayoutInfo);
|
|
14
|
+
}
|
|
15
|
+
export declare class NotebookCellLayoutChangedEvent {
|
|
16
|
+
readonly source: IDiffElementLayoutInfo;
|
|
17
|
+
readonly type = NotebookDiffViewEventType.CellLayoutChanged;
|
|
18
|
+
constructor(source: IDiffElementLayoutInfo);
|
|
19
|
+
}
|
|
20
|
+
export type NotebookDiffViewEvent = NotebookDiffLayoutChangedEvent | NotebookCellLayoutChangedEvent;
|
|
21
|
+
export declare class NotebookDiffEditorEventDispatcher extends Disposable {
|
|
22
|
+
protected readonly _onDidChangeLayout: Emitter<NotebookDiffLayoutChangedEvent>;
|
|
23
|
+
readonly onDidChangeLayout: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<NotebookDiffLayoutChangedEvent>;
|
|
24
|
+
protected readonly _onDidChangeCellLayout: Emitter<NotebookCellLayoutChangedEvent>;
|
|
25
|
+
readonly onDidChangeCellLayout: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<NotebookCellLayoutChangedEvent>;
|
|
26
|
+
emit(events: NotebookDiffViewEvent[]): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
|
|
5
|
+
var NotebookDiffViewEventType;
|
|
6
|
+
(function(NotebookDiffViewEventType) {
|
|
7
|
+
NotebookDiffViewEventType[NotebookDiffViewEventType["LayoutChanged"] = 1] = "LayoutChanged";
|
|
8
|
+
NotebookDiffViewEventType[NotebookDiffViewEventType["CellLayoutChanged"] = 2] = "CellLayoutChanged";
|
|
9
|
+
})(NotebookDiffViewEventType || (NotebookDiffViewEventType = {}));
|
|
10
|
+
class NotebookDiffLayoutChangedEvent {
|
|
11
|
+
constructor(source, value) {
|
|
12
|
+
this.source = source;
|
|
13
|
+
this.value = value;
|
|
14
|
+
this.type = NotebookDiffViewEventType.LayoutChanged;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class NotebookDiffEditorEventDispatcher extends Disposable {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this._onDidChangeLayout = this._register(( new Emitter()));
|
|
21
|
+
this.onDidChangeLayout = this._onDidChangeLayout.event;
|
|
22
|
+
this._onDidChangeCellLayout = this._register(( new Emitter()));
|
|
23
|
+
this.onDidChangeCellLayout = this._onDidChangeCellLayout.event;
|
|
24
|
+
}
|
|
25
|
+
emit(events) {
|
|
26
|
+
for (let i = 0, len = events.length; i < len; i++) {
|
|
27
|
+
const e = events[i];
|
|
28
|
+
switch (e.type) {
|
|
29
|
+
case NotebookDiffViewEventType.LayoutChanged:
|
|
30
|
+
this._onDidChangeLayout.fire(e);
|
|
31
|
+
break;
|
|
32
|
+
case NotebookDiffViewEventType.CellLayoutChanged:
|
|
33
|
+
this._onDidChangeCellLayout.fire(e);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { NotebookDiffEditorEventDispatcher, NotebookDiffLayoutChangedEvent, NotebookDiffViewEventType };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DisposableStore } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { INotebookEditor } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
3
|
+
import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
|
|
4
|
+
import { IEditorWorkerService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service";
|
|
5
|
+
import { NotebookCellTextModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel";
|
|
6
|
+
import { INotebookOriginalCellModelFactory } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.service";
|
|
7
|
+
export declare class NotebookCellDiffDecorator extends DisposableStore {
|
|
8
|
+
readonly modifiedCell: NotebookCellTextModel;
|
|
9
|
+
readonly originalCell: NotebookCellTextModel;
|
|
10
|
+
private readonly editor;
|
|
11
|
+
private readonly _editorWorkerService;
|
|
12
|
+
private readonly originalCellModelFactory;
|
|
13
|
+
private _viewZones;
|
|
14
|
+
private readonly throttledDecorator;
|
|
15
|
+
private diffForPreviouslyAppliedDecorators?;
|
|
16
|
+
private readonly perEditorDisposables;
|
|
17
|
+
constructor(notebookEditor: INotebookEditor, modifiedCell: NotebookCellTextModel, originalCell: NotebookCellTextModel, editor: ICodeEditor, _editorWorkerService: IEditorWorkerService, originalCellModelFactory: INotebookOriginalCellModelFactory);
|
|
18
|
+
update(editor: ICodeEditor): void;
|
|
19
|
+
private _updateImpl;
|
|
20
|
+
private _originalModel?;
|
|
21
|
+
private getOrCreateOriginalModel;
|
|
22
|
+
private _updateWithDiff;
|
|
23
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
5
|
+
import { ThrottledDelayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
6
|
+
import { IEditorWorkerService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/editorWorker.service';
|
|
7
|
+
import { EditorOption } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/config/editorOptions';
|
|
8
|
+
import { themeColorFromId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
9
|
+
import { RenderOptions, LineSource, renderLines } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines';
|
|
10
|
+
import { diffAddDecoration, diffWholeLineAddDecoration, diffDeleteDecoration } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/registrations.contribution';
|
|
11
|
+
import { TrackedRangeStickiness, MinimapPosition, OverviewRulerLane } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
12
|
+
import { ModelDecorationOptions } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/textModel';
|
|
13
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
14
|
+
import { overviewRulerModifiedForeground, minimapGutterModifiedBackground, overviewRulerAddedForeground, minimapGutterAddedBackground, overviewRulerDeletedForeground, minimapGutterDeletedBackground } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/scm/common/quickDiff';
|
|
15
|
+
import { INotebookOriginalCellModelFactory } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.service';
|
|
16
|
+
import { InlineDecoration, InlineDecorationType } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/viewModel/inlineDecorations';
|
|
17
|
+
import { createElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
18
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
19
|
+
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
20
|
+
import { autorunWithStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
21
|
+
|
|
22
|
+
let NotebookCellDiffDecorator = class NotebookCellDiffDecorator extends DisposableStore {
|
|
23
|
+
constructor(
|
|
24
|
+
notebookEditor,
|
|
25
|
+
modifiedCell,
|
|
26
|
+
originalCell,
|
|
27
|
+
editor,
|
|
28
|
+
_editorWorkerService,
|
|
29
|
+
originalCellModelFactory
|
|
30
|
+
) {
|
|
31
|
+
super();
|
|
32
|
+
this.modifiedCell = modifiedCell;
|
|
33
|
+
this.originalCell = originalCell;
|
|
34
|
+
this.editor = editor;
|
|
35
|
+
this._editorWorkerService = _editorWorkerService;
|
|
36
|
+
this.originalCellModelFactory = originalCellModelFactory;
|
|
37
|
+
this._viewZones = [];
|
|
38
|
+
this.throttledDecorator = this.add(( new ThrottledDelayer(50)));
|
|
39
|
+
this.perEditorDisposables = this.add(( new DisposableStore()));
|
|
40
|
+
const onDidChangeVisibleRanges = observableFromEvent(
|
|
41
|
+
notebookEditor.onDidChangeVisibleRanges,
|
|
42
|
+
() => notebookEditor.visibleRanges
|
|
43
|
+
);
|
|
44
|
+
const editorObs = derived(r => {
|
|
45
|
+
const visibleRanges = onDidChangeVisibleRanges.read(r);
|
|
46
|
+
const visibleCellHandles = ( ( visibleRanges.map(range => notebookEditor.getCellsInRange(range))).flat().map(c => c.handle));
|
|
47
|
+
if (!visibleCellHandles.includes(modifiedCell.handle)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const editor = notebookEditor.codeEditors.find(item => item[0].handle === modifiedCell.handle)?.[1];
|
|
51
|
+
if (editor?.getModel() !== this.modifiedCell.textModel) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return editor;
|
|
55
|
+
});
|
|
56
|
+
this.add(autorunWithStore((r, store) => {
|
|
57
|
+
const editor = editorObs.read(r);
|
|
58
|
+
this.perEditorDisposables.clear();
|
|
59
|
+
if (editor) {
|
|
60
|
+
store.add(editor.onDidChangeModel(() => {
|
|
61
|
+
this.perEditorDisposables.clear();
|
|
62
|
+
}));
|
|
63
|
+
store.add(editor.onDidChangeModelContent(() => {
|
|
64
|
+
this.update(editor);
|
|
65
|
+
}));
|
|
66
|
+
store.add(editor.onDidChangeConfiguration(e => {
|
|
67
|
+
if (e.hasChanged(EditorOption.fontInfo) || e.hasChanged(EditorOption.lineHeight)) {
|
|
68
|
+
this.update(editor);
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
this.update(editor);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
update(editor) {
|
|
76
|
+
this.throttledDecorator.trigger(() => this._updateImpl(editor));
|
|
77
|
+
}
|
|
78
|
+
async _updateImpl(editor) {
|
|
79
|
+
if (this.isDisposed) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (editor.getOption(EditorOption.inDiffEditor)) {
|
|
83
|
+
this.perEditorDisposables.clear();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const model = editor.getModel();
|
|
87
|
+
if (!model || model !== this.modifiedCell.textModel) {
|
|
88
|
+
this.perEditorDisposables.clear();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const originalModel = this.getOrCreateOriginalModel(editor);
|
|
92
|
+
if (!originalModel) {
|
|
93
|
+
this.perEditorDisposables.clear();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const version = model.getVersionId();
|
|
97
|
+
const diff = await this._editorWorkerService.computeDiff(originalModel.uri, model.uri, {
|
|
98
|
+
computeMoves: true,
|
|
99
|
+
ignoreTrimWhitespace: false,
|
|
100
|
+
maxComputationTimeMs: Number.MAX_SAFE_INTEGER
|
|
101
|
+
}, "advanced");
|
|
102
|
+
if (this.isDisposed) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (diff && !diff.identical && this.modifiedCell.textModel && originalModel && model === editor.getModel() && editor.getModel()?.getVersionId() === version) {
|
|
106
|
+
this._updateWithDiff(editor, originalModel, diff, this.modifiedCell.textModel);
|
|
107
|
+
} else {
|
|
108
|
+
this.perEditorDisposables.clear();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
getOrCreateOriginalModel(editor) {
|
|
112
|
+
if (!this._originalModel) {
|
|
113
|
+
const model = editor.getModel();
|
|
114
|
+
if (!model) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this._originalModel = this.add(this.originalCellModelFactory.getOrCreate(
|
|
118
|
+
model.uri,
|
|
119
|
+
this.originalCell.getValue(),
|
|
120
|
+
model.getLanguageId(),
|
|
121
|
+
this.modifiedCell.cellKind
|
|
122
|
+
)).object;
|
|
123
|
+
}
|
|
124
|
+
return this._originalModel;
|
|
125
|
+
}
|
|
126
|
+
_updateWithDiff(editor, originalModel, diff, currentModel) {
|
|
127
|
+
if (areDiffsEqual(diff, this.diffForPreviouslyAppliedDecorators)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.perEditorDisposables.clear();
|
|
131
|
+
const decorations = editor.createDecorationsCollection();
|
|
132
|
+
this.perEditorDisposables.add(toDisposable(() => {
|
|
133
|
+
editor.changeViewZones(viewZoneChangeAccessor => {
|
|
134
|
+
for (const id of this._viewZones) {
|
|
135
|
+
viewZoneChangeAccessor.removeZone(id);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
this._viewZones = [];
|
|
139
|
+
decorations.clear();
|
|
140
|
+
this.diffForPreviouslyAppliedDecorators = undefined;
|
|
141
|
+
}));
|
|
142
|
+
this.diffForPreviouslyAppliedDecorators = diff;
|
|
143
|
+
const chatDiffAddDecoration = ModelDecorationOptions.createDynamic({
|
|
144
|
+
...diffAddDecoration,
|
|
145
|
+
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
|
|
146
|
+
});
|
|
147
|
+
const chatDiffWholeLineAddDecoration = ModelDecorationOptions.createDynamic({
|
|
148
|
+
...diffWholeLineAddDecoration,
|
|
149
|
+
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
|
|
150
|
+
});
|
|
151
|
+
const createOverviewDecoration = (overviewRulerColor, minimapColor) => {
|
|
152
|
+
return ModelDecorationOptions.createDynamic({
|
|
153
|
+
description: "chat-editing-decoration",
|
|
154
|
+
overviewRuler: {
|
|
155
|
+
color: themeColorFromId(overviewRulerColor),
|
|
156
|
+
position: OverviewRulerLane.Left
|
|
157
|
+
},
|
|
158
|
+
minimap: {
|
|
159
|
+
color: themeColorFromId(minimapColor),
|
|
160
|
+
position: MinimapPosition.Gutter
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const modifiedDecoration = createOverviewDecoration(overviewRulerModifiedForeground, minimapGutterModifiedBackground);
|
|
165
|
+
const addedDecoration = createOverviewDecoration(overviewRulerAddedForeground, minimapGutterAddedBackground);
|
|
166
|
+
const deletedDecoration = createOverviewDecoration(overviewRulerDeletedForeground, minimapGutterDeletedBackground);
|
|
167
|
+
editor.changeViewZones(viewZoneChangeAccessor => {
|
|
168
|
+
for (const id of this._viewZones) {
|
|
169
|
+
viewZoneChangeAccessor.removeZone(id);
|
|
170
|
+
}
|
|
171
|
+
this._viewZones = [];
|
|
172
|
+
const modifiedVisualDecorations = [];
|
|
173
|
+
const mightContainNonBasicASCII = originalModel.mightContainNonBasicASCII();
|
|
174
|
+
const mightContainRTL = originalModel.mightContainRTL();
|
|
175
|
+
const renderOptions = RenderOptions.fromEditor(this.editor);
|
|
176
|
+
const editorLineCount = currentModel.getLineCount();
|
|
177
|
+
for (const diffEntry of diff.changes) {
|
|
178
|
+
const originalRange = diffEntry.original;
|
|
179
|
+
originalModel.tokenization.forceTokenization(Math.max(1, originalRange.endLineNumberExclusive - 1));
|
|
180
|
+
const source = ( new LineSource(
|
|
181
|
+
originalRange.mapToLineArray(l => originalModel.tokenization.getLineTokens(l)),
|
|
182
|
+
[],
|
|
183
|
+
mightContainNonBasicASCII,
|
|
184
|
+
mightContainRTL
|
|
185
|
+
));
|
|
186
|
+
const decorations = [];
|
|
187
|
+
for (const i of diffEntry.innerChanges || []) {
|
|
188
|
+
decorations.push(( new InlineDecoration(
|
|
189
|
+
i.originalRange.delta(-(diffEntry.original.startLineNumber - 1)),
|
|
190
|
+
diffDeleteDecoration.className,
|
|
191
|
+
InlineDecorationType.Regular
|
|
192
|
+
)));
|
|
193
|
+
if (!(i.originalRange.isEmpty() && i.originalRange.startLineNumber === 1 && i.modifiedRange.endLineNumber === editorLineCount) && !i.modifiedRange.isEmpty()) {
|
|
194
|
+
modifiedVisualDecorations.push({
|
|
195
|
+
range: i.modifiedRange,
|
|
196
|
+
options: chatDiffAddDecoration
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const isCreatedContent = decorations.length === 1 && decorations[0].range.isEmpty() && diffEntry.original.startLineNumber === 1;
|
|
201
|
+
if (!diffEntry.modified.isEmpty && !(isCreatedContent && (diffEntry.modified.endLineNumberExclusive - 1) === editorLineCount)) {
|
|
202
|
+
modifiedVisualDecorations.push({
|
|
203
|
+
range: diffEntry.modified.toInclusiveRange(),
|
|
204
|
+
options: chatDiffWholeLineAddDecoration
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (diffEntry.original.isEmpty) {
|
|
208
|
+
modifiedVisualDecorations.push({
|
|
209
|
+
range: diffEntry.modified.toInclusiveRange(),
|
|
210
|
+
options: addedDecoration
|
|
211
|
+
});
|
|
212
|
+
} else if (diffEntry.modified.isEmpty) {
|
|
213
|
+
modifiedVisualDecorations.push({
|
|
214
|
+
range: ( new Range(
|
|
215
|
+
diffEntry.modified.startLineNumber - 1,
|
|
216
|
+
1,
|
|
217
|
+
diffEntry.modified.startLineNumber,
|
|
218
|
+
1
|
|
219
|
+
)),
|
|
220
|
+
options: deletedDecoration
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
modifiedVisualDecorations.push({
|
|
224
|
+
range: diffEntry.modified.toInclusiveRange(),
|
|
225
|
+
options: modifiedDecoration
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
const domNode = createElement("div");
|
|
229
|
+
domNode.className = "chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";
|
|
230
|
+
const result = renderLines(source, renderOptions, decorations, domNode);
|
|
231
|
+
if (!isCreatedContent) {
|
|
232
|
+
const viewZoneData = {
|
|
233
|
+
afterLineNumber: diffEntry.modified.startLineNumber - 1,
|
|
234
|
+
heightInLines: result.heightInLines,
|
|
235
|
+
domNode,
|
|
236
|
+
ordinal: 50000 + 2
|
|
237
|
+
};
|
|
238
|
+
this._viewZones.push(viewZoneChangeAccessor.addZone(viewZoneData));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
decorations.set(modifiedVisualDecorations);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
NotebookCellDiffDecorator = ( __decorate([( __param(4, IEditorWorkerService)), ( __param(5, INotebookOriginalCellModelFactory))], NotebookCellDiffDecorator));
|
|
246
|
+
function areDiffsEqual(a, b) {
|
|
247
|
+
if (a && b) {
|
|
248
|
+
if (a.changes.length !== b.changes.length) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
if (a.moves.length !== b.moves.length) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
if (!areLineRangeMappinsEqual(a.changes, b.changes)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
if (!( a.moves.some((move, i) => {
|
|
258
|
+
const bMove = b.moves[i];
|
|
259
|
+
if (!areLineRangeMappinsEqual(move.changes, bMove.changes)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (move.lineRangeMapping.changedLineCount !== bMove.lineRangeMapping.changedLineCount) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
if (!move.lineRangeMapping.modified.equals(bMove.lineRangeMapping.modified)) {
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
if (!move.lineRangeMapping.original.equals(bMove.lineRangeMapping.original)) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
272
|
+
}))) {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
} else if (!a && !b) {
|
|
277
|
+
return true;
|
|
278
|
+
} else {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function areLineRangeMappinsEqual(a, b) {
|
|
283
|
+
if (a.length !== b.length) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
if (( a.some((c, i) => {
|
|
287
|
+
const bChange = b[i];
|
|
288
|
+
if (c.changedLineCount !== bChange.changedLineCount) {
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
if ((c.innerChanges || []).length !== (bChange.innerChanges || []).length) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
if (( (c.innerChanges || []).some((innerC, innerIdx) => {
|
|
295
|
+
const bInnerC = bChange.innerChanges[innerIdx];
|
|
296
|
+
if (!innerC.modifiedRange.equalsRange(bInnerC.modifiedRange)) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
if (!innerC.originalRange.equalsRange(bInnerC.originalRange)) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
return false;
|
|
303
|
+
}))) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
return false;
|
|
307
|
+
}))) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export { NotebookCellDiffDecorator };
|