@codingame/monaco-vscode-api 2.0.3 → 2.1.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/api.js +15 -12
- package/extensions.d.ts +4 -7
- package/external/@xterm/xterm/typings/xterm.d.ts +22 -0
- package/missing-services.js +62 -6
- package/package.json +8 -8
- package/service-override/tools/editor.js +14 -0
- package/services.d.ts +3 -2
- package/services.js +6 -4
- package/vscode/src/vs/base/browser/browser.js +45 -30
- package/vscode/src/vs/base/browser/canIUse.js +1 -1
- package/vscode/src/vs/base/browser/defaultWorkerFactory.js +12 -5
- package/vscode/src/vs/base/browser/dom.js +104 -14
- package/vscode/src/vs/base/browser/indexedDB.js +3 -3
- package/vscode/src/vs/base/browser/markdownRenderer.js +29 -1
- package/vscode/src/vs/base/browser/mouseEvent.js +17 -3
- package/vscode/src/vs/base/browser/ui/actionbar/actionbar.js +3 -3
- package/vscode/src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.d.ts +1 -1
- package/vscode/src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.js +287 -0
- package/vscode/src/vs/base/browser/ui/button/button.js +9 -0
- package/vscode/src/vs/base/browser/ui/codicons/codicon/codicon.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/dialog/dialog.js +1 -1
- package/vscode/src/vs/base/browser/ui/iconLabel/iconLabelHover.js +16 -5
- package/vscode/src/vs/base/browser/ui/list/listView.js +31 -11
- package/vscode/src/vs/base/browser/ui/list/listWidget.js +35 -21
- package/vscode/src/vs/base/browser/ui/menu/menu.js +10 -1
- package/vscode/src/vs/base/browser/ui/menu/menubar.js +8 -4
- package/vscode/src/vs/base/browser/ui/scrollbar/scrollableElement.js +6 -5
- package/vscode/src/vs/base/browser/ui/tree/abstractTree.js +469 -95
- package/vscode/src/vs/base/browser/ui/tree/asyncDataTree.js +22 -7
- package/vscode/src/vs/base/browser/ui/tree/indexTreeModel.js +0 -5
- package/vscode/src/vs/base/browser/ui/tree/media/tree.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/tree/objectTree.js +70 -4
- package/vscode/src/vs/base/common/assert.js +6 -1
- package/vscode/src/vs/base/common/async.js +31 -6
- package/vscode/src/vs/base/common/codicons.js +5 -0
- package/vscode/src/vs/base/common/event.d.ts +0 -5
- package/vscode/src/vs/base/common/event.js +0 -15
- package/vscode/src/vs/base/common/filters.d.ts +1 -18
- package/vscode/src/vs/base/common/htmlContent.js +12 -6
- package/vscode/src/vs/base/common/iterator.js +8 -0
- package/vscode/src/vs/base/common/labels.js +2 -1
- package/vscode/src/vs/base/common/map.js +20 -1
- package/vscode/src/vs/base/common/observableInternal/base.d.ts +4 -0
- package/vscode/src/vs/base/common/observableInternal/base.js +16 -8
- package/vscode/src/vs/base/common/observableInternal/derived.js +4 -6
- package/vscode/src/vs/base/common/observableInternal/utils.js +60 -5
- package/vscode/src/vs/base/common/platform.js +20 -20
- package/vscode/src/vs/base/common/prefixTree.js +4 -3
- package/vscode/src/vs/base/common/product.d.ts +5 -2
- package/vscode/src/vs/base/common/strings.js +23 -7
- package/vscode/src/vs/base/common/themables.js +4 -1
- package/vscode/src/vs/base/common/uri.js +11 -1
- package/vscode/src/vs/base/common/worker/simpleWorker.js +1 -1
- package/vscode/src/vs/editor/browser/config/migrateOptions.js +5 -0
- package/vscode/src/vs/editor/browser/controller/mouseHandler.js +1 -0
- package/vscode/src/vs/editor/browser/controller/mouseTarget.js +14 -8
- package/vscode/src/vs/editor/browser/controller/pointerHandler.js +18 -11
- package/vscode/src/vs/editor/browser/controller/textAreaHandler.js +1 -1
- package/vscode/src/vs/editor/browser/controller/textAreaInput.js +3 -3
- package/vscode/src/vs/{workbench/services/hover/browser → editor/browser/services}/hoverService.d.ts +7 -6
- package/vscode/src/vs/editor/browser/services/hoverService.js +195 -0
- package/vscode/src/vs/editor/browser/view.js +29 -39
- package/vscode/src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +41 -19
- package/vscode/src/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js +1 -1
- package/vscode/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +30 -23
- package/vscode/src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js +23 -8
- package/vscode/src/vs/editor/browser/viewParts/lines/viewLines.js +1 -1
- package/vscode/src/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js +8 -1
- package/vscode/src/vs/editor/browser/viewParts/marginDecorations/marginDecorations.js +7 -1
- package/vscode/src/vs/editor/browser/viewParts/minimap/minimap.js +1 -1
- package/vscode/src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +30 -3
- package/vscode/src/vs/editor/browser/widget/codeEditorWidget.js +39 -15
- package/vscode/src/vs/editor/browser/widget/diffEditor/{accessibleDiffViewer.css.js → components/accessibleDiffViewer.css.js} +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/{accessibleDiffViewer.js → components/accessibleDiffViewer.js} +43 -43
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorDecorations.js +89 -0
- package/vscode/src/vs/editor/browser/widget/diffEditor/{diffEditorEditors.js → components/diffEditorEditors.js} +14 -14
- package/vscode/src/vs/editor/browser/widget/diffEditor/{diffEditorSash.js → components/diffEditorSash.js} +5 -5
- package/vscode/src/vs/editor/browser/widget/diffEditor/{lineAlignment.js → components/diffEditorViewZones/diffEditorViewZones.js} +38 -28
- package/vscode/src/vs/editor/browser/widget/diffEditor/{inlineDiffDeletedCodeMargin.js → components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js} +14 -14
- package/vscode/src/vs/editor/browser/widget/diffEditor/{renderLines.js → components/diffEditorViewZones/renderLines.js} +7 -7
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js +29 -38
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js +150 -38
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +17 -16
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffProviderFactoryService.js +104 -6
- package/vscode/src/vs/editor/browser/widget/diffEditor/{hideUnchangedRegionsFeature.js → features/hideUnchangedRegionsFeature.js} +51 -78
- package/vscode/src/vs/editor/browser/widget/diffEditor/{movedBlocksLines.js → features/movedBlocksLinesFeature.js} +23 -23
- package/vscode/src/vs/editor/browser/widget/diffEditor/{overviewRulerPart.js → features/overviewRulerFeature.js} +28 -28
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js +145 -0
- package/vscode/src/vs/editor/browser/widget/diffEditor/{decorations.js → registrations.contribution.js} +18 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/utils.js +10 -2
- package/vscode/src/vs/editor/browser/widget/hoverWidget/hover.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/hoverWidget/hoverWidget.js +527 -0
- package/vscode/src/vs/editor/{contrib → browser/widget}/markdownRenderer/browser/markdownRenderer.js +11 -11
- package/vscode/src/vs/editor/{contrib → browser/widget}/markdownRenderer/browser/renderedMarkdown.css.js +1 -1
- package/vscode/src/vs/editor/common/config/editorOptions.d.ts +11 -10
- package/vscode/src/vs/editor/common/config/editorOptions.js +46 -42
- package/vscode/src/vs/editor/common/core/editorColorRegistry.js +3 -3
- package/vscode/src/vs/editor/common/core/offsetRange.d.ts +2 -0
- package/vscode/src/vs/editor/common/core/offsetRange.js +8 -0
- package/vscode/src/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js +9 -0
- package/vscode/src/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js +50 -47
- package/vscode/src/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js +4 -1
- package/vscode/src/vs/editor/common/diff/rangeMapping.d.ts +2 -1
- package/vscode/src/vs/editor/common/diff/rangeMapping.js +13 -2
- package/vscode/src/vs/editor/common/languages.d.ts +10 -2
- package/vscode/src/vs/editor/common/model/textModel.js +19 -13
- package/vscode/src/vs/editor/common/model/tokenizationTextModelPart.js +1 -1
- package/vscode/src/vs/editor/common/model.d.ts +19 -1
- package/vscode/src/vs/editor/common/model.js +2 -1
- package/vscode/src/vs/editor/common/services/editorSimpleWorker.js +2 -1
- package/vscode/src/vs/editor/common/services/getIconClasses.js +4 -1
- package/vscode/src/vs/editor/common/services/semanticTokensProviderStyling.js +3 -3
- package/vscode/src/vs/editor/common/standalone/standaloneEnums.js +9 -8
- package/vscode/src/vs/editor/common/standaloneStrings.js +18 -18
- package/vscode/src/vs/editor/common/viewEvents.js +2 -0
- package/vscode/src/vs/editor/common/viewModel/glyphLanesModel.js +55 -0
- package/vscode/src/vs/editor/common/viewModel/viewModelImpl.js +4 -1
- package/vscode/src/vs/editor/contrib/clipboard/browser/clipboard.js +5 -1
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeAction.js +1 -0
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionController.js +46 -20
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionMenu.js +1 -1
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionModel.js +38 -11
- package/vscode/src/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +56 -101
- package/vscode/src/vs/editor/contrib/codelens/browser/codelensWidget.js +3 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorContributions.js +2 -2
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorHoverParticipant.js +10 -29
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerWidget.js +4 -4
- package/vscode/src/vs/editor/contrib/diffEditorBreadcrumbs/browser/contribution.js +51 -0
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +19 -1
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +38 -10
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +29 -1
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/edit.js +10 -3
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +3 -17
- package/vscode/src/vs/editor/contrib/find/browser/findController.js +3 -35
- package/vscode/src/vs/editor/contrib/folding/browser/foldingDecorations.js +26 -6
- package/vscode/src/vs/editor/contrib/fontZoom/browser/fontZoom.js +6 -6
- package/vscode/src/vs/editor/contrib/format/browser/format.js +9 -9
- package/vscode/src/vs/editor/contrib/format/browser/formatActions.js +5 -5
- package/vscode/src/vs/editor/contrib/gotoError/browser/media/gotoErrorWidget.css.js +1 -1
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +2 -2
- package/vscode/src/vs/editor/contrib/hover/browser/contentHover.js +85 -76
- package/vscode/src/vs/editor/contrib/hover/browser/hover.js +120 -90
- package/vscode/src/vs/editor/contrib/hover/browser/marginHover.js +18 -6
- package/vscode/src/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
- package/vscode/src/vs/editor/contrib/hover/browser/markerHoverParticipant.js +2 -2
- package/vscode/src/vs/editor/contrib/inlayHints/browser/inlayHints.js +4 -2
- package/vscode/src/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +56 -38
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/hoverParticipant.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController.js +12 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsHintsWidget.js +4 -0
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.js +2 -2
- package/vscode/src/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +50 -53
- package/vscode/src/vs/editor/contrib/message/browser/messageController.js +5 -2
- package/vscode/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +5 -1
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.css.js +1 -1
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +4 -4
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +8 -5
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +58 -46
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestController.js +34 -7
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +30 -38
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestModel.js +2 -2
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidget.js +11 -3
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +18 -7
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +8 -10
- package/vscode/src/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/vscode/src/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +7 -6
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -0
- package/vscode/src/vs/editor/editor.api.d.ts +82 -11
- package/vscode/src/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js +8 -3
- package/vscode/src/vs/editor/standalone/browser/standaloneLayoutService.js +4 -3
- package/vscode/src/vs/editor/standalone/browser/standaloneServices.js +22 -11
- package/vscode/src/vs/editor/standalone/browser/standaloneThemeService.js +1 -1
- package/vscode/src/vs/nls.d.ts +6 -0
- package/vscode/src/vs/platform/accessibility/browser/accessibilityService.js +4 -1
- package/vscode/src/vs/platform/accessibility/common/accessibility.d.ts +2 -16
- package/vscode/src/vs/platform/accessibility/common/accessibility.js +1 -2
- package/vscode/src/vs/platform/action/common/actionCommonCategories.d.ts +7 -20
- package/vscode/src/vs/platform/action/common/actionCommonCategories.js +8 -8
- package/vscode/src/vs/platform/actionWidget/browser/actionList.js +0 -1
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.css.js +1 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +2 -0
- package/vscode/src/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem.js +5 -0
- package/vscode/src/vs/platform/actions/browser/menuEntryActionViewItem.css.js +1 -1
- package/vscode/src/vs/platform/actions/browser/menuEntryActionViewItem.js +2 -2
- package/vscode/src/vs/platform/actions/common/actions.d.ts +9 -1
- package/vscode/src/vs/platform/actions/common/actions.js +12 -1
- package/vscode/src/vs/platform/audioCues/browser/audioCueService.d.ts +11 -1
- package/vscode/src/vs/platform/audioCues/browser/audioCueService.js +174 -28
- package/vscode/src/vs/platform/clipboard/browser/clipboardService.js +38 -5
- package/vscode/src/vs/platform/configuration/common/configuration.d.ts +0 -1
- package/vscode/src/vs/platform/environment/common/environmentService.js +1 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.d.ts +5 -1
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +24 -5
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +6 -1
- package/vscode/src/vs/{workbench/services → platform}/hover/browser/hover.d.ts +6 -8
- package/vscode/src/vs/platform/hover/browser/hover.js +3 -0
- package/vscode/src/vs/platform/instantiation/common/instantiationService.js +14 -4
- package/vscode/src/vs/platform/keybinding/common/abstractKeybindingService.js +11 -4
- package/vscode/src/vs/platform/keybinding/common/keybinding.d.ts +7 -0
- package/vscode/src/vs/platform/layout/browser/layoutService.d.ts +6 -0
- package/vscode/src/vs/platform/list/browser/listService.js +7 -5
- package/vscode/src/vs/platform/log/common/bufferLog.js +1 -0
- package/vscode/src/vs/platform/log/common/log.d.ts +0 -1
- package/vscode/src/vs/platform/log/common/log.js +1 -2
- package/vscode/src/vs/platform/notification/common/notification.d.ts +36 -19
- package/vscode/src/vs/platform/notification/common/notification.js +9 -3
- package/vscode/src/vs/platform/quickinput/browser/pickerQuickAccess.js +4 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInput.js +50 -48
- package/vscode/src/vs/platform/quickinput/browser/quickInputController.js +3 -5
- package/vscode/src/vs/platform/quickinput/browser/quickInputList.js +49 -66
- package/vscode/src/vs/platform/quickinput/browser/quickInputService.js +11 -3
- package/vscode/src/vs/platform/quickinput/browser/quickInputUtils.js +16 -2
- package/vscode/src/vs/platform/quickinput/common/quickInput.d.ts +230 -26
- package/vscode/src/vs/platform/remote/common/remoteAuthorityResolver.d.ts +1 -0
- package/vscode/src/vs/platform/telemetry/common/telemetryUtils.js +1 -0
- package/vscode/src/vs/platform/theme/browser/defaultStyles.js +5 -3
- package/vscode/src/vs/platform/theme/common/colorRegistry.js +28 -9
- package/vscode/src/vs/platform/tunnel/common/tunnel.d.ts +2 -0
- package/vscode/src/vs/platform/window/common/window.js +14 -8
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +97 -78
- package/vscode/src/vs/workbench/api/common/extHost.protocol.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostAuthentication.js +1 -22
- package/vscode/src/vs/workbench/api/common/extHostChat.js +0 -6
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +31 -36
- package/vscode/src/vs/workbench/api/common/extHostChatVariables.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostComments.js +6 -1
- package/vscode/src/vs/workbench/api/common/extHostConsoleForwarder.js +1 -0
- package/vscode/src/vs/workbench/api/common/extHostDebugService.js +130 -6
- package/vscode/src/vs/workbench/api/common/extHostDocumentContentProviders.js +28 -15
- package/vscode/src/vs/workbench/api/common/extHostDocuments.js +4 -5
- package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +5 -1
- package/vscode/src/vs/workbench/api/common/extHostFileSystem.js +1 -2
- package/vscode/src/vs/workbench/api/common/extHostFileSystemConsumer.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostInlineChat.js +35 -33
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +40 -13
- package/vscode/src/vs/workbench/api/common/extHostMessageService.js +10 -1
- package/vscode/src/vs/workbench/api/common/extHostNotebook.js +11 -7
- package/vscode/src/vs/workbench/api/common/extHostNotebookEditors.js +2 -3
- package/vscode/src/vs/workbench/api/common/extHostNotebookKernels.js +29 -4
- package/vscode/src/vs/workbench/api/common/extHostProfileContentHandler.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostProgress.js +1 -7
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +49 -93
- package/vscode/src/vs/workbench/api/common/extHostSpeech.js +21 -0
- package/vscode/src/vs/workbench/api/common/extHostTask.js +18 -22
- package/vscode/src/vs/workbench/api/common/extHostTelemetry.js +1 -0
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +3 -3
- package/vscode/src/vs/workbench/api/common/extHostTesting.js +55 -36
- package/vscode/src/vs/workbench/api/common/extHostTextEditor.js +5 -2
- package/vscode/src/vs/workbench/api/common/extHostTextEditors.js +6 -7
- package/vscode/src/vs/workbench/api/common/extHostTreeViews.js +6 -3
- package/vscode/src/vs/workbench/api/common/extHostTunnelService.js +4 -2
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +74 -12
- package/vscode/src/vs/workbench/api/common/extHostTypes.js +27 -8
- package/vscode/src/vs/workbench/api/worker/extHostConsoleForwarder.js +1 -1
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +172 -103
- package/vscode/src/vs/workbench/browser/actions/windowActions.js +13 -17
- package/vscode/src/vs/workbench/browser/actions/workspaceActions.js +34 -34
- package/vscode/src/vs/workbench/browser/actions/workspaceCommands.js +4 -4
- package/vscode/src/vs/workbench/browser/dnd.js +2 -2
- package/vscode/src/vs/workbench/browser/labels.js +34 -4
- package/vscode/src/vs/workbench/browser/part.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +4 -4
- package/vscode/src/vs/workbench/browser/parts/compositeBarActions.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsControl.js +801 -0
- package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsModel.js +140 -0
- package/vscode/src/vs/workbench/browser/parts/editor/breadcrumbsPicker.js +410 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.js +1 -2
- package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +304 -303
- package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +101 -47
- package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +114 -47
- package/vscode/src/vs/workbench/browser/parts/editor/editorGroupView.js +1313 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorGroupWatermark.js +190 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPanes.js +344 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +10 -10
- package/vscode/src/vs/workbench/browser/parts/editor/editorTabsControl.js +27 -42
- package/vscode/src/vs/workbench/browser/parts/editor/editorTitleControl.js +152 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorsObserver.js +8 -8
- package/vscode/src/vs/workbench/browser/parts/editor/media/breadcrumbscontrol.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editortitlecontrol.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/multieditortabscontrol.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/singleeditortabscontrol.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.js +1626 -0
- package/vscode/src/vs/workbench/browser/parts/editor/multiRowEditorTabsControl.js +150 -0
- package/vscode/src/vs/workbench/browser/parts/editor/noEditorTabsControl.js +52 -0
- package/vscode/src/vs/workbench/browser/parts/editor/singleEditorTabsControl.js +260 -0
- package/vscode/src/vs/workbench/browser/parts/editor/textEditor.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/editor/textResourceEditor.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +39 -36
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.js +68 -28
- package/vscode/src/vs/workbench/browser/parts/panel/media/panelpart.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +15 -14
- package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.js +18 -17
- package/vscode/src/vs/workbench/browser/parts/titlebar/windowTitle.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +7 -10
- package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +2 -1
- package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.d.ts +2 -1
- package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +18 -17
- package/vscode/src/vs/workbench/browser/quickaccess.js +33 -1
- package/vscode/src/vs/workbench/browser/web.api.d.ts +6 -0
- package/vscode/src/vs/workbench/browser/window.js +92 -9
- package/vscode/src/vs/workbench/browser/workbench.contribution.js +114 -65
- package/vscode/src/vs/workbench/common/component.d.ts +5 -1
- package/vscode/src/vs/workbench/common/component.js +6 -0
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/contextkeys.js +8 -4
- package/vscode/src/vs/workbench/common/editor/editorInput.d.ts +6 -0
- package/vscode/src/vs/workbench/common/editor/editorInput.js +3 -0
- package/vscode/src/vs/workbench/common/editor/filteredEditorGroupModel.js +107 -0
- package/vscode/src/vs/workbench/common/editor/resourceEditorInput.d.ts +6 -3
- package/vscode/src/vs/workbench/common/editor/resourceEditorInput.js +21 -3
- package/vscode/src/vs/workbench/common/editor/textResourceEditorInput.d.ts +2 -1
- package/vscode/src/vs/workbench/common/editor/textResourceEditorInput.js +9 -6
- package/vscode/src/vs/workbench/common/editor.d.ts +16 -4
- package/vscode/src/vs/workbench/common/editor.js +7 -1
- package/vscode/src/vs/workbench/common/memento.js +33 -12
- package/vscode/src/vs/workbench/common/notifications.js +30 -7
- package/vscode/src/vs/workbench/common/theme.js +61 -1
- package/vscode/src/vs/workbench/common/views.d.ts +1 -28
- package/vscode/src/vs/workbench/common/views.js +1 -2
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +232 -19
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.js +9 -9
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +1 -0
- package/vscode/src/vs/workbench/contrib/accessibility/browser/editorAccessibilityHelp.js +19 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +8 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +57 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +31 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +93 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +30 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +24 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +12 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +21 -43
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +6 -6
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +0 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/{comments.contribution.js → commentsAccessibility.js} +36 -128
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +41 -18
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +202 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +27 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +165 -52
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +48 -31
- package/vscode/src/vs/workbench/contrib/debug/browser/debugIcons.js +6 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debug.d.ts +40 -10
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +28 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugContext.js +14 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +52 -23
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debugVisualizers.js +164 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +10 -0
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +285 -0
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +123 -78
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +10 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.js +3 -19
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +1 -2
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +8 -9
- package/vscode/src/vs/workbench/contrib/files/browser/files.configuration.contribution.js +70 -2
- package/vscode/src/vs/workbench/contrib/files/browser/files.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +34 -17
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +5 -4
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +48 -14
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +16 -8
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +317 -321
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +17 -24
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingService.js +3 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +306 -130
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +3 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +385 -613
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +69 -64
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +71 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +39 -44
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +5 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +38 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +36 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +32 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +24 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +1 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +264 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +60 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +12 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +12 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +6 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +188 -155
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +10 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +16 -33
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +9 -7
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +6 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +29 -14
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +15 -3
- package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +2 -2
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +22 -6
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +16 -17
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.js +78 -50
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +15 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.d.ts +25 -45
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +12 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcon.js +2 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +33 -36
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +3 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +5 -8
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +15 -27
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +3 -3
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +38 -22
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverageService.js +5 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testProfileService.js +60 -40
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +2 -2
- package/vscode/src/vs/workbench/contrib/testing/common/testResultStorage.js +15 -11
- package/vscode/src/vs/workbench/contrib/testing/common/testService.js +26 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +24 -23
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +1 -1
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +124 -26
- package/vscode/src/vs/workbench/services/authentication/common/authentication.d.ts +68 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +76 -36
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.js +1 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +1 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorService.js +15 -3
- package/vscode/src/vs/workbench/services/editor/common/editorGroupFinder.js +10 -1
- package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.d.ts +51 -43
- package/vscode/src/vs/workbench/services/editor/common/editorService.d.ts +13 -8
- package/vscode/src/vs/workbench/services/editor/common/editorService.js +2 -1
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +10 -10
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/services/extensions/common/extensionsApiProposals.js +7 -7
- package/vscode/src/vs/workbench/services/extensions/common/rpcProtocol.js +1 -0
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.d.ts +29 -9
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +160 -63
- package/vscode/src/vs/workbench/services/host/browser/host.d.ts +8 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +60 -72
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.d.ts +0 -4
- package/vscode/src/vs/workbench/services/notebook/common/notebookDocumentService.js +56 -0
- package/vscode/src/vs/workbench/services/output/common/output.js +2 -2
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +10 -0
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +10 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +2 -1
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +5 -4
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.js +21 -8
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.d.ts +4 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +3 -0
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +4 -4
- package/vscode/src/vs/workbench/{browser/parts/views → services/views/browser}/viewsService.js +20 -15
- package/vscode/src/vs/workbench/services/views/common/viewsService.d.ts +34 -0
- package/vscode/src/vs/workbench/services/{hover/browser/hover.js → views/common/viewsService.js} +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.d.ts +6 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +5 -2
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceTrust.js +1 -0
- package/vscode-dts/vscode.proposed.chatAgents2.d.ts +112 -47
- package/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts +68 -9
- package/vscode-dts/{vscode.proposed.scmInputBoxActionButton.d.ts → vscode.proposed.codeActionRanges.d.ts} +8 -10
- package/vscode-dts/{vscode.proposed.readonlyMessage.d.ts → vscode.proposed.commentReactor.d.ts} +3 -4
- package/vscode-dts/vscode.proposed.contribMultiDiffEditorMenus.d.ts +6 -0
- package/vscode-dts/vscode.proposed.contribSourceControlHistoryItemGroupMenu.d.ts +8 -0
- package/vscode-dts/vscode.proposed.contribSourceControlHistoryItemMenu.d.ts +8 -0
- package/vscode-dts/vscode.proposed.debugVisualization.d.ts +100 -0
- package/vscode-dts/vscode.proposed.defaultChatAgent.d.ts +1 -1
- package/vscode-dts/vscode.proposed.interactive.d.ts +13 -16
- package/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts +4 -1
- package/vscode-dts/vscode.proposed.resolvers.d.ts +4 -0
- package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +4 -10
- package/vscode-dts/vscode.proposed.scmMultiDiffEditor.d.ts +34 -0
- package/vscode-dts/vscode.proposed.speech.d.ts +17 -3
- package/vscode-dts/vscode.proposed.testCoverage.d.ts +7 -1
- package/vscode-dts/vscode.proposed.tunnelFactory.d.ts +4 -0
- package/vscode/src/vs/editor/browser/widget/diffEditor/colors.js +0 -17
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorDecorations.js +0 -231
- package/vscode/src/vs/editor/browser/widget/diffEditor/outlineModel.js +0 -299
- package/vscode/src/vs/editor/browser/widget/diffEditor/workerBasedDocumentDiffProvider.js +0 -101
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +0 -390
- package/vscode/src/vs/workbench/services/editor/common/editorGroupColumn.d.ts +0 -10
- package/vscode/src/vs/workbench/services/suggest/browser/media/suggest.css.js +0 -4
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.d.ts +0 -28
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionItem.js +0 -10
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.d.ts +0 -30
- package/vscode/src/vs/workbench/services/suggest/browser/simpleCompletionModel.js +0 -98
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.d.ts +0 -10
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +0 -428
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +0 -83
- package/vscode-dts/vscode.proposed.chatVariables.d.ts +0 -39
- package/vscode-dts/vscode.proposed.interactiveUserActions.d.ts +0 -77
- package/vscode-dts/vscode.proposed.saveEditor.d.ts +0 -35
- package/vscode-dts/vscode.proposed.scmInputBoxValueProvider.d.ts +0 -25
- package/vscode-dts/vscode.proposed.testingActiveProfile.d.ts +0 -21
|
@@ -1,96 +1,136 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { equals, tail } from '../../../../base/common/arrays.js';
|
|
6
|
-
import { AsyncIterableSource } from '../../../../base/common/async.js';
|
|
7
|
-
import { Codicon } from '../../../../base/common/codicons.js';
|
|
8
|
-
import { Event, Emitter } from '../../../../base/common/event.js';
|
|
2
|
+
import { WindowIntervalTimer } from '../../../../base/browser/dom.js';
|
|
3
|
+
import { coalesceInPlace } from '../../../../base/common/arrays.js';
|
|
4
|
+
import { Emitter, Event } from '../../../../base/common/event.js';
|
|
9
5
|
import { Lazy } from '../../../../base/common/lazy.js';
|
|
10
|
-
import { DisposableStore
|
|
11
|
-
import {
|
|
12
|
-
import { IBulkEditService } from '../../../../editor/browser/services/bulkEditService.js';
|
|
6
|
+
import { DisposableStore } from '../../../../base/common/lifecycle.js';
|
|
7
|
+
import { themeColorFromId } from '../../../../base/common/themables.js';
|
|
13
8
|
import { StableEditorScrollState } from '../../../../editor/browser/stableEditorScroll.js';
|
|
14
|
-
import { RenderOptions, LineSource, renderLines } from '../../../../editor/browser/widget/diffEditor/renderLines.js';
|
|
9
|
+
import { RenderOptions, LineSource, renderLines } from '../../../../editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';
|
|
15
10
|
import { EditOperation } from '../../../../editor/common/core/editOperation.js';
|
|
11
|
+
import { LineRange } from '../../../../editor/common/core/lineRange.js';
|
|
16
12
|
import { Range } from '../../../../editor/common/core/range.js';
|
|
17
|
-
import {
|
|
18
|
-
import { DetailedLineRangeMapping } from '../../../../editor/common/diff/rangeMapping.js';
|
|
19
|
-
import { TextEdit } from '../../../../editor/common/languages.js';
|
|
13
|
+
import { OverviewRulerLane } from '../../../../editor/common/model.js';
|
|
20
14
|
import { ModelDecorationOptions } from '../../../../editor/common/model/textModel.js';
|
|
21
15
|
import { IEditorWorkerService } from '../../../../editor/common/services/editorWorker.js';
|
|
22
16
|
import { InlineDecoration } from '../../../../editor/common/viewModel.js';
|
|
23
17
|
import { localizeWithPath } from '../../../../nls.js';
|
|
24
|
-
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
|
25
18
|
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
26
19
|
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
27
|
-
import {
|
|
28
|
-
import { countWords
|
|
20
|
+
import { Progress } from '../../../../platform/progress/common/progress.js';
|
|
21
|
+
import { countWords } from '../../chat/common/chatWordCounter.js';
|
|
29
22
|
import { InlineChatFileCreatePreviewWidget, InlineChatLivePreviewWidget } from './inlineChatLivePreviewWidget.js';
|
|
30
23
|
import { ReplyResponse } from './inlineChatSession.js';
|
|
31
|
-
import { CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF } from '../common/inlineChat.js';
|
|
32
|
-
|
|
24
|
+
import { CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, overviewRulerInlineChatDiffInserted } from '../common/inlineChat.js';
|
|
25
|
+
import { assertType } from '../../../../base/common/types.js';
|
|
26
|
+
import { IModelService } from '../../../../editor/common/services/model.js';
|
|
27
|
+
import { asProgressiveEdit, performAsyncTextEdit } from './utils.js';
|
|
33
28
|
class EditModeStrategy {
|
|
34
|
-
|
|
29
|
+
static { this._decoBlock = ModelDecorationOptions.register({
|
|
30
|
+
description: 'inline-chat',
|
|
31
|
+
showIfCollapsed: false,
|
|
32
|
+
isWholeLine: true,
|
|
33
|
+
className: 'inline-chat-block-selection',
|
|
34
|
+
}); }
|
|
35
|
+
constructor(_session, _editor, _zone) {
|
|
36
|
+
this._session = _session;
|
|
37
|
+
this._editor = _editor;
|
|
35
38
|
this._zone = _zone;
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
39
|
+
this._store = ( new DisposableStore());
|
|
40
|
+
this._onDidAccept = this._store.add(( new Emitter()));
|
|
41
|
+
this._onDidDiscard = this._store.add(( new Emitter()));
|
|
42
|
+
this._editCount = 0;
|
|
38
43
|
this.onDidAccept = this._onDidAccept.event;
|
|
39
44
|
this.onDidDiscard = this._onDidDiscard.event;
|
|
40
45
|
}
|
|
41
46
|
dispose() {
|
|
42
|
-
this.
|
|
43
|
-
|
|
47
|
+
this._store.dispose();
|
|
48
|
+
}
|
|
49
|
+
cancel() {
|
|
50
|
+
return this._session.hunkData.discardAll();
|
|
51
|
+
}
|
|
52
|
+
async acceptHunk() {
|
|
53
|
+
this._onDidAccept.fire();
|
|
54
|
+
}
|
|
55
|
+
async discardHunk() {
|
|
56
|
+
this._onDidDiscard.fire();
|
|
57
|
+
}
|
|
58
|
+
async _makeChanges(edits, obs, opts, progress) {
|
|
59
|
+
if (++this._editCount === 1) {
|
|
60
|
+
this._editor.pushUndoStop();
|
|
61
|
+
}
|
|
62
|
+
if (opts) {
|
|
63
|
+
const durationInSec = opts.duration / 1000;
|
|
64
|
+
for (const edit of edits) {
|
|
65
|
+
const wordCount = countWords(edit.text ?? '');
|
|
66
|
+
const speed = wordCount / durationInSec;
|
|
67
|
+
const asyncEdit = asProgressiveEdit(( new WindowIntervalTimer(this._zone.domNode)), edit, speed, opts.token);
|
|
68
|
+
await performAsyncTextEdit(this._session.textModelN, asyncEdit, progress, obs);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
obs.start();
|
|
73
|
+
this._session.textModelN.pushEditOperations(null, edits, (undoEdits) => {
|
|
74
|
+
progress?.report(undoEdits);
|
|
75
|
+
return null;
|
|
76
|
+
});
|
|
77
|
+
obs.stop();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
getWholeRangeDecoration() {
|
|
81
|
+
const ranges = [this._session.wholeRange.value];
|
|
82
|
+
const newDecorations = ( ranges.map(
|
|
83
|
+
range => range.isEmpty() ? undefined : ({ range, options: EditModeStrategy._decoBlock })
|
|
84
|
+
));
|
|
85
|
+
coalesceInPlace(newDecorations);
|
|
86
|
+
return newDecorations;
|
|
44
87
|
}
|
|
45
88
|
}
|
|
46
89
|
let PreviewStrategy = class PreviewStrategy extends EditModeStrategy {
|
|
47
|
-
constructor(
|
|
48
|
-
super(zone);
|
|
49
|
-
this._session = _session;
|
|
90
|
+
constructor(session, editor, zone, modelService, contextKeyService) {
|
|
91
|
+
super(session, editor, zone);
|
|
50
92
|
this._ctxDocumentChanged = CTX_INLINE_CHAT_DOCUMENT_CHANGED.bindTo(contextKeyService);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
93
|
+
const baseModel = modelService.getModel(session.targetUri);
|
|
94
|
+
Event.debounce(baseModel.onDidChangeContent.bind(baseModel), () => { }, 350)(_ => {
|
|
95
|
+
if (!baseModel.isDisposed() && !session.textModel0.isDisposed()) {
|
|
96
|
+
this._ctxDocumentChanged.set(session.hasChangedText);
|
|
54
97
|
}
|
|
55
|
-
});
|
|
98
|
+
}, undefined, this._store);
|
|
56
99
|
}
|
|
57
100
|
dispose() {
|
|
58
|
-
this._listener.dispose();
|
|
59
101
|
this._ctxDocumentChanged.reset();
|
|
60
102
|
super.dispose();
|
|
61
103
|
}
|
|
62
|
-
async start() {
|
|
63
|
-
}
|
|
64
104
|
async apply() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
105
|
+
const textModel = this._editor.getModel();
|
|
106
|
+
if (textModel?.equalsTextBuffer(this._session.textModel0.getTextBuffer())) {
|
|
107
|
+
this._session.hunkData.getInfo().forEach(item => item.acceptChanges());
|
|
108
|
+
const newText = this._session.textModel0.getValue();
|
|
109
|
+
const range = textModel.getFullModelRange();
|
|
110
|
+
textModel.pushStackElement();
|
|
111
|
+
textModel.pushEditOperations(null, [EditOperation.replace(range, newText)], () => null);
|
|
112
|
+
textModel.pushStackElement();
|
|
113
|
+
}
|
|
114
|
+
if (this._session.lastExchange?.response instanceof ReplyResponse) {
|
|
115
|
+
const { untitledTextModel } = this._session.lastExchange.response;
|
|
116
|
+
if (untitledTextModel && !untitledTextModel.isDisposed() && untitledTextModel.isDirty()) {
|
|
117
|
+
await untitledTextModel.save({ reason: 1 });
|
|
74
118
|
}
|
|
75
|
-
modelN.pushStackElement();
|
|
76
119
|
}
|
|
77
|
-
const { untitledTextModel } = this._session.lastExchange.response;
|
|
78
|
-
if (untitledTextModel && !untitledTextModel.isDisposed() && untitledTextModel.isDirty()) {
|
|
79
|
-
await untitledTextModel.save({ reason: 1 });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async cancel() {
|
|
83
120
|
}
|
|
84
|
-
async makeChanges(
|
|
121
|
+
async makeChanges(edits, obs) {
|
|
122
|
+
return this._makeChanges(edits, obs, undefined, undefined);
|
|
85
123
|
}
|
|
86
|
-
async
|
|
124
|
+
async makeProgressiveChanges(edits, obs, opts) {
|
|
125
|
+
return this._makeChanges(edits, obs, opts, undefined);
|
|
87
126
|
}
|
|
88
|
-
async
|
|
127
|
+
async undoChanges(altVersionId) {
|
|
128
|
+
const { textModelN } = this._session;
|
|
129
|
+
await undoModelUntil(textModelN, altVersionId);
|
|
89
130
|
}
|
|
90
131
|
async renderChanges(response) {
|
|
91
132
|
if (response.allLocalEdits.length > 0) {
|
|
92
|
-
|
|
93
|
-
await this._zone.widget.showEditsPreview(this._session.textModel0, this._session.textModelN, allEditOperation);
|
|
133
|
+
await this._zone.widget.showEditsPreview(this._session.textModel0, this._session.textModelN);
|
|
94
134
|
}
|
|
95
135
|
else {
|
|
96
136
|
this._zone.widget.hideEditsPreview();
|
|
@@ -105,98 +145,28 @@ let PreviewStrategy = class PreviewStrategy extends EditModeStrategy {
|
|
|
105
145
|
hasFocus() {
|
|
106
146
|
return this._zone.widget.hasFocus();
|
|
107
147
|
}
|
|
108
|
-
needsMargin() {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
148
|
};
|
|
112
149
|
PreviewStrategy = ( __decorate([
|
|
113
|
-
( __param(
|
|
150
|
+
( __param(3, IModelService)),
|
|
151
|
+
( __param(4, IContextKeyService))
|
|
114
152
|
], PreviewStrategy));
|
|
115
|
-
class
|
|
116
|
-
constructor(editor,
|
|
117
|
-
|
|
118
|
-
this._visible = false;
|
|
119
|
-
this._collection = editor.createDecorationsCollection();
|
|
120
|
-
this._visible = visible;
|
|
121
|
-
}
|
|
122
|
-
get visible() {
|
|
123
|
-
return this._visible;
|
|
124
|
-
}
|
|
125
|
-
set visible(value) {
|
|
126
|
-
this._visible = value;
|
|
127
|
-
this.update();
|
|
128
|
-
}
|
|
129
|
-
clear() {
|
|
130
|
-
this._collection.clear();
|
|
131
|
-
this._data.length = 0;
|
|
132
|
-
}
|
|
133
|
-
collectEditOperation(op) {
|
|
134
|
-
this._data.push(InlineDiffDecorations._asDecorationData(op));
|
|
135
|
-
}
|
|
136
|
-
update() {
|
|
137
|
-
this._collection.set(( this._data.map(d => {
|
|
138
|
-
const res = { ...d.tracking };
|
|
139
|
-
if (this._visible) {
|
|
140
|
-
res.options = { ...res.options, ...d.decorating };
|
|
141
|
-
}
|
|
142
|
-
return res;
|
|
143
|
-
})));
|
|
144
|
-
}
|
|
145
|
-
static _asDecorationData(edit) {
|
|
146
|
-
let content = edit.text;
|
|
147
|
-
if (content.length > 12) {
|
|
148
|
-
content = content.substring(0, 12) + '…';
|
|
149
|
-
}
|
|
150
|
-
const tracking = {
|
|
151
|
-
range: edit.range,
|
|
152
|
-
options: {
|
|
153
|
-
description: 'inline-chat-inline-diff',
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const decorating = {
|
|
157
|
-
description: 'inline-chat-inline-diff',
|
|
158
|
-
className: !edit.range.isEmpty() ? 'inline-chat-lines-inserted-range' : undefined,
|
|
159
|
-
showIfCollapsed: true,
|
|
160
|
-
before: {
|
|
161
|
-
content,
|
|
162
|
-
inlineClassName: 'inline-chat-lines-deleted-range-inline',
|
|
163
|
-
attachedData: edit,
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
return { tracking, decorating };
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
let LiveStrategy = LiveStrategy_1 = class LiveStrategy extends EditModeStrategy {
|
|
170
|
-
constructor(_session, _editor, zone, configService, _storageService, _bulkEditService, _editorWorkerService, _instaService) {
|
|
171
|
-
super(zone);
|
|
172
|
-
this._session = _session;
|
|
173
|
-
this._editor = _editor;
|
|
174
|
-
this._storageService = _storageService;
|
|
175
|
-
this._bulkEditService = _bulkEditService;
|
|
176
|
-
this._editorWorkerService = _editorWorkerService;
|
|
153
|
+
let LivePreviewStrategy = class LivePreviewStrategy extends EditModeStrategy {
|
|
154
|
+
constructor(session, editor, zone, _instaService) {
|
|
155
|
+
super(session, editor, zone);
|
|
177
156
|
this._instaService = _instaService;
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
this._inlineDiffDecorations = ( new InlineDiffDecorations(this._editor, this._diffEnabled));
|
|
183
|
-
this._inlineDiffDecorations.visible = this._diffEnabled;
|
|
184
|
-
this._store.add(configService.onDidChangeConfiguration(e => {
|
|
185
|
-
if (e.affectsConfiguration('inlineChat.showDiff')) {
|
|
186
|
-
this._diffEnabled = !this._diffEnabled;
|
|
187
|
-
this._doToggleDiff();
|
|
188
|
-
}
|
|
189
|
-
}));
|
|
157
|
+
this._diffZonePool = [];
|
|
158
|
+
this._previewZone = ( new Lazy(
|
|
159
|
+
() => _instaService.createInstance(InlineChatFileCreatePreviewWidget, editor)
|
|
160
|
+
));
|
|
190
161
|
}
|
|
191
162
|
dispose() {
|
|
163
|
+
for (const zone of this._diffZonePool) {
|
|
164
|
+
zone.hide();
|
|
165
|
+
zone.dispose();
|
|
166
|
+
}
|
|
167
|
+
this._previewZone.rawValue?.hide();
|
|
168
|
+
this._previewZone.rawValue?.dispose();
|
|
192
169
|
super.dispose();
|
|
193
|
-
this._inlineDiffDecorations.clear();
|
|
194
|
-
this._store.dispose();
|
|
195
|
-
}
|
|
196
|
-
_doToggleDiff() {
|
|
197
|
-
this._inlineDiffDecorations.visible = this._diffEnabled;
|
|
198
|
-
}
|
|
199
|
-
async start() {
|
|
200
170
|
}
|
|
201
171
|
async apply() {
|
|
202
172
|
if (this._editCount > 0) {
|
|
@@ -210,297 +180,159 @@ let LiveStrategy = LiveStrategy_1 = class LiveStrategy extends EditModeStrategy
|
|
|
210
180
|
await untitledTextModel.save({ reason: 1 });
|
|
211
181
|
}
|
|
212
182
|
}
|
|
213
|
-
async cancel() {
|
|
214
|
-
const { textModelN: modelN, textModelNAltVersion, textModelNSnapshotAltVersion } = this._session;
|
|
215
|
-
if (modelN.isDisposed()) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const targetAltVersion = textModelNSnapshotAltVersion ?? textModelNAltVersion;
|
|
219
|
-
LiveStrategy_1._undoModelUntil(modelN, targetAltVersion);
|
|
220
|
-
}
|
|
221
|
-
async makeChanges(edits) {
|
|
222
|
-
const cursorStateComputerAndInlineDiffCollection = (undoEdits) => {
|
|
223
|
-
let last = null;
|
|
224
|
-
for (const edit of undoEdits) {
|
|
225
|
-
last = !last || last.isBefore(edit.range.getEndPosition()) ? edit.range.getEndPosition() : last;
|
|
226
|
-
this._inlineDiffDecorations.collectEditOperation(edit);
|
|
227
|
-
}
|
|
228
|
-
return last && [Selection.fromPositions(last)];
|
|
229
|
-
};
|
|
230
|
-
if (++this._editCount === 1) {
|
|
231
|
-
this._editor.pushUndoStop();
|
|
232
|
-
}
|
|
233
|
-
this._editor.executeEdits('inline-chat-live', edits, cursorStateComputerAndInlineDiffCollection);
|
|
234
|
-
}
|
|
235
183
|
async undoChanges(altVersionId) {
|
|
236
184
|
const { textModelN } = this._session;
|
|
237
|
-
|
|
185
|
+
await undoModelUntil(textModelN, altVersionId);
|
|
186
|
+
this._updateDiffZones();
|
|
238
187
|
}
|
|
239
|
-
async
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const speed = wordCount / durationInSec;
|
|
247
|
-
await performAsyncTextEdit(this._session.textModelN, asProgressiveEdit(edit, speed, opts.token));
|
|
248
|
-
}
|
|
188
|
+
async makeChanges(edits, obs) {
|
|
189
|
+
return this._makeChanges(edits, obs, undefined, undefined);
|
|
190
|
+
}
|
|
191
|
+
async makeProgressiveChanges(edits, obs, opts) {
|
|
192
|
+
await this._makeChanges(edits, obs, opts, ( new Progress(() => {
|
|
193
|
+
this._updateDiffZones();
|
|
194
|
+
})));
|
|
249
195
|
}
|
|
250
196
|
async renderChanges(response) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this._inlineDiffDecorations.update();
|
|
254
|
-
if (response.untitledTextModel) {
|
|
255
|
-
this._zone.widget.showCreatePreview(response.untitledTextModel);
|
|
197
|
+
if (response.untitledTextModel && !response.untitledTextModel.isDisposed()) {
|
|
198
|
+
this._previewZone.value.showCreation(this._session.wholeRange.value.getStartPosition().delta(-1), response.untitledTextModel);
|
|
256
199
|
}
|
|
257
200
|
else {
|
|
258
|
-
this.
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
static _undoModelUntil(model, targetAltVersion) {
|
|
262
|
-
while (targetAltVersion < model.getAlternativeVersionId() && model.canUndo()) {
|
|
263
|
-
model.undo();
|
|
201
|
+
this._previewZone.value.hide();
|
|
264
202
|
}
|
|
203
|
+
return this._updateDiffZones();
|
|
265
204
|
}
|
|
266
|
-
_updateSummaryMessage(
|
|
267
|
-
let linesChanged = 0;
|
|
268
|
-
for (const change of mappings) {
|
|
269
|
-
linesChanged += change.changedLineCount;
|
|
270
|
-
}
|
|
205
|
+
_updateSummaryMessage(hunkCount) {
|
|
271
206
|
let message;
|
|
272
|
-
if (
|
|
207
|
+
if (hunkCount === 0) {
|
|
273
208
|
message = ( localizeWithPath(
|
|
274
209
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
275
|
-
'
|
|
210
|
+
'change.0',
|
|
276
211
|
"Nothing changed"
|
|
277
212
|
));
|
|
278
213
|
}
|
|
279
|
-
else if (
|
|
214
|
+
else if (hunkCount === 1) {
|
|
280
215
|
message = ( localizeWithPath(
|
|
281
216
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
282
|
-
'
|
|
283
|
-
"
|
|
217
|
+
'change.1',
|
|
218
|
+
"1 change"
|
|
284
219
|
));
|
|
285
220
|
}
|
|
286
221
|
else {
|
|
287
222
|
message = ( localizeWithPath(
|
|
288
223
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
289
|
-
'lines.
|
|
290
|
-
"
|
|
291
|
-
|
|
224
|
+
'lines.NM',
|
|
225
|
+
"{0} changes",
|
|
226
|
+
hunkCount
|
|
292
227
|
));
|
|
293
228
|
}
|
|
294
229
|
this._zone.widget.updateStatus(message);
|
|
295
230
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
return this._zone.widget.hasFocus();
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
LiveStrategy = LiveStrategy_1 = ( __decorate([
|
|
304
|
-
( __param(3, IConfigurationService)),
|
|
305
|
-
( __param(4, IStorageService)),
|
|
306
|
-
( __param(5, IBulkEditService)),
|
|
307
|
-
( __param(6, IEditorWorkerService)),
|
|
308
|
-
( __param(7, IInstantiationService))
|
|
309
|
-
], LiveStrategy));
|
|
310
|
-
let LivePreviewStrategy = class LivePreviewStrategy extends LiveStrategy {
|
|
311
|
-
constructor(session, editor, zone, configService, storageService, bulkEditService, editorWorkerService, instaService) {
|
|
312
|
-
super(session, editor, zone, configService, storageService, bulkEditService, editorWorkerService, instaService);
|
|
313
|
-
this._diffZonePool = [];
|
|
314
|
-
this._currentLineRangeGroups = [];
|
|
315
|
-
this._previewZone = ( new Lazy(
|
|
316
|
-
() => instaService.createInstance(InlineChatFileCreatePreviewWidget, editor)
|
|
317
|
-
));
|
|
318
|
-
}
|
|
319
|
-
dispose() {
|
|
320
|
-
for (const zone of this._diffZonePool) {
|
|
321
|
-
zone.hide();
|
|
322
|
-
zone.dispose();
|
|
323
|
-
}
|
|
324
|
-
this._previewZone.rawValue?.hide();
|
|
325
|
-
this._previewZone.rawValue?.dispose();
|
|
326
|
-
super.dispose();
|
|
327
|
-
}
|
|
328
|
-
async _updateDiffZones() {
|
|
329
|
-
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: 5000, computeMoves: false }, 'advanced');
|
|
330
|
-
if (!diff || diff.changes.length === 0) {
|
|
231
|
+
_updateDiffZones() {
|
|
232
|
+
const { hunkData } = this._session;
|
|
233
|
+
const hunks = hunkData.getInfo().filter(hunk => hunk.getState() === 0 );
|
|
234
|
+
if (hunks.length === 0) {
|
|
331
235
|
for (const zone of this._diffZonePool) {
|
|
332
236
|
zone.hide();
|
|
333
237
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
const originalStartLineNumber = this._session.session.wholeRange?.startLineNumber ?? 1;
|
|
337
|
-
const mainGroup = [];
|
|
338
|
-
let lastGroup;
|
|
339
|
-
const groups = [mainGroup];
|
|
340
|
-
for (let i = 0; i < diff.changes.length; i++) {
|
|
341
|
-
const change = diff.changes[i];
|
|
342
|
-
if (change.original.startLineNumber >= originalStartLineNumber || 'true') {
|
|
343
|
-
mainGroup.push(change);
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
if (!lastGroup) {
|
|
347
|
-
lastGroup = [change];
|
|
348
|
-
groups.push(lastGroup);
|
|
349
|
-
continue;
|
|
350
|
-
}
|
|
351
|
-
const last = tail(lastGroup);
|
|
352
|
-
const treshold = Math.ceil((change.modified.length + last.modified.length) * .75);
|
|
353
|
-
if (change.modified.startLineNumber - last.modified.endLineNumberExclusive <= treshold) {
|
|
354
|
-
lastGroup.push(change);
|
|
238
|
+
if (hunkData.getInfo().find(hunk => hunk.getState() === 1 )) {
|
|
239
|
+
this._onDidAccept.fire();
|
|
355
240
|
}
|
|
356
241
|
else {
|
|
357
|
-
|
|
358
|
-
groups.push(lastGroup);
|
|
242
|
+
this._onDidDiscard.fire();
|
|
359
243
|
}
|
|
360
|
-
}
|
|
361
|
-
const beforeAndNowAreEqual = equals(this._currentLineRangeGroups, groups, (groupA, groupB) => {
|
|
362
|
-
return equals(groupA, groupB, (mappingA, mappingB) => {
|
|
363
|
-
return mappingA.original.equals(mappingB.original) && mappingA.modified.equals(mappingB.modified);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
if (beforeAndNowAreEqual) {
|
|
367
244
|
return;
|
|
368
245
|
}
|
|
369
|
-
this._updateSummaryMessage(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
};
|
|
374
|
-
while (groups.length > this._diffZonePool.length) {
|
|
246
|
+
this._updateSummaryMessage(hunks.length);
|
|
247
|
+
const handleDiff = () => this._updateDiffZones();
|
|
248
|
+
let nearest;
|
|
249
|
+
while (hunks.length > this._diffZonePool.length) {
|
|
375
250
|
this._diffZonePool.push(this._instaService.createInstance(InlineChatLivePreviewWidget, this._editor, this._session, {}, this._diffZonePool.length === 0 ? handleDiff : undefined));
|
|
376
251
|
}
|
|
377
|
-
for (let i = 0; i <
|
|
378
|
-
|
|
252
|
+
for (let i = 0; i < hunks.length; i++) {
|
|
253
|
+
const hunk = hunks[i];
|
|
254
|
+
this._diffZonePool[i].showForChanges(hunk);
|
|
255
|
+
const modifiedRange = hunk.getRangesN()[0];
|
|
256
|
+
const zoneLineNumber = this._zone.position.lineNumber;
|
|
257
|
+
const distance = zoneLineNumber <= modifiedRange.startLineNumber
|
|
258
|
+
? modifiedRange.startLineNumber - zoneLineNumber
|
|
259
|
+
: zoneLineNumber - modifiedRange.endLineNumber;
|
|
260
|
+
if (!nearest || nearest.distance > distance) {
|
|
261
|
+
nearest = {
|
|
262
|
+
position: modifiedRange.getStartPosition().delta(-1),
|
|
263
|
+
distance,
|
|
264
|
+
accept: () => {
|
|
265
|
+
hunk.acceptChanges();
|
|
266
|
+
handleDiff();
|
|
267
|
+
},
|
|
268
|
+
discard: () => {
|
|
269
|
+
hunk.discardChanges();
|
|
270
|
+
handleDiff();
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
379
274
|
}
|
|
380
|
-
for (let i =
|
|
275
|
+
for (let i = hunks.length; i < this._diffZonePool.length; i++) {
|
|
381
276
|
this._diffZonePool[i].hide();
|
|
382
277
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
changeListener.dispose();
|
|
389
|
-
renderTask = this._updateDiffZones();
|
|
390
|
-
});
|
|
391
|
-
await changeTask;
|
|
392
|
-
await renderTask;
|
|
393
|
-
changeListener.dispose();
|
|
394
|
-
}
|
|
395
|
-
async undoChanges(altVersionId) {
|
|
396
|
-
await super.undoChanges(altVersionId);
|
|
397
|
-
await this._updateDiffZones();
|
|
398
|
-
}
|
|
399
|
-
async renderChanges(response) {
|
|
400
|
-
await this._updateDiffZones();
|
|
401
|
-
if (response.untitledTextModel && !response.untitledTextModel.isDisposed()) {
|
|
402
|
-
this._previewZone.value.showCreation(this._session.wholeRange.value.getStartPosition().delta(-1), response.untitledTextModel);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
this._previewZone.value.hide();
|
|
278
|
+
this.acceptHunk = async () => nearest?.accept();
|
|
279
|
+
this.discardHunk = async () => nearest?.discard();
|
|
280
|
+
if (nearest) {
|
|
281
|
+
this._zone.updatePositionAndHeight(nearest.position);
|
|
282
|
+
this._editor.revealPositionInCenterIfOutsideViewport(nearest.position);
|
|
406
283
|
}
|
|
284
|
+
return nearest?.position;
|
|
407
285
|
}
|
|
408
286
|
hasFocus() {
|
|
409
|
-
return
|
|
287
|
+
return this._zone.widget.hasFocus()
|
|
288
|
+
|| Boolean(this._previewZone.rawValue?.hasFocus())
|
|
289
|
+
|| ( this._diffZonePool.some(zone => zone.isVisible && zone.hasFocus()));
|
|
410
290
|
}
|
|
411
291
|
};
|
|
412
292
|
LivePreviewStrategy = ( __decorate([
|
|
413
|
-
( __param(3,
|
|
414
|
-
( __param(4, IStorageService)),
|
|
415
|
-
( __param(5, IBulkEditService)),
|
|
416
|
-
( __param(6, IEditorWorkerService)),
|
|
417
|
-
( __param(7, IInstantiationService))
|
|
293
|
+
( __param(3, IInstantiationService))
|
|
418
294
|
], LivePreviewStrategy));
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
options: {
|
|
423
|
-
description: 'asyncTextEdit',
|
|
424
|
-
stickiness: 0
|
|
425
|
-
}
|
|
426
|
-
}]);
|
|
427
|
-
let first = true;
|
|
428
|
-
for await (const part of edit.newText) {
|
|
429
|
-
if (model.isDisposed()) {
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
const range = model.getDecorationRange(id);
|
|
433
|
-
if (!range) {
|
|
434
|
-
throw new Error('FAILED to perform async replace edit because the anchor decoration was removed');
|
|
435
|
-
}
|
|
436
|
-
const edit = first
|
|
437
|
-
? EditOperation.replace(range, part)
|
|
438
|
-
: EditOperation.insert(range.getEndPosition(), part);
|
|
439
|
-
model.pushEditOperations(null, [edit], () => null);
|
|
440
|
-
first = false;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
function asProgressiveEdit(edit, wordsPerSec, token) {
|
|
444
|
-
wordsPerSec = Math.max(10, wordsPerSec);
|
|
445
|
-
const stream = ( new AsyncIterableSource());
|
|
446
|
-
let newText = edit.text ?? '';
|
|
447
|
-
const handle = disposableWindowInterval($window, () => {
|
|
448
|
-
const r = getNWords(newText, 1);
|
|
449
|
-
stream.emitOne(r.value);
|
|
450
|
-
newText = newText.substring(r.value.length);
|
|
451
|
-
if (r.isFullString) {
|
|
452
|
-
handle.dispose();
|
|
453
|
-
stream.resolve();
|
|
454
|
-
d.dispose();
|
|
455
|
-
}
|
|
456
|
-
}, 1000 / wordsPerSec);
|
|
457
|
-
const d = token.onCancellationRequested(() => {
|
|
458
|
-
handle.dispose();
|
|
459
|
-
stream.resolve();
|
|
460
|
-
d.dispose();
|
|
461
|
-
});
|
|
462
|
-
return {
|
|
463
|
-
range: edit.range,
|
|
464
|
-
newText: stream.asyncIterable
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
let LiveStrategy3 = LiveStrategy3_1 = class LiveStrategy3 extends EditModeStrategy {
|
|
468
|
-
constructor(_session, _editor, zone, contextKeyService, _storageService, _bulkEditService, _editorWorkerService, _instaService) {
|
|
469
|
-
super(zone);
|
|
470
|
-
this._session = _session;
|
|
471
|
-
this._editor = _editor;
|
|
472
|
-
this._storageService = _storageService;
|
|
473
|
-
this._bulkEditService = _bulkEditService;
|
|
295
|
+
let LiveStrategy = class LiveStrategy extends EditModeStrategy {
|
|
296
|
+
constructor(session, editor, zone, contextKeyService, _editorWorkerService, _instaService) {
|
|
297
|
+
super(session, editor, zone);
|
|
474
298
|
this._editorWorkerService = _editorWorkerService;
|
|
475
299
|
this._instaService = _instaService;
|
|
476
|
-
this.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
300
|
+
this._decoInsertedText = ModelDecorationOptions.register({
|
|
301
|
+
description: 'inline-modified-line',
|
|
302
|
+
className: 'inline-chat-inserted-range-linehighlight',
|
|
303
|
+
isWholeLine: true,
|
|
304
|
+
overviewRuler: {
|
|
305
|
+
position: OverviewRulerLane.Full,
|
|
306
|
+
color: themeColorFromId(overviewRulerInlineChatDiffInserted),
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
this._decoInsertedTextRange = ModelDecorationOptions.register({
|
|
310
|
+
description: 'inline-chat-inserted-range-linehighlight',
|
|
311
|
+
className: 'inline-chat-inserted-range',
|
|
312
|
+
});
|
|
313
|
+
this.acceptHunk = () => super.acceptHunk();
|
|
314
|
+
this.discardHunk = () => super.discardHunk();
|
|
315
|
+
this._hunkDisplayData = ( new Map());
|
|
481
316
|
this._ctxCurrentChangeHasDiff = CTX_INLINE_CHAT_CHANGE_HAS_DIFF.bindTo(contextKeyService);
|
|
482
317
|
this._ctxCurrentChangeShowsDiff = CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF.bindTo(contextKeyService);
|
|
483
|
-
this.
|
|
318
|
+
this._progressiveEditingDecorations = this._editor.createDecorationsCollection();
|
|
484
319
|
this._previewZone = ( new Lazy(
|
|
485
|
-
() => _instaService.createInstance(InlineChatFileCreatePreviewWidget,
|
|
320
|
+
() => _instaService.createInstance(InlineChatFileCreatePreviewWidget, editor)
|
|
486
321
|
));
|
|
487
322
|
}
|
|
488
323
|
dispose() {
|
|
489
324
|
this._resetDiff();
|
|
490
325
|
this._previewZone.rawValue?.dispose();
|
|
491
|
-
this._store.dispose();
|
|
492
326
|
super.dispose();
|
|
493
327
|
}
|
|
494
328
|
_resetDiff() {
|
|
495
329
|
this._ctxCurrentChangeHasDiff.reset();
|
|
496
330
|
this._ctxCurrentChangeShowsDiff.reset();
|
|
497
|
-
this._sessionStore.clear();
|
|
498
|
-
this._modifiedRangesDecorations.clear();
|
|
499
|
-
this._modifiedRangesThatHaveBeenInteractedWith.length = 0;
|
|
500
331
|
this._zone.widget.updateStatus('');
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
332
|
+
this._progressiveEditingDecorations.clear();
|
|
333
|
+
for (const data of ( this._hunkDisplayData.values())) {
|
|
334
|
+
data.remove();
|
|
335
|
+
}
|
|
504
336
|
}
|
|
505
337
|
async apply() {
|
|
506
338
|
this._resetDiff();
|
|
@@ -515,237 +347,34 @@ let LiveStrategy3 = LiveStrategy3_1 = class LiveStrategy3 extends EditModeStrate
|
|
|
515
347
|
await untitledTextModel.save({ reason: 1 });
|
|
516
348
|
}
|
|
517
349
|
}
|
|
518
|
-
|
|
350
|
+
cancel() {
|
|
519
351
|
this._resetDiff();
|
|
520
|
-
|
|
521
|
-
if (modelN.isDisposed()) {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
const targetAltVersion = textModelNSnapshotAltVersion ?? textModelNAltVersion;
|
|
525
|
-
LiveStrategy3_1._undoModelUntil(modelN, targetAltVersion);
|
|
526
|
-
}
|
|
527
|
-
async makeChanges(edits) {
|
|
528
|
-
const cursorStateComputerAndInlineDiffCollection = (undoEdits) => {
|
|
529
|
-
let last = null;
|
|
530
|
-
for (const edit of undoEdits) {
|
|
531
|
-
last = !last || last.isBefore(edit.range.getEndPosition()) ? edit.range.getEndPosition() : last;
|
|
532
|
-
}
|
|
533
|
-
return last && [Selection.fromPositions(last)];
|
|
534
|
-
};
|
|
535
|
-
if (++this._editCount === 1) {
|
|
536
|
-
this._editor.pushUndoStop();
|
|
537
|
-
}
|
|
538
|
-
this._editor.executeEdits('inline-chat-live', edits, cursorStateComputerAndInlineDiffCollection);
|
|
352
|
+
return super.cancel();
|
|
539
353
|
}
|
|
540
354
|
async undoChanges(altVersionId) {
|
|
541
|
-
this._sessionStore.clear();
|
|
542
|
-
this._modifiedRangesDecorations.clear();
|
|
543
|
-
this._modifiedRangesThatHaveBeenInteractedWith.length = 0;
|
|
544
355
|
const { textModelN } = this._session;
|
|
545
|
-
|
|
356
|
+
await undoModelUntil(textModelN, altVersionId);
|
|
546
357
|
}
|
|
547
|
-
async
|
|
548
|
-
|
|
549
|
-
this._editor.pushUndoStop();
|
|
550
|
-
}
|
|
551
|
-
const listener = this._session.textModelN.onDidChangeContent(async () => {
|
|
552
|
-
await this._showDiff(false, false);
|
|
553
|
-
});
|
|
554
|
-
try {
|
|
555
|
-
const durationInSec = opts.duration / 1000;
|
|
556
|
-
for (const edit of edits) {
|
|
557
|
-
const wordCount = countWords(edit.text ?? '');
|
|
558
|
-
const speed = wordCount / durationInSec;
|
|
559
|
-
await performAsyncTextEdit(this._session.textModelN, asProgressiveEdit(edit, speed, opts.token));
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
finally {
|
|
563
|
-
listener.dispose();
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
async _computeDiff() {
|
|
567
|
-
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER, computeMoves: false }, 'advanced');
|
|
568
|
-
if (!diff || diff.changes.length === 0) {
|
|
569
|
-
return { identical: false, quitEarly: false, changes: [], moves: [] };
|
|
570
|
-
}
|
|
571
|
-
const mergedChanges = [diff.changes[0]];
|
|
572
|
-
for (let i = 1; i < diff.changes.length; i++) {
|
|
573
|
-
const lastChange = mergedChanges[mergedChanges.length - 1];
|
|
574
|
-
const thisChange = diff.changes[i];
|
|
575
|
-
if (thisChange.modified.startLineNumber - lastChange.modified.endLineNumberExclusive <= 5) {
|
|
576
|
-
mergedChanges[mergedChanges.length - 1] = ( new DetailedLineRangeMapping(
|
|
577
|
-
lastChange.original.join(thisChange.original),
|
|
578
|
-
lastChange.modified.join(thisChange.modified),
|
|
579
|
-
(lastChange.innerChanges ?? []).concat(thisChange.innerChanges ?? [])
|
|
580
|
-
));
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
mergedChanges.push(thisChange);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
identical: diff.identical,
|
|
588
|
-
quitEarly: diff.quitEarly,
|
|
589
|
-
changes: mergedChanges,
|
|
590
|
-
moves: []
|
|
591
|
-
};
|
|
358
|
+
async makeChanges(edits, obs) {
|
|
359
|
+
return this._makeChanges(edits, obs, undefined, undefined);
|
|
592
360
|
}
|
|
593
|
-
async
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
this._sessionStore.clear();
|
|
599
|
-
this._onDidDiscard.fire();
|
|
600
|
-
}
|
|
601
|
-
return undefined;
|
|
602
|
-
}
|
|
603
|
-
const viewZoneIds = ( new Set());
|
|
604
|
-
const newDecorations = [];
|
|
605
|
-
const mightContainNonBasicASCII = this._session.textModel0.mightContainNonBasicASCII() ?? false;
|
|
606
|
-
const mightContainRTL = this._session.textModel0.mightContainRTL() ?? false;
|
|
607
|
-
const renderOptions = RenderOptions.fromEditor(this._editor);
|
|
608
|
-
let widgetData;
|
|
609
|
-
for (let i = 0; i < diff.changes.length; i++) {
|
|
610
|
-
const { original, modified, innerChanges } = diff.changes[i];
|
|
611
|
-
const modifiedRange = modified.isEmpty
|
|
612
|
-
? ( new Range(
|
|
613
|
-
modified.startLineNumber,
|
|
614
|
-
1,
|
|
615
|
-
modified.startLineNumber,
|
|
616
|
-
this._session.textModelN.getLineLength(modified.startLineNumber)
|
|
617
|
-
))
|
|
618
|
-
: ( new Range(
|
|
619
|
-
modified.startLineNumber,
|
|
620
|
-
1,
|
|
621
|
-
modified.endLineNumberExclusive - 1,
|
|
622
|
-
this._session.textModelN.getLineLength(modified.endLineNumberExclusive - 1)
|
|
623
|
-
));
|
|
624
|
-
const hasBeenInteractedWith = ( this._modifiedRangesThatHaveBeenInteractedWith.some(id => {
|
|
625
|
-
const range = this._session.textModelN.getDecorationRange(id);
|
|
626
|
-
return range && Range.areIntersecting(range, modifiedRange);
|
|
627
|
-
}));
|
|
628
|
-
if (hasBeenInteractedWith) {
|
|
629
|
-
continue;
|
|
361
|
+
async makeProgressiveChanges(edits, obs, opts) {
|
|
362
|
+
const progress = ( new Progress(edits => {
|
|
363
|
+
const newLines = ( new Set());
|
|
364
|
+
for (const edit of edits) {
|
|
365
|
+
LineRange.fromRange(edit.range).forEach(line => newLines.add(line));
|
|
630
366
|
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
range: modifiedRange,
|
|
635
|
-
options: {
|
|
636
|
-
description: 'inline-modified',
|
|
637
|
-
className: 'inline-chat-inserted-range',
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
newDecorations.push({
|
|
641
|
-
range: modifiedRange,
|
|
642
|
-
options: {
|
|
643
|
-
description: 'inline-modified',
|
|
644
|
-
className: 'inline-chat-inserted-range-linehighlight',
|
|
645
|
-
isWholeLine: true
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
}
|
|
367
|
+
const existingRanges = ( this._progressiveEditingDecorations.getRanges().map(LineRange.fromRange));
|
|
368
|
+
for (const existingRange of existingRanges) {
|
|
369
|
+
existingRange.forEach(line => newLines.delete(line));
|
|
649
370
|
}
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
mightContainNonBasicASCII,
|
|
654
|
-
mightContainRTL
|
|
655
|
-
));
|
|
656
|
-
const domNode = document.createElement('div');
|
|
657
|
-
domNode.className = 'inline-chat-original-zone2';
|
|
658
|
-
const result = renderLines(source, renderOptions, [( new InlineDecoration(( new Range(original.startLineNumber, 1, original.startLineNumber, 1)), '', 0 ))], domNode);
|
|
659
|
-
let myViewZoneId = '';
|
|
660
|
-
const myViewZone = {
|
|
661
|
-
afterLineNumber: modifiedRange.startLineNumber - 1,
|
|
662
|
-
heightInLines: result.heightInLines,
|
|
663
|
-
domNode,
|
|
664
|
-
};
|
|
665
|
-
if (isFinalChanges) {
|
|
666
|
-
const [id] = this._modifiedRangesDecorations.append([{ range: modifiedRange, options: this._decoModifiedInteractedWith }]);
|
|
667
|
-
const actions = [
|
|
668
|
-
toAction({
|
|
669
|
-
id: 'accept',
|
|
670
|
-
label: ( localizeWithPath(
|
|
671
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
672
|
-
'accept',
|
|
673
|
-
"Accept"
|
|
674
|
-
)),
|
|
675
|
-
class: ThemeIcon.asClassName(Codicon.check),
|
|
676
|
-
run: () => {
|
|
677
|
-
this._modifiedRangesThatHaveBeenInteractedWith.push(id);
|
|
678
|
-
return this._showDiff(true, true);
|
|
679
|
-
}
|
|
680
|
-
}),
|
|
681
|
-
toAction({
|
|
682
|
-
id: 'discard',
|
|
683
|
-
label: ( localizeWithPath(
|
|
684
|
-
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
685
|
-
'discard',
|
|
686
|
-
"Discard"
|
|
687
|
-
)),
|
|
688
|
-
class: ThemeIcon.asClassName(Codicon.discard),
|
|
689
|
-
run: () => {
|
|
690
|
-
const edits = [];
|
|
691
|
-
for (const innerChange of innerChanges) {
|
|
692
|
-
const originalValue = this._session.textModel0.getValueInRange(innerChange.originalRange);
|
|
693
|
-
edits.push(EditOperation.replace(innerChange.modifiedRange, originalValue));
|
|
694
|
-
}
|
|
695
|
-
this._session.textModelN.pushEditOperations(null, edits, () => null);
|
|
696
|
-
return this._showDiff(true, true);
|
|
697
|
-
}
|
|
698
|
-
}),
|
|
699
|
-
];
|
|
700
|
-
const toggleDiff = !original.isEmpty
|
|
701
|
-
? () => {
|
|
702
|
-
const scrollState = StableEditorScrollState.capture(this._editor);
|
|
703
|
-
if (!( viewZoneIds.has(myViewZoneId))) {
|
|
704
|
-
this._editor.changeViewZones(accessor => {
|
|
705
|
-
myViewZoneId = accessor.addZone(myViewZone);
|
|
706
|
-
viewZoneIds.add(myViewZoneId);
|
|
707
|
-
});
|
|
708
|
-
this._ctxCurrentChangeShowsDiff.set(true);
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
this._editor.changeViewZones(accessor => {
|
|
712
|
-
accessor.removeZone(myViewZoneId);
|
|
713
|
-
viewZoneIds.delete(myViewZoneId);
|
|
714
|
-
});
|
|
715
|
-
this._ctxCurrentChangeShowsDiff.set(false);
|
|
716
|
-
}
|
|
717
|
-
scrollState.restore(this._editor);
|
|
718
|
-
}
|
|
719
|
-
: undefined;
|
|
720
|
-
const zoneLineNumber = this._zone.position.lineNumber;
|
|
721
|
-
const myDistance = zoneLineNumber <= modifiedRange.startLineNumber
|
|
722
|
-
? modifiedRange.startLineNumber - zoneLineNumber
|
|
723
|
-
: zoneLineNumber - modifiedRange.endLineNumber;
|
|
724
|
-
if (!widgetData || widgetData.distance > myDistance) {
|
|
725
|
-
widgetData = { distance: myDistance, position: modifiedRange.getStartPosition().delta(-1), index: i, actions, toggleDiff };
|
|
726
|
-
}
|
|
371
|
+
const newDecorations = [];
|
|
372
|
+
for (const line of newLines) {
|
|
373
|
+
newDecorations.push({ range: ( new Range(line, 1, line, Number.MAX_VALUE)), options: this._decoInsertedText });
|
|
727
374
|
}
|
|
728
|
-
|
|
729
|
-
if (widgetData) {
|
|
730
|
-
this._zone.widget.setExtraButtons(widgetData.actions);
|
|
731
|
-
this._zone.updatePositionAndHeight(widgetData.position);
|
|
732
|
-
this._editor.revealPositionInCenterIfOutsideViewport(widgetData.position);
|
|
733
|
-
this._updateSummaryMessage(diff.changes, widgetData.index);
|
|
734
|
-
this._ctxCurrentChangeHasDiff.set(Boolean(widgetData.toggleDiff));
|
|
735
|
-
this.toggleDiff = widgetData.toggleDiff;
|
|
736
|
-
}
|
|
737
|
-
const decorations = this._editor.createDecorationsCollection(newDecorations);
|
|
738
|
-
this._sessionStore.add(toDisposable(() => {
|
|
739
|
-
decorations.clear();
|
|
740
|
-
this._editor.changeViewZones(accessor => viewZoneIds.forEach(accessor.removeZone, accessor));
|
|
741
|
-
viewZoneIds.clear();
|
|
742
|
-
this._zone.widget.setExtraButtons([]);
|
|
375
|
+
this._progressiveEditingDecorations.append(newDecorations);
|
|
743
376
|
}));
|
|
744
|
-
|
|
745
|
-
this._sessionStore.clear();
|
|
746
|
-
this._onDidAccept.fire();
|
|
747
|
-
}
|
|
748
|
-
return widgetData?.position;
|
|
377
|
+
return this._makeChanges(edits, obs, opts, progress);
|
|
749
378
|
}
|
|
750
379
|
async renderChanges(response) {
|
|
751
380
|
if (response.untitledTextModel && !response.untitledTextModel.isDisposed()) {
|
|
@@ -754,24 +383,158 @@ let LiveStrategy3 = LiveStrategy3_1 = class LiveStrategy3 extends EditModeStrate
|
|
|
754
383
|
else {
|
|
755
384
|
this._previewZone.value.hide();
|
|
756
385
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
386
|
+
this._progressiveEditingDecorations.clear();
|
|
387
|
+
const renderHunks = () => {
|
|
388
|
+
let widgetData;
|
|
389
|
+
changeDecorationsAndViewZones(this._editor, (decorationsAccessor, viewZoneAccessor) => {
|
|
390
|
+
const keysNow = ( new Set(( this._hunkDisplayData.keys())));
|
|
391
|
+
widgetData = undefined;
|
|
392
|
+
for (const hunkData of this._session.hunkData.getInfo()) {
|
|
393
|
+
keysNow.delete(hunkData);
|
|
394
|
+
const hunkRanges = hunkData.getRangesN();
|
|
395
|
+
let data = this._hunkDisplayData.get(hunkData);
|
|
396
|
+
if (!data) {
|
|
397
|
+
const decorationIds = [];
|
|
398
|
+
for (let i = 0; i < hunkRanges.length; i++) {
|
|
399
|
+
decorationIds.push(decorationsAccessor.addDecoration(hunkRanges[i], i === 0
|
|
400
|
+
? this._decoInsertedText
|
|
401
|
+
: this._decoInsertedTextRange));
|
|
402
|
+
}
|
|
403
|
+
const acceptHunk = () => {
|
|
404
|
+
hunkData.acceptChanges();
|
|
405
|
+
renderHunks();
|
|
406
|
+
};
|
|
407
|
+
const discardHunk = () => {
|
|
408
|
+
hunkData.discardChanges();
|
|
409
|
+
renderHunks();
|
|
410
|
+
};
|
|
411
|
+
const mightContainNonBasicASCII = this._session.textModel0.mightContainNonBasicASCII();
|
|
412
|
+
const mightContainRTL = this._session.textModel0.mightContainRTL();
|
|
413
|
+
const renderOptions = RenderOptions.fromEditor(this._editor);
|
|
414
|
+
const originalRange = hunkData.getRanges0()[0];
|
|
415
|
+
const source = ( new LineSource(
|
|
416
|
+
LineRange.fromRangeInclusive(originalRange).mapToLineArray(l => this._session.textModel0.tokenization.getLineTokens(l)),
|
|
417
|
+
[],
|
|
418
|
+
mightContainNonBasicASCII,
|
|
419
|
+
mightContainRTL
|
|
420
|
+
));
|
|
421
|
+
const domNode = document.createElement('div');
|
|
422
|
+
domNode.className = 'inline-chat-original-zone2';
|
|
423
|
+
const result = renderLines(source, renderOptions, [( new InlineDecoration(( new Range(originalRange.startLineNumber, 1, originalRange.startLineNumber, 1)), '', 0 ))], domNode);
|
|
424
|
+
const viewZoneData = {
|
|
425
|
+
afterLineNumber: -1,
|
|
426
|
+
heightInLines: result.heightInLines,
|
|
427
|
+
domNode,
|
|
428
|
+
};
|
|
429
|
+
const toggleDiff = () => {
|
|
430
|
+
const scrollState = StableEditorScrollState.capture(this._editor);
|
|
431
|
+
changeDecorationsAndViewZones(this._editor, (_decorationsAccessor, viewZoneAccessor) => {
|
|
432
|
+
assertType(data);
|
|
433
|
+
if (!data.viewZoneId) {
|
|
434
|
+
const [hunkRange] = hunkData.getRangesN();
|
|
435
|
+
viewZoneData.afterLineNumber = hunkRange.startLineNumber - 1;
|
|
436
|
+
data.viewZoneId = viewZoneAccessor.addZone(viewZoneData);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
viewZoneAccessor.removeZone(data.viewZoneId);
|
|
440
|
+
data.viewZoneId = undefined;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
this._ctxCurrentChangeShowsDiff.set(typeof data?.viewZoneId === 'number');
|
|
444
|
+
scrollState.restore(this._editor);
|
|
445
|
+
};
|
|
446
|
+
const remove = () => {
|
|
447
|
+
changeDecorationsAndViewZones(this._editor, (decorationsAccessor, viewZoneAccessor) => {
|
|
448
|
+
assertType(data);
|
|
449
|
+
for (const decorationId of data.decorationIds) {
|
|
450
|
+
decorationsAccessor.removeDecoration(decorationId);
|
|
451
|
+
}
|
|
452
|
+
if (data.viewZoneId) {
|
|
453
|
+
viewZoneAccessor.removeZone(data.viewZoneId);
|
|
454
|
+
}
|
|
455
|
+
data.decorationIds = [];
|
|
456
|
+
data.viewZoneId = undefined;
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
const zoneLineNumber = this._zone.position.lineNumber;
|
|
460
|
+
const myDistance = zoneLineNumber <= hunkRanges[0].startLineNumber
|
|
461
|
+
? hunkRanges[0].startLineNumber - zoneLineNumber
|
|
462
|
+
: zoneLineNumber - hunkRanges[0].endLineNumber;
|
|
463
|
+
data = {
|
|
464
|
+
decorationIds,
|
|
465
|
+
viewZoneId: '',
|
|
466
|
+
viewZone: viewZoneData,
|
|
467
|
+
distance: myDistance,
|
|
468
|
+
position: hunkRanges[0].getStartPosition().delta(-1),
|
|
469
|
+
acceptHunk,
|
|
470
|
+
discardHunk,
|
|
471
|
+
toggleDiff: !hunkData.isInsertion() ? toggleDiff : undefined,
|
|
472
|
+
remove,
|
|
473
|
+
};
|
|
474
|
+
this._hunkDisplayData.set(hunkData, data);
|
|
475
|
+
}
|
|
476
|
+
else if (hunkData.getState() !== 0 ) {
|
|
477
|
+
data.remove();
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
const zoneLineNumber = this._zone.position.lineNumber;
|
|
481
|
+
const modifiedRangeNow = hunkRanges[0];
|
|
482
|
+
data.position = modifiedRangeNow.getStartPosition().delta(-1);
|
|
483
|
+
data.distance = zoneLineNumber <= modifiedRangeNow.startLineNumber
|
|
484
|
+
? modifiedRangeNow.startLineNumber - zoneLineNumber
|
|
485
|
+
: zoneLineNumber - modifiedRangeNow.endLineNumber;
|
|
486
|
+
}
|
|
487
|
+
if (hunkData.getState() === 0 && (!widgetData || data.distance < widgetData.distance)) {
|
|
488
|
+
widgetData = data;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
for (const key of keysNow) {
|
|
492
|
+
const data = this._hunkDisplayData.get(key);
|
|
493
|
+
if (data) {
|
|
494
|
+
this._hunkDisplayData.delete(key);
|
|
495
|
+
data.remove();
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
if (widgetData) {
|
|
500
|
+
this._zone.updatePositionAndHeight(widgetData.position);
|
|
501
|
+
this._editor.revealPositionInCenterIfOutsideViewport(widgetData.position);
|
|
502
|
+
const remainingHunks = this._session.hunkData.pending;
|
|
503
|
+
this._updateSummaryMessage(remainingHunks);
|
|
504
|
+
this._ctxCurrentChangeHasDiff.set(Boolean(widgetData.toggleDiff));
|
|
505
|
+
this.toggleDiff = widgetData.toggleDiff;
|
|
506
|
+
this.acceptHunk = async () => widgetData.acceptHunk();
|
|
507
|
+
this.discardHunk = async () => widgetData.discardHunk();
|
|
508
|
+
}
|
|
509
|
+
else if (this._hunkDisplayData.size > 0) {
|
|
510
|
+
let oneAccepted = false;
|
|
511
|
+
for (const hunkData of this._session.hunkData.getInfo()) {
|
|
512
|
+
if (hunkData.getState() === 1 ) {
|
|
513
|
+
oneAccepted = true;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (oneAccepted) {
|
|
518
|
+
this._onDidAccept.fire();
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
this._onDidDiscard.fire();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return widgetData;
|
|
525
|
+
};
|
|
526
|
+
return renderHunks()?.position;
|
|
763
527
|
}
|
|
764
|
-
_updateSummaryMessage(
|
|
765
|
-
const changesCount = mappings.length;
|
|
528
|
+
_updateSummaryMessage(hunkCount) {
|
|
766
529
|
let message;
|
|
767
|
-
if (
|
|
530
|
+
if (hunkCount === 0) {
|
|
768
531
|
message = ( localizeWithPath(
|
|
769
532
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
770
533
|
'change.0',
|
|
771
534
|
"Nothing changed"
|
|
772
535
|
));
|
|
773
536
|
}
|
|
774
|
-
else if (
|
|
537
|
+
else if (hunkCount === 1) {
|
|
775
538
|
message = ( localizeWithPath(
|
|
776
539
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
777
540
|
'change.1',
|
|
@@ -782,25 +545,34 @@ let LiveStrategy3 = LiveStrategy3_1 = class LiveStrategy3 extends EditModeStrate
|
|
|
782
545
|
message = ( localizeWithPath(
|
|
783
546
|
'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies',
|
|
784
547
|
'lines.NM',
|
|
785
|
-
"{
|
|
786
|
-
|
|
787
|
-
changesCount
|
|
548
|
+
"{0} changes",
|
|
549
|
+
hunkCount
|
|
788
550
|
));
|
|
789
551
|
}
|
|
790
552
|
this._zone.widget.updateStatus(message);
|
|
791
553
|
}
|
|
792
|
-
needsMargin() {
|
|
793
|
-
return true;
|
|
794
|
-
}
|
|
795
554
|
hasFocus() {
|
|
796
555
|
return this._zone.widget.hasFocus();
|
|
797
556
|
}
|
|
557
|
+
getWholeRangeDecoration() {
|
|
558
|
+
return [];
|
|
559
|
+
}
|
|
798
560
|
};
|
|
799
|
-
|
|
561
|
+
LiveStrategy = ( __decorate([
|
|
800
562
|
( __param(3, IContextKeyService)),
|
|
801
|
-
( __param(4,
|
|
802
|
-
( __param(5,
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
563
|
+
( __param(4, IEditorWorkerService)),
|
|
564
|
+
( __param(5, IInstantiationService))
|
|
565
|
+
], LiveStrategy));
|
|
566
|
+
async function undoModelUntil(model, targetAltVersion) {
|
|
567
|
+
while (targetAltVersion < model.getAlternativeVersionId() && model.canUndo()) {
|
|
568
|
+
await model.undo();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function changeDecorationsAndViewZones(editor, callback) {
|
|
572
|
+
editor.changeDecorations(decorationsAccessor => {
|
|
573
|
+
editor.changeViewZones(viewZoneAccessor => {
|
|
574
|
+
callback(decorationsAccessor, viewZoneAccessor);
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
export { EditModeStrategy, LivePreviewStrategy, LiveStrategy, PreviewStrategy };
|