@codingame/monaco-vscode-api 1.85.0-next.2 → 1.85.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/README.md +19 -10
- package/contributions.js +1 -0
- package/missing-services.js +91 -5
- package/monaco-editor-treemending.patch +2540 -2533
- package/package.json +6 -6
- package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
- package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
- package/assets/break.mp3 +0 -0
- package/assets/chatRequestSent.mp3 +0 -0
- package/assets/chatResponsePending.mp3 +0 -0
- package/assets/chatResponseReceived1.mp3 +0 -0
- package/assets/chatResponseReceived2.mp3 +0 -0
- package/assets/chatResponseReceived3.mp3 +0 -0
- package/assets/chatResponseReceived4.mp3 +0 -0
- package/assets/clear.mp3 +0 -0
- package/assets/defaultIcon.png +0 -0
- package/assets/diffLineDeleted.mp3 +0 -0
- package/assets/diffLineInserted.mp3 +0 -0
- package/assets/diffLineModified.mp3 +0 -0
- package/assets/error.mp3 +0 -0
- package/assets/fake.html +0 -10
- package/assets/foldedAreas.mp3 +0 -0
- package/assets/format.mp3 +0 -0
- package/assets/index-no-csp.html +0 -1226
- package/assets/index.html +0 -1227
- package/assets/quickFixes.mp3 +0 -0
- package/assets/save.mp3 +0 -0
- package/assets/service-worker.js +0 -457
- package/assets/taskCompleted.mp3 +0 -0
- package/assets/taskFailed.mp3 +0 -0
- package/assets/terminalBell.mp3 +0 -0
- package/assets/warning.mp3 +0 -0
- package/assets/webWorkerExtensionHostIframe.html +0 -123
- package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
- package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { assertFn } from 'monaco-editor/esm/vs/base/common/assert.js';
|
|
3
|
+
import { BugIndicatingError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
4
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
5
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { observableValue, observableFromEvent, derived } from 'monaco-editor/esm/vs/base/common/observable.js';
|
|
7
|
+
import { basename, isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
8
|
+
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
9
|
+
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
10
|
+
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
11
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
12
|
+
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
13
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
14
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
15
|
+
import { SaveSourceRegistry } from '../../../common/editor.js';
|
|
16
|
+
import { EditorModel } from '../../../common/editor/editorModel.js';
|
|
17
|
+
import { conflictMarkers } from './mergeMarkers/mergeMarkersController.js';
|
|
18
|
+
import { MergeDiffComputer } from './model/diffComputer.js';
|
|
19
|
+
import { MergeEditorModel } from './model/mergeEditorModel.js';
|
|
20
|
+
import { StorageCloseWithConflicts } from '../common/mergeEditor.js';
|
|
21
|
+
import { IEditorService } from '../../../services/editor/common/editorService.js';
|
|
22
|
+
import { ITextFileService } from '../../../services/textfile/common/textfiles.js';
|
|
23
|
+
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
|
|
24
|
+
var WorkspaceMergeEditorModeFactory_1;
|
|
25
|
+
let TempFileMergeEditorModeFactory = class TempFileMergeEditorModeFactory {
|
|
26
|
+
constructor(_mergeEditorTelemetry, _instantiationService, _textModelService, _modelService) {
|
|
27
|
+
this._mergeEditorTelemetry = _mergeEditorTelemetry;
|
|
28
|
+
this._instantiationService = _instantiationService;
|
|
29
|
+
this._textModelService = _textModelService;
|
|
30
|
+
this._modelService = _modelService;
|
|
31
|
+
}
|
|
32
|
+
async createInputModel(args) {
|
|
33
|
+
const store = ( new DisposableStore());
|
|
34
|
+
const [base, result, input1Data, input2Data,] = await Promise.all([
|
|
35
|
+
this._textModelService.createModelReference(args.base),
|
|
36
|
+
this._textModelService.createModelReference(args.result),
|
|
37
|
+
toInputData(args.input1, this._textModelService, store),
|
|
38
|
+
toInputData(args.input2, this._textModelService, store),
|
|
39
|
+
]);
|
|
40
|
+
store.add(base);
|
|
41
|
+
store.add(result);
|
|
42
|
+
const tempResultUri = result.object.textEditorModel.uri.with({ scheme: 'merge-result' });
|
|
43
|
+
const temporaryResultModel = this._modelService.createModel('', {
|
|
44
|
+
languageId: result.object.textEditorModel.getLanguageId(),
|
|
45
|
+
onDidChange: Event.None,
|
|
46
|
+
}, tempResultUri);
|
|
47
|
+
store.add(temporaryResultModel);
|
|
48
|
+
const mergeDiffComputer = this._instantiationService.createInstance(MergeDiffComputer);
|
|
49
|
+
const model = this._instantiationService.createInstance(MergeEditorModel, base.object.textEditorModel, input1Data, input2Data, temporaryResultModel, mergeDiffComputer, {
|
|
50
|
+
resetResult: true,
|
|
51
|
+
}, this._mergeEditorTelemetry);
|
|
52
|
+
store.add(model);
|
|
53
|
+
await model.onInitialized;
|
|
54
|
+
return this._instantiationService.createInstance(TempFileMergeEditorInputModel, model, store, result.object, args.result);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
TempFileMergeEditorModeFactory = ( __decorate([
|
|
58
|
+
( __param(1, IInstantiationService)),
|
|
59
|
+
( __param(2, ITextModelService)),
|
|
60
|
+
( __param(3, IModelService))
|
|
61
|
+
], TempFileMergeEditorModeFactory));
|
|
62
|
+
let TempFileMergeEditorInputModel = class TempFileMergeEditorInputModel extends EditorModel {
|
|
63
|
+
constructor(model, disposable, result, resultUri, textFileService, dialogService, editorService) {
|
|
64
|
+
super();
|
|
65
|
+
this.model = model;
|
|
66
|
+
this.disposable = disposable;
|
|
67
|
+
this.result = result;
|
|
68
|
+
this.resultUri = resultUri;
|
|
69
|
+
this.textFileService = textFileService;
|
|
70
|
+
this.dialogService = dialogService;
|
|
71
|
+
this.editorService = editorService;
|
|
72
|
+
this.savedAltVersionId = observableValue(this, this.model.resultTextModel.getAlternativeVersionId());
|
|
73
|
+
this.altVersionId = observableFromEvent(e => this.model.resultTextModel.onDidChangeContent(e), () =>
|
|
74
|
+
this.model.resultTextModel.getAlternativeVersionId());
|
|
75
|
+
this.isDirty = derived(this, (reader) => this.altVersionId.read(reader) !== this.savedAltVersionId.read(reader));
|
|
76
|
+
this.finished = false;
|
|
77
|
+
}
|
|
78
|
+
dispose() {
|
|
79
|
+
this.disposable.dispose();
|
|
80
|
+
super.dispose();
|
|
81
|
+
}
|
|
82
|
+
async accept() {
|
|
83
|
+
const value = await this.model.resultTextModel.getValue();
|
|
84
|
+
this.result.textEditorModel.setValue(value);
|
|
85
|
+
this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(), undefined);
|
|
86
|
+
await this.textFileService.save(this.result.textEditorModel.uri);
|
|
87
|
+
this.finished = true;
|
|
88
|
+
}
|
|
89
|
+
async _discard() {
|
|
90
|
+
await this.textFileService.revert(this.model.resultTextModel.uri);
|
|
91
|
+
this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(), undefined);
|
|
92
|
+
this.finished = true;
|
|
93
|
+
}
|
|
94
|
+
shouldConfirmClose() {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
async confirmClose(inputModels) {
|
|
98
|
+
assertFn(() => ( inputModels.some((m) => m === this)));
|
|
99
|
+
const someDirty = ( inputModels.some((m) => m.isDirty.get()));
|
|
100
|
+
let choice;
|
|
101
|
+
if (someDirty) {
|
|
102
|
+
const isMany = inputModels.length > 1;
|
|
103
|
+
const message = isMany
|
|
104
|
+
? ( localizeWithPath(
|
|
105
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
106
|
+
'messageN',
|
|
107
|
+
'Do you want keep the merge result of {0} files?',
|
|
108
|
+
inputModels.length
|
|
109
|
+
))
|
|
110
|
+
: ( localizeWithPath(
|
|
111
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
112
|
+
'message1',
|
|
113
|
+
'Do you want keep the merge result of {0}?',
|
|
114
|
+
basename(inputModels[0].model.resultTextModel.uri)
|
|
115
|
+
));
|
|
116
|
+
const hasUnhandledConflicts = ( inputModels.some((m) => m.model.hasUnhandledConflicts.get()));
|
|
117
|
+
const buttons = [
|
|
118
|
+
{
|
|
119
|
+
label: hasUnhandledConflicts ?
|
|
120
|
+
( localizeWithPath(
|
|
121
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
122
|
+
{ key: 'saveWithConflict', comment: ['&& denotes a mnemonic'] },
|
|
123
|
+
"&&Save With Conflicts"
|
|
124
|
+
)) :
|
|
125
|
+
( localizeWithPath(
|
|
126
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
127
|
+
{ key: 'save', comment: ['&& denotes a mnemonic'] },
|
|
128
|
+
"&&Save"
|
|
129
|
+
)),
|
|
130
|
+
run: () => 0
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
label: ( localizeWithPath(
|
|
134
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
135
|
+
{ key: 'discard', comment: ['&& denotes a mnemonic'] },
|
|
136
|
+
"Do&&n't Save"
|
|
137
|
+
)),
|
|
138
|
+
run: () => 1
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
choice = (await this.dialogService.prompt({
|
|
142
|
+
type: Severity.Info,
|
|
143
|
+
message,
|
|
144
|
+
detail: hasUnhandledConflicts
|
|
145
|
+
? isMany
|
|
146
|
+
? ( localizeWithPath(
|
|
147
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
148
|
+
'detailNConflicts',
|
|
149
|
+
"The files contain unhandled conflicts. The merge results will be lost if you don't save them."
|
|
150
|
+
))
|
|
151
|
+
: ( localizeWithPath(
|
|
152
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
153
|
+
'detail1Conflicts',
|
|
154
|
+
"The file contains unhandled conflicts. The merge result will be lost if you don't save it."
|
|
155
|
+
))
|
|
156
|
+
: isMany
|
|
157
|
+
? ( localizeWithPath(
|
|
158
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
159
|
+
'detailN',
|
|
160
|
+
"The merge results will be lost if you don't save them."
|
|
161
|
+
))
|
|
162
|
+
: ( localizeWithPath(
|
|
163
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
164
|
+
'detail1',
|
|
165
|
+
"The merge result will be lost if you don't save it."
|
|
166
|
+
)),
|
|
167
|
+
buttons,
|
|
168
|
+
cancelButton: {
|
|
169
|
+
run: () => 2
|
|
170
|
+
}
|
|
171
|
+
})).result;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
choice = 1 ;
|
|
175
|
+
}
|
|
176
|
+
if (choice === 0 ) {
|
|
177
|
+
await Promise.all(( inputModels.map(m => m.accept())));
|
|
178
|
+
}
|
|
179
|
+
else if (choice === 1 ) {
|
|
180
|
+
await Promise.all(( inputModels.map(m => m._discard())));
|
|
181
|
+
}
|
|
182
|
+
else ;
|
|
183
|
+
return choice;
|
|
184
|
+
}
|
|
185
|
+
async save(options) {
|
|
186
|
+
if (this.finished) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
(async () => {
|
|
190
|
+
const { confirmed } = await this.dialogService.confirm({
|
|
191
|
+
message: ( localizeWithPath(
|
|
192
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
193
|
+
'saveTempFile.message',
|
|
194
|
+
"Do you want to accept the merge result?"
|
|
195
|
+
)),
|
|
196
|
+
detail: ( localizeWithPath(
|
|
197
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
198
|
+
'saveTempFile.detail',
|
|
199
|
+
"This will write the merge result to the original file and close the merge editor."
|
|
200
|
+
)),
|
|
201
|
+
primaryButton: ( localizeWithPath(
|
|
202
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
203
|
+
{ key: 'acceptMerge', comment: ['&& denotes a mnemonic'] },
|
|
204
|
+
'&&Accept Merge'
|
|
205
|
+
))
|
|
206
|
+
});
|
|
207
|
+
if (confirmed) {
|
|
208
|
+
await this.accept();
|
|
209
|
+
const editors = this.editorService.findEditors(this.resultUri).filter(e => e.editor.typeId === 'mergeEditor.Input');
|
|
210
|
+
await this.editorService.closeEditors(editors);
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
213
|
+
}
|
|
214
|
+
async revert(options) {
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
TempFileMergeEditorInputModel = ( __decorate([
|
|
218
|
+
( __param(4, ITextFileService)),
|
|
219
|
+
( __param(5, IDialogService)),
|
|
220
|
+
( __param(6, IEditorService))
|
|
221
|
+
], TempFileMergeEditorInputModel));
|
|
222
|
+
let WorkspaceMergeEditorModeFactory = class WorkspaceMergeEditorModeFactory {
|
|
223
|
+
static { WorkspaceMergeEditorModeFactory_1 = this; }
|
|
224
|
+
constructor(_mergeEditorTelemetry, _instantiationService, _textModelService, textFileService) {
|
|
225
|
+
this._mergeEditorTelemetry = _mergeEditorTelemetry;
|
|
226
|
+
this._instantiationService = _instantiationService;
|
|
227
|
+
this._textModelService = _textModelService;
|
|
228
|
+
this.textFileService = textFileService;
|
|
229
|
+
}
|
|
230
|
+
static { this.FILE_SAVED_SOURCE = SaveSourceRegistry.registerSource('merge-editor.source', ( localizeWithPath(
|
|
231
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
232
|
+
'merge-editor.source',
|
|
233
|
+
"Before Resolving Conflicts In Merge Editor"
|
|
234
|
+
))); }
|
|
235
|
+
async createInputModel(args) {
|
|
236
|
+
const store = ( new DisposableStore());
|
|
237
|
+
let resultTextFileModel = undefined;
|
|
238
|
+
const modelListener = store.add(( new DisposableStore()));
|
|
239
|
+
const handleDidCreate = (model) => {
|
|
240
|
+
if (isEqual(args.result, model.resource)) {
|
|
241
|
+
modelListener.clear();
|
|
242
|
+
resultTextFileModel = model;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
modelListener.add(this.textFileService.files.onDidCreate(handleDidCreate));
|
|
246
|
+
this.textFileService.files.models.forEach(handleDidCreate);
|
|
247
|
+
const [base, result, input1Data, input2Data,] = await Promise.all([
|
|
248
|
+
this._textModelService.createModelReference(args.base),
|
|
249
|
+
this._textModelService.createModelReference(args.result),
|
|
250
|
+
toInputData(args.input1, this._textModelService, store),
|
|
251
|
+
toInputData(args.input2, this._textModelService, store),
|
|
252
|
+
]);
|
|
253
|
+
store.add(base);
|
|
254
|
+
store.add(result);
|
|
255
|
+
if (!resultTextFileModel) {
|
|
256
|
+
throw new BugIndicatingError();
|
|
257
|
+
}
|
|
258
|
+
await resultTextFileModel.save({ source: WorkspaceMergeEditorModeFactory_1.FILE_SAVED_SOURCE });
|
|
259
|
+
const lines = resultTextFileModel.textEditorModel.getLinesContent();
|
|
260
|
+
const hasConflictMarkers = ( lines.some(l => l.startsWith(conflictMarkers.start)));
|
|
261
|
+
const resetResult = hasConflictMarkers;
|
|
262
|
+
const mergeDiffComputer = this._instantiationService.createInstance(MergeDiffComputer);
|
|
263
|
+
const model = this._instantiationService.createInstance(MergeEditorModel, base.object.textEditorModel, input1Data, input2Data, result.object.textEditorModel, mergeDiffComputer, {
|
|
264
|
+
resetResult
|
|
265
|
+
}, this._mergeEditorTelemetry);
|
|
266
|
+
store.add(model);
|
|
267
|
+
await model.onInitialized;
|
|
268
|
+
return this._instantiationService.createInstance(WorkspaceMergeEditorInputModel, model, store, resultTextFileModel, this._mergeEditorTelemetry);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
WorkspaceMergeEditorModeFactory = WorkspaceMergeEditorModeFactory_1 = ( __decorate([
|
|
272
|
+
( __param(1, IInstantiationService)),
|
|
273
|
+
( __param(2, ITextModelService)),
|
|
274
|
+
( __param(3, ITextFileService))
|
|
275
|
+
], WorkspaceMergeEditorModeFactory));
|
|
276
|
+
let WorkspaceMergeEditorInputModel = class WorkspaceMergeEditorInputModel extends EditorModel {
|
|
277
|
+
constructor(model, disposableStore, resultTextFileModel, telemetry, _dialogService, _storageService) {
|
|
278
|
+
super();
|
|
279
|
+
this.model = model;
|
|
280
|
+
this.disposableStore = disposableStore;
|
|
281
|
+
this.resultTextFileModel = resultTextFileModel;
|
|
282
|
+
this.telemetry = telemetry;
|
|
283
|
+
this._dialogService = _dialogService;
|
|
284
|
+
this._storageService = _storageService;
|
|
285
|
+
this.isDirty = observableFromEvent(Event.any(this.resultTextFileModel.onDidChangeDirty, this.resultTextFileModel.onDidSaveError), () => this.resultTextFileModel.isDirty());
|
|
286
|
+
this.reported = false;
|
|
287
|
+
this.dateTimeOpened = ( new Date());
|
|
288
|
+
}
|
|
289
|
+
dispose() {
|
|
290
|
+
this.disposableStore.dispose();
|
|
291
|
+
super.dispose();
|
|
292
|
+
this.reportClose(false);
|
|
293
|
+
}
|
|
294
|
+
reportClose(accepted) {
|
|
295
|
+
if (!this.reported) {
|
|
296
|
+
const remainingConflictCount = this.model.unhandledConflictsCount.get();
|
|
297
|
+
const durationOpenedMs = ( new Date()).getTime() - this.dateTimeOpened.getTime();
|
|
298
|
+
this.telemetry.reportMergeEditorClosed({
|
|
299
|
+
durationOpenedSecs: durationOpenedMs / 1000,
|
|
300
|
+
remainingConflictCount,
|
|
301
|
+
accepted,
|
|
302
|
+
conflictCount: this.model.conflictCount,
|
|
303
|
+
combinableConflictCount: this.model.combinableConflictCount,
|
|
304
|
+
conflictsResolvedWithBase: this.model.conflictsResolvedWithBase,
|
|
305
|
+
conflictsResolvedWithInput1: this.model.conflictsResolvedWithInput1,
|
|
306
|
+
conflictsResolvedWithInput2: this.model.conflictsResolvedWithInput2,
|
|
307
|
+
conflictsResolvedWithSmartCombination: this.model.conflictsResolvedWithSmartCombination,
|
|
308
|
+
manuallySolvedConflictCountThatEqualNone: this.model.manuallySolvedConflictCountThatEqualNone,
|
|
309
|
+
manuallySolvedConflictCountThatEqualSmartCombine: this.model.manuallySolvedConflictCountThatEqualSmartCombine,
|
|
310
|
+
manuallySolvedConflictCountThatEqualInput1: this.model.manuallySolvedConflictCountThatEqualInput1,
|
|
311
|
+
manuallySolvedConflictCountThatEqualInput2: this.model.manuallySolvedConflictCountThatEqualInput2,
|
|
312
|
+
manuallySolvedConflictCountThatEqualNoneAndStartedWithBase: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,
|
|
313
|
+
manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,
|
|
314
|
+
manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,
|
|
315
|
+
manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,
|
|
316
|
+
manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart: this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart,
|
|
317
|
+
});
|
|
318
|
+
this.reported = true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
async accept() {
|
|
322
|
+
this.reportClose(true);
|
|
323
|
+
await this.resultTextFileModel.save();
|
|
324
|
+
}
|
|
325
|
+
get resultUri() {
|
|
326
|
+
return this.resultTextFileModel.resource;
|
|
327
|
+
}
|
|
328
|
+
async save(options) {
|
|
329
|
+
await this.resultTextFileModel.save(options);
|
|
330
|
+
}
|
|
331
|
+
async revert(options) {
|
|
332
|
+
await this.resultTextFileModel.revert(options);
|
|
333
|
+
}
|
|
334
|
+
shouldConfirmClose() {
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
async confirmClose(inputModels) {
|
|
338
|
+
const isMany = inputModels.length > 1;
|
|
339
|
+
const someDirty = ( inputModels.some(m => m.isDirty.get()));
|
|
340
|
+
const someUnhandledConflicts = ( inputModels.some(m => m.model.hasUnhandledConflicts.get()));
|
|
341
|
+
if (someDirty) {
|
|
342
|
+
const message = isMany
|
|
343
|
+
? ( localizeWithPath(
|
|
344
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
345
|
+
'workspace.messageN',
|
|
346
|
+
'Do you want to save the changes you made to {0} files?',
|
|
347
|
+
inputModels.length
|
|
348
|
+
))
|
|
349
|
+
: ( localizeWithPath(
|
|
350
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
351
|
+
'workspace.message1',
|
|
352
|
+
'Do you want to save the changes you made to {0}?',
|
|
353
|
+
basename(inputModels[0].resultUri)
|
|
354
|
+
));
|
|
355
|
+
const { result } = await this._dialogService.prompt({
|
|
356
|
+
type: Severity.Info,
|
|
357
|
+
message,
|
|
358
|
+
detail: someUnhandledConflicts ?
|
|
359
|
+
isMany
|
|
360
|
+
? ( localizeWithPath(
|
|
361
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
362
|
+
'workspace.detailN.unhandled',
|
|
363
|
+
"The files contain unhandled conflicts. Your changes will be lost if you don't save them."
|
|
364
|
+
))
|
|
365
|
+
: ( localizeWithPath(
|
|
366
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
367
|
+
'workspace.detail1.unhandled',
|
|
368
|
+
"The file contains unhandled conflicts. Your changes will be lost if you don't save them."
|
|
369
|
+
))
|
|
370
|
+
: isMany
|
|
371
|
+
? ( localizeWithPath(
|
|
372
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
373
|
+
'workspace.detailN.handled',
|
|
374
|
+
"Your changes will be lost if you don't save them."
|
|
375
|
+
))
|
|
376
|
+
: ( localizeWithPath(
|
|
377
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
378
|
+
'workspace.detail1.handled',
|
|
379
|
+
"Your changes will be lost if you don't save them."
|
|
380
|
+
)),
|
|
381
|
+
buttons: [
|
|
382
|
+
{
|
|
383
|
+
label: someUnhandledConflicts
|
|
384
|
+
? ( localizeWithPath(
|
|
385
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
386
|
+
{ key: 'workspace.saveWithConflict', comment: ['&& denotes a mnemonic'] },
|
|
387
|
+
'&&Save with Conflicts'
|
|
388
|
+
))
|
|
389
|
+
: ( localizeWithPath(
|
|
390
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
391
|
+
{ key: 'workspace.save', comment: ['&& denotes a mnemonic'] },
|
|
392
|
+
'&&Save'
|
|
393
|
+
)),
|
|
394
|
+
run: () => 0
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
label: ( localizeWithPath(
|
|
398
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
399
|
+
{ key: 'workspace.doNotSave', comment: ['&& denotes a mnemonic'] },
|
|
400
|
+
"Do&&n't Save"
|
|
401
|
+
)),
|
|
402
|
+
run: () => 1
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
cancelButton: {
|
|
406
|
+
run: () => 2
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
return result;
|
|
410
|
+
}
|
|
411
|
+
else if (someUnhandledConflicts && !this._storageService.getBoolean(StorageCloseWithConflicts, 0 , false)) {
|
|
412
|
+
const { confirmed, checkboxChecked } = await this._dialogService.confirm({
|
|
413
|
+
message: isMany
|
|
414
|
+
? ( localizeWithPath(
|
|
415
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
416
|
+
'workspace.messageN.nonDirty',
|
|
417
|
+
'Do you want to close {0} merge editors?',
|
|
418
|
+
inputModels.length
|
|
419
|
+
))
|
|
420
|
+
: ( localizeWithPath(
|
|
421
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
422
|
+
'workspace.message1.nonDirty',
|
|
423
|
+
'Do you want to close the merge editor for {0}?',
|
|
424
|
+
basename(inputModels[0].resultUri)
|
|
425
|
+
)),
|
|
426
|
+
detail: someUnhandledConflicts ?
|
|
427
|
+
isMany
|
|
428
|
+
? ( localizeWithPath(
|
|
429
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
430
|
+
'workspace.detailN.unhandled.nonDirty',
|
|
431
|
+
"The files contain unhandled conflicts."
|
|
432
|
+
))
|
|
433
|
+
: ( localizeWithPath(
|
|
434
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
435
|
+
'workspace.detail1.unhandled.nonDirty',
|
|
436
|
+
"The file contains unhandled conflicts."
|
|
437
|
+
))
|
|
438
|
+
: undefined,
|
|
439
|
+
primaryButton: someUnhandledConflicts
|
|
440
|
+
? ( localizeWithPath(
|
|
441
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
442
|
+
{ key: 'workspace.closeWithConflicts', comment: ['&& denotes a mnemonic'] },
|
|
443
|
+
'&&Close with Conflicts'
|
|
444
|
+
))
|
|
445
|
+
: ( localizeWithPath(
|
|
446
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
447
|
+
{ key: 'workspace.close', comment: ['&& denotes a mnemonic'] },
|
|
448
|
+
'&&Close'
|
|
449
|
+
)),
|
|
450
|
+
checkbox: { label: ( localizeWithPath(
|
|
451
|
+
'vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel',
|
|
452
|
+
'noMoreWarn',
|
|
453
|
+
"Don't ask again"
|
|
454
|
+
)) }
|
|
455
|
+
});
|
|
456
|
+
if (checkboxChecked) {
|
|
457
|
+
this._storageService.store(StorageCloseWithConflicts, true, 0 , 0 );
|
|
458
|
+
}
|
|
459
|
+
return confirmed ? 0 : 2 ;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
return 0 ;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
WorkspaceMergeEditorInputModel = ( __decorate([
|
|
467
|
+
( __param(4, IDialogService)),
|
|
468
|
+
( __param(5, IStorageService))
|
|
469
|
+
], WorkspaceMergeEditorInputModel));
|
|
470
|
+
async function toInputData(data, textModelService, store) {
|
|
471
|
+
const ref = await textModelService.createModelReference(data.uri);
|
|
472
|
+
store.add(ref);
|
|
473
|
+
return {
|
|
474
|
+
textModel: ref.object.textEditorModel,
|
|
475
|
+
title: data.title,
|
|
476
|
+
description: data.description,
|
|
477
|
+
detail: data.detail,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
export { TempFileMergeEditorModeFactory, WorkspaceMergeEditorModeFactory };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { assertFn, checkAdjacentItems } from 'monaco-editor/esm/vs/base/common/assert.js';
|
|
3
|
+
import { IEditorWorkerService } from 'monaco-editor/esm/vs/editor/common/services/editorWorker.js';
|
|
4
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
5
|
+
import { LineRange } from './lineRange.js';
|
|
6
|
+
import { DetailedLineRangeMapping, RangeMapping } from './mapping.js';
|
|
7
|
+
import { observableConfigValue } from '../utils.js';
|
|
8
|
+
let MergeDiffComputer = class MergeDiffComputer {
|
|
9
|
+
constructor(editorWorkerService, configurationService) {
|
|
10
|
+
this.editorWorkerService = editorWorkerService;
|
|
11
|
+
this.configurationService = configurationService;
|
|
12
|
+
this.mergeAlgorithm = ( observableConfigValue('mergeEditor.diffAlgorithm', 'advanced', this.configurationService)
|
|
13
|
+
.map(v => v === 'smart' ? 'legacy' : v === 'experimental' ? 'advanced' : v));
|
|
14
|
+
}
|
|
15
|
+
async computeDiff(textModel1, textModel2, reader) {
|
|
16
|
+
const diffAlgorithm = this.mergeAlgorithm.read(reader);
|
|
17
|
+
const inputVersion = textModel1.getVersionId();
|
|
18
|
+
const outputVersion = textModel2.getVersionId();
|
|
19
|
+
const result = await this.editorWorkerService.computeDiff(textModel1.uri, textModel2.uri, {
|
|
20
|
+
ignoreTrimWhitespace: false,
|
|
21
|
+
maxComputationTimeMs: 0,
|
|
22
|
+
computeMoves: false,
|
|
23
|
+
}, diffAlgorithm);
|
|
24
|
+
if (!result) {
|
|
25
|
+
throw new Error('Diff computation failed');
|
|
26
|
+
}
|
|
27
|
+
if (textModel1.isDisposed() || textModel2.isDisposed()) {
|
|
28
|
+
return { diffs: null };
|
|
29
|
+
}
|
|
30
|
+
const changes = ( result.changes.map(c => ( new DetailedLineRangeMapping(
|
|
31
|
+
toLineRange(c.original),
|
|
32
|
+
textModel1,
|
|
33
|
+
toLineRange(c.modified),
|
|
34
|
+
textModel2,
|
|
35
|
+
c.innerChanges?.map(ic => toRangeMapping(ic))
|
|
36
|
+
))));
|
|
37
|
+
const newInputVersion = textModel1.getVersionId();
|
|
38
|
+
const newOutputVersion = textModel2.getVersionId();
|
|
39
|
+
if (inputVersion !== newInputVersion || outputVersion !== newOutputVersion) {
|
|
40
|
+
return { diffs: null };
|
|
41
|
+
}
|
|
42
|
+
assertFn(() => {
|
|
43
|
+
for (const c of changes) {
|
|
44
|
+
const inputRange = c.inputRange;
|
|
45
|
+
const outputRange = c.outputRange;
|
|
46
|
+
const inputTextModel = c.inputTextModel;
|
|
47
|
+
const outputTextModel = c.outputTextModel;
|
|
48
|
+
for (const map of c.rangeMappings) {
|
|
49
|
+
let inputRangesValid = inputRange.startLineNumber - 1 <= map.inputRange.startLineNumber
|
|
50
|
+
&& map.inputRange.endLineNumber <= inputRange.endLineNumberExclusive;
|
|
51
|
+
if (inputRangesValid && map.inputRange.startLineNumber === inputRange.startLineNumber - 1) {
|
|
52
|
+
inputRangesValid = map.inputRange.endColumn >= inputTextModel.getLineMaxColumn(map.inputRange.startLineNumber);
|
|
53
|
+
}
|
|
54
|
+
if (inputRangesValid && map.inputRange.endLineNumber === inputRange.endLineNumberExclusive) {
|
|
55
|
+
inputRangesValid = map.inputRange.endColumn === 1;
|
|
56
|
+
}
|
|
57
|
+
let outputRangesValid = outputRange.startLineNumber - 1 <= map.outputRange.startLineNumber
|
|
58
|
+
&& map.outputRange.endLineNumber <= outputRange.endLineNumberExclusive;
|
|
59
|
+
if (outputRangesValid && map.outputRange.startLineNumber === outputRange.startLineNumber - 1) {
|
|
60
|
+
outputRangesValid = map.outputRange.endColumn >= outputTextModel.getLineMaxColumn(map.outputRange.endLineNumber);
|
|
61
|
+
}
|
|
62
|
+
if (outputRangesValid && map.outputRange.endLineNumber === outputRange.endLineNumberExclusive) {
|
|
63
|
+
outputRangesValid = map.outputRange.endColumn === 1;
|
|
64
|
+
}
|
|
65
|
+
if (!inputRangesValid || !outputRangesValid) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return changes.length === 0 || (changes[0].inputRange.startLineNumber === changes[0].outputRange.startLineNumber &&
|
|
71
|
+
checkAdjacentItems(changes, (m1, m2) => m2.inputRange.startLineNumber - m1.inputRange.endLineNumberExclusive === m2.outputRange.startLineNumber - m1.outputRange.endLineNumberExclusive &&
|
|
72
|
+
m1.inputRange.endLineNumberExclusive < m2.inputRange.startLineNumber &&
|
|
73
|
+
m1.outputRange.endLineNumberExclusive < m2.outputRange.startLineNumber));
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
diffs: changes
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
MergeDiffComputer = ( __decorate([
|
|
81
|
+
( __param(0, IEditorWorkerService)),
|
|
82
|
+
( __param(1, IConfigurationService))
|
|
83
|
+
], MergeDiffComputer));
|
|
84
|
+
function toLineRange(range) {
|
|
85
|
+
return ( new LineRange(range.startLineNumber, range.length));
|
|
86
|
+
}
|
|
87
|
+
function toRangeMapping(mapping) {
|
|
88
|
+
return ( new RangeMapping(mapping.originalRange, mapping.modifiedRange));
|
|
89
|
+
}
|
|
90
|
+
export { MergeDiffComputer, toLineRange, toRangeMapping };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { equals } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
2
|
+
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
3
|
+
class LineRangeEdit {
|
|
4
|
+
constructor(range, newLines) {
|
|
5
|
+
this.range = range;
|
|
6
|
+
this.newLines = newLines;
|
|
7
|
+
}
|
|
8
|
+
equals(other) {
|
|
9
|
+
return this.range.equals(other.range) && equals(this.newLines, other.newLines);
|
|
10
|
+
}
|
|
11
|
+
toEdits(modelLineCount) {
|
|
12
|
+
return ( new LineEdits([this])).toEdits(modelLineCount);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class RangeEdit {
|
|
16
|
+
constructor(range, newText) {
|
|
17
|
+
this.range = range;
|
|
18
|
+
this.newText = newText;
|
|
19
|
+
}
|
|
20
|
+
equals(other) {
|
|
21
|
+
return Range.equalsRange(this.range, other.range) && this.newText === other.newText;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class LineEdits {
|
|
25
|
+
constructor(edits) {
|
|
26
|
+
this.edits = edits;
|
|
27
|
+
}
|
|
28
|
+
toEdits(modelLineCount) {
|
|
29
|
+
return ( this.edits.map((e) => {
|
|
30
|
+
if (e.range.endLineNumberExclusive <= modelLineCount) {
|
|
31
|
+
return {
|
|
32
|
+
range: ( new Range(e.range.startLineNumber, 1, e.range.endLineNumberExclusive, 1)),
|
|
33
|
+
text: ( e.newLines.map(s => s + '\n')).join(''),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (e.range.startLineNumber === 1) {
|
|
37
|
+
return {
|
|
38
|
+
range: ( new Range(1, 1, modelLineCount, Number.MAX_SAFE_INTEGER)),
|
|
39
|
+
text: e.newLines.join('\n'),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
range: ( new Range(
|
|
44
|
+
e.range.startLineNumber - 1,
|
|
45
|
+
Number.MAX_SAFE_INTEGER,
|
|
46
|
+
modelLineCount,
|
|
47
|
+
Number.MAX_SAFE_INTEGER
|
|
48
|
+
)),
|
|
49
|
+
text: ( e.newLines.map(s => '\n' + s)).join(''),
|
|
50
|
+
};
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export { LineEdits, LineRangeEdit, RangeEdit };
|