@codingame/monaco-vscode-api 1.85.0 → 1.85.2
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 +31 -13
- package/contributions.js +1 -0
- package/missing-services.js +396 -68
- package/monaco-editor-treemending.patch +957 -950
- package/package.json +8 -7
- package/service-override/tools/editor.js +1 -1
- package/services.js +10 -6
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +14 -0
- 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/extensionEnablementService.js +140 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1062 -93
- package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +220 -0
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
- package/vscode/src/vs/platform/quickinput/browser/quickPickPin.js +102 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
- package/vscode/src/vs/platform/userDataSync/common/content.js +9 -0
- package/vscode/src/vs/platform/userDataSync/common/settingsMerge.js +514 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +154 -2
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +43 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncMachines.js +177 -0
- package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostWebview.js +2 -2
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +105 -0
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +1614 -0
- 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/codeEditor/browser/languageConfigurationExtensionPoint.js +7 -7
- 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/files/browser/explorerViewlet.js +73 -2
- 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/tasks/common/taskDefinitionRegistry.js +6 -6
- package/vscode/src/vs/workbench/contrib/tasks/common/taskService.js +12 -2
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +712 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +130 -0
- 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/authentication/browser/authenticationService.js +20 -1
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +205 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +11 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +9 -9
- package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +1 -1
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingEditing.js +2 -2
- package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.js +24 -1
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorInput.js +41 -0
- package/vscode/src/vs/workbench/services/preferences/browser/keybindingsEditorModel.js +588 -0
- package/vscode/src/vs/workbench/services/preferences/common/preferencesEditorInput.js +43 -0
- 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/search/common/search.js +3 -3
- package/vscode/src/vs/workbench/services/terminal/common/embedderTerminalService.js +75 -1
- package/vscode/src/vs/workbench/services/timer/browser/timerService.js +240 -1
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +31 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfile.js +25 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +75 -1
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +74 -4
- 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
- package/vscode/src/vs/base/parts/request/browser/request.js +0 -60
- package/vscode/src/vs/platform/request/browser/requestService.js +0 -28
- package/vscode/src/vs/platform/request/common/requestIpc.js +0 -17
- package/vscode/src/vs/platform/url/common/urlService.js +0 -17
- package/vscode/src/vs/workbench/services/configuration/common/jsonEditingService.js +0 -120
- package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +0 -319
- package/vscode/src/vs/workbench/services/files/browser/elevatedFileService.js +0 -9
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +0 -408
- package/vscode/src/vs/workbench/services/request/browser/requestService.js +0 -48
- package/vscode/src/vs/workbench/services/textfile/browser/browserTextFileService.js +0 -56
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +0 -639
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModelManager.js +0 -402
- package/vscode/src/vs/workbench/services/textfile/common/textFileSaveParticipant.js +0 -62
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +0 -38
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +0 -295
- package/vscode/src/vs/workbench/services/url/browser/urlService.js +0 -47
- package/vscode/src/vs/workbench/services/views/common/treeViewsService.js +0 -20
- package/vscode/src/vs/workbench/services/workspaces/common/canonicalUriService.js +0 -19
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { renderMarkdownAsPlaintext } from 'monaco-editor/esm/vs/base/browser/markdownRenderer.js';
|
|
3
|
+
import * as aria from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
4
|
+
import { coalesceInPlace } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
5
|
+
import { raceCancellationError, raceCancellation, Barrier, Queue } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
6
|
+
import { CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
7
|
+
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
8
|
+
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
9
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
10
|
+
import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
11
|
+
import { Lazy } from 'monaco-editor/esm/vs/base/common/lazy.js';
|
|
12
|
+
import { DisposableStore, MutableDisposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
13
|
+
import { MovingAverage } from 'monaco-editor/esm/vs/base/common/numbers.js';
|
|
14
|
+
import { StopWatch } from 'monaco-editor/esm/vs/base/common/stopwatch.js';
|
|
15
|
+
import { assertType } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
16
|
+
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
17
|
+
import { IBulkEditService } from 'monaco-editor/esm/vs/editor/browser/services/bulkEditService.js';
|
|
18
|
+
import { Position } from 'monaco-editor/esm/vs/editor/common/core/position.js';
|
|
19
|
+
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
20
|
+
import { Selection } from 'monaco-editor/esm/vs/editor/common/core/selection.js';
|
|
21
|
+
import { TextEdit } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
22
|
+
import { ModelDecorationOptions } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
|
|
23
|
+
import { IEditorWorkerService } from 'monaco-editor/esm/vs/editor/common/services/editorWorker.js';
|
|
24
|
+
import { InlineCompletionsController } from 'monaco-editor/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController.js';
|
|
25
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
26
|
+
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
|
|
27
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
28
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
29
|
+
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
30
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
31
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
32
|
+
import { Progress } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
33
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
34
|
+
import { IChatWidgetService, IChatAccessibilityService } from '../../chat/browser/chat.js';
|
|
35
|
+
import { IChatAgentService } from '../../chat/common/chatAgents.js';
|
|
36
|
+
import { chatSubcommandLeader, chatAgentLeader } from '../../chat/common/chatParserTypes.js';
|
|
37
|
+
import { IChatService } from '../../chat/common/chatService.js';
|
|
38
|
+
import { ReplyResponse, SessionPrompt, SessionExchange, EmptyResponse, ErrorResponse, ExpansionState, IInlineChatSessionService } from './inlineChatSession.js';
|
|
39
|
+
import { LivePreviewStrategy, PreviewStrategy, LiveStrategy3, LiveStrategy } from './inlineChatStrategies.js';
|
|
40
|
+
import { InlineChatZoneWidget } from './inlineChatWidget.js';
|
|
41
|
+
import { INLINE_CHAT_ID, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, CTX_INLINE_CHAT_HAS_STASHED_SESSION } from '../common/inlineChat.js';
|
|
42
|
+
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
|
|
43
|
+
var InlineChatController_1;
|
|
44
|
+
class InlineChatRunOptions {
|
|
45
|
+
static isInteractiveEditorOptions(options) {
|
|
46
|
+
const { initialSelection, initialRange, message, autoSend, position } = options;
|
|
47
|
+
if (typeof message !== 'undefined' && typeof message !== 'string'
|
|
48
|
+
|| typeof autoSend !== 'undefined' && typeof autoSend !== 'boolean'
|
|
49
|
+
|| typeof initialRange !== 'undefined' && !Range.isIRange(initialRange)
|
|
50
|
+
|| typeof initialSelection !== 'undefined' && !Selection.isISelection(initialSelection)
|
|
51
|
+
|| typeof position !== 'undefined' && !Position.isIPosition(position)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let InlineChatController = class InlineChatController {
|
|
58
|
+
static { InlineChatController_1 = this; }
|
|
59
|
+
static get(editor) {
|
|
60
|
+
return editor.getContribution(INLINE_CHAT_ID);
|
|
61
|
+
}
|
|
62
|
+
static { this._decoBlock = ModelDecorationOptions.register({
|
|
63
|
+
description: 'inline-chat',
|
|
64
|
+
showIfCollapsed: false,
|
|
65
|
+
isWholeLine: true,
|
|
66
|
+
className: 'inline-chat-block-selection',
|
|
67
|
+
}); }
|
|
68
|
+
static { this._storageKey = 'inline-chat-history'; }
|
|
69
|
+
static { this._promptHistory = []; }
|
|
70
|
+
constructor(_editor, _instaService, _inlineChatSessionService, _editorWorkerService, _logService, _configurationService, _dialogService, contextKeyService, _accessibilityService, _chatAccessibilityService, _chatAgentService, _bulkEditService, _storageService) {
|
|
71
|
+
this._editor = _editor;
|
|
72
|
+
this._instaService = _instaService;
|
|
73
|
+
this._inlineChatSessionService = _inlineChatSessionService;
|
|
74
|
+
this._editorWorkerService = _editorWorkerService;
|
|
75
|
+
this._logService = _logService;
|
|
76
|
+
this._configurationService = _configurationService;
|
|
77
|
+
this._dialogService = _dialogService;
|
|
78
|
+
this._accessibilityService = _accessibilityService;
|
|
79
|
+
this._chatAccessibilityService = _chatAccessibilityService;
|
|
80
|
+
this._chatAgentService = _chatAgentService;
|
|
81
|
+
this._bulkEditService = _bulkEditService;
|
|
82
|
+
this._storageService = _storageService;
|
|
83
|
+
this._historyOffset = -1;
|
|
84
|
+
this._store = ( new DisposableStore());
|
|
85
|
+
this._messages = this._store.add(( new Emitter()));
|
|
86
|
+
this._onWillStartSession = this._store.add(( new Emitter()));
|
|
87
|
+
this.onWillStartSession = this._onWillStartSession.event;
|
|
88
|
+
this.onDidAcceptInput = Event.filter(this._messages.event, m => m === 32 , this._store);
|
|
89
|
+
this.onDidCancelInput = Event.filter(this._messages.event, m => m === 16 || m === 2 , this._store);
|
|
90
|
+
this._sessionStore = this._store.add(( new DisposableStore()));
|
|
91
|
+
this._stashedSession = this._store.add(( new MutableDisposable()));
|
|
92
|
+
this._ignoreModelContentChanged = false;
|
|
93
|
+
this._forcedPlaceholder = undefined;
|
|
94
|
+
this._ctxHasActiveRequest = CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.bindTo(contextKeyService);
|
|
95
|
+
this._ctxDidEdit = CTX_INLINE_CHAT_DID_EDIT.bindTo(contextKeyService);
|
|
96
|
+
this._ctxUserDidEdit = CTX_INLINE_CHAT_USER_DID_EDIT.bindTo(contextKeyService);
|
|
97
|
+
this._ctxResponseTypes = CTX_INLINE_CHAT_RESPONSE_TYPES.bindTo(contextKeyService);
|
|
98
|
+
this._ctxLastResponseType = CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.bindTo(contextKeyService);
|
|
99
|
+
this._ctxLastFeedbackKind = CTX_INLINE_CHAT_LAST_FEEDBACK.bindTo(contextKeyService);
|
|
100
|
+
this._ctxSupportIssueReporting = CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING.bindTo(contextKeyService);
|
|
101
|
+
this._zone = ( new Lazy(
|
|
102
|
+
() => this._store.add(_instaService.createInstance(InlineChatZoneWidget, this._editor))
|
|
103
|
+
));
|
|
104
|
+
this._store.add(this._editor.onDidChangeModel(async (e) => {
|
|
105
|
+
if (this._activeSession || !e.newModelUrl) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const existingSession = this._inlineChatSessionService.getSession(this._editor, e.newModelUrl);
|
|
109
|
+
if (!existingSession) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this._log('session RESUMING', e);
|
|
113
|
+
await this.run({ existingSession });
|
|
114
|
+
this._log('session done or paused');
|
|
115
|
+
}));
|
|
116
|
+
this._log('NEW controller');
|
|
117
|
+
InlineChatController_1._promptHistory = JSON.parse(_storageService.get(InlineChatController_1._storageKey, 0 , '[]'));
|
|
118
|
+
this._historyUpdate = (prompt) => {
|
|
119
|
+
const idx = InlineChatController_1._promptHistory.indexOf(prompt);
|
|
120
|
+
if (idx >= 0) {
|
|
121
|
+
InlineChatController_1._promptHistory.splice(idx, 1);
|
|
122
|
+
}
|
|
123
|
+
InlineChatController_1._promptHistory.unshift(prompt);
|
|
124
|
+
this._historyOffset = -1;
|
|
125
|
+
this._storageService.store(InlineChatController_1._storageKey, JSON.stringify(InlineChatController_1._promptHistory), 0 , 0 );
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
dispose() {
|
|
129
|
+
this._strategy?.dispose();
|
|
130
|
+
this._stashedSession.clear();
|
|
131
|
+
if (this._activeSession) {
|
|
132
|
+
this._inlineChatSessionService.releaseSession(this._activeSession);
|
|
133
|
+
}
|
|
134
|
+
this._store.dispose();
|
|
135
|
+
this._log('controller disposed');
|
|
136
|
+
}
|
|
137
|
+
_log(message, ...more) {
|
|
138
|
+
if (message instanceof Error) {
|
|
139
|
+
this._logService.error(message, ...more);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this._logService.trace(`[IE] (editor:${this._editor.getId()})${message}`, ...more);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
getMessage() {
|
|
146
|
+
return this._zone.value.widget.responseContent;
|
|
147
|
+
}
|
|
148
|
+
getId() {
|
|
149
|
+
return INLINE_CHAT_ID;
|
|
150
|
+
}
|
|
151
|
+
_getMode() {
|
|
152
|
+
const editMode = this._configurationService.inspect('inlineChat.mode');
|
|
153
|
+
let editModeValue = editMode.value;
|
|
154
|
+
if (this._accessibilityService.isScreenReaderOptimized() && editModeValue === editMode.defaultValue) {
|
|
155
|
+
editModeValue = "preview" ;
|
|
156
|
+
}
|
|
157
|
+
return editModeValue;
|
|
158
|
+
}
|
|
159
|
+
getWidgetPosition() {
|
|
160
|
+
return this._zone.value.position;
|
|
161
|
+
}
|
|
162
|
+
async run(options = {}) {
|
|
163
|
+
try {
|
|
164
|
+
this.finishExistingSession();
|
|
165
|
+
if (this._currentRun) {
|
|
166
|
+
await this._currentRun;
|
|
167
|
+
}
|
|
168
|
+
this._stashedSession.clear();
|
|
169
|
+
if (options.initialSelection) {
|
|
170
|
+
this._editor.setSelection(options.initialSelection);
|
|
171
|
+
}
|
|
172
|
+
this._onWillStartSession.fire();
|
|
173
|
+
this._currentRun = this._nextState("CREATE_SESSION" , options);
|
|
174
|
+
await this._currentRun;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
onUnexpectedError(error);
|
|
178
|
+
if (this._activeSession) {
|
|
179
|
+
this._inlineChatSessionService.releaseSession(this._activeSession);
|
|
180
|
+
}
|
|
181
|
+
this["PAUSE" ]();
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
this._currentRun = undefined;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
joinCurrentRun() {
|
|
188
|
+
return this._currentRun;
|
|
189
|
+
}
|
|
190
|
+
_showWidget(initialRender = false, position) {
|
|
191
|
+
assertType(this._editor.hasModel());
|
|
192
|
+
let widgetPosition;
|
|
193
|
+
if (position) {
|
|
194
|
+
widgetPosition = position;
|
|
195
|
+
}
|
|
196
|
+
else if (this._zone.value.position) {
|
|
197
|
+
if (this._zone.value.position.lineNumber === 1) {
|
|
198
|
+
widgetPosition = this._zone.value.position.delta(-1);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
widgetPosition = this._zone.value.position;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
widgetPosition = this._editor.getSelection().getStartPosition().delta(-1);
|
|
206
|
+
}
|
|
207
|
+
let needsMargin = false;
|
|
208
|
+
if (initialRender) {
|
|
209
|
+
this._zone.value.setContainerMargins();
|
|
210
|
+
}
|
|
211
|
+
if (this._activeSession && !position && (this._activeSession.hasChangedText || this._activeSession.lastExchange)) {
|
|
212
|
+
widgetPosition = this._activeSession.wholeRange.value.getStartPosition().delta(-1);
|
|
213
|
+
}
|
|
214
|
+
if (this._activeSession) {
|
|
215
|
+
this._zone.value.updateBackgroundColor(widgetPosition, this._activeSession.wholeRange.value);
|
|
216
|
+
}
|
|
217
|
+
if (this._strategy) {
|
|
218
|
+
needsMargin = this._strategy.needsMargin();
|
|
219
|
+
}
|
|
220
|
+
if (!this._zone.value.position) {
|
|
221
|
+
this._zone.value.setWidgetMargins(widgetPosition, !needsMargin ? 0 : undefined);
|
|
222
|
+
this._zone.value.show(widgetPosition);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
this._zone.value.updatePositionAndHeight(widgetPosition);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async _nextState(state, options) {
|
|
229
|
+
let nextState = state;
|
|
230
|
+
while (nextState) {
|
|
231
|
+
this._log('setState to ', nextState);
|
|
232
|
+
nextState = await this[nextState](options);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async ["CREATE_SESSION" ](options) {
|
|
236
|
+
assertType(this._activeSession === undefined);
|
|
237
|
+
assertType(this._editor.hasModel());
|
|
238
|
+
let session = options.existingSession;
|
|
239
|
+
let initPosition;
|
|
240
|
+
if (options.position) {
|
|
241
|
+
initPosition = Position.lift(options.position).delta(-1);
|
|
242
|
+
delete options.position;
|
|
243
|
+
}
|
|
244
|
+
this._showWidget(true, initPosition);
|
|
245
|
+
this._zone.value.widget.updateInfo(( localizeWithPath(
|
|
246
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
247
|
+
'welcome.1',
|
|
248
|
+
"AI-generated code may be incorrect"
|
|
249
|
+
)));
|
|
250
|
+
this._updatePlaceholder();
|
|
251
|
+
if (!session) {
|
|
252
|
+
const createSessionCts = ( new CancellationTokenSource());
|
|
253
|
+
const msgListener = Event.once(this._messages.event)(m => {
|
|
254
|
+
this._log('state=_createSession) message received', m);
|
|
255
|
+
if (m === 32 ) {
|
|
256
|
+
options.autoSend = true;
|
|
257
|
+
this._zone.value.widget.updateProgress(true);
|
|
258
|
+
this._zone.value.widget.updateInfo(( localizeWithPath(
|
|
259
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
260
|
+
'welcome.2',
|
|
261
|
+
"Getting ready..."
|
|
262
|
+
)));
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
createSessionCts.cancel();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
session = await this._inlineChatSessionService.createSession(this._editor, { editMode: this._getMode(), wholeRange: options.initialRange }, createSessionCts.token);
|
|
269
|
+
createSessionCts.dispose();
|
|
270
|
+
msgListener.dispose();
|
|
271
|
+
if (createSessionCts.token.isCancellationRequested) {
|
|
272
|
+
return "PAUSE" ;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
delete options.initialRange;
|
|
276
|
+
delete options.existingSession;
|
|
277
|
+
if (!session) {
|
|
278
|
+
this._dialogService.info(( localizeWithPath(
|
|
279
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
280
|
+
'create.fail',
|
|
281
|
+
"Failed to start editor chat"
|
|
282
|
+
)), ( localizeWithPath(
|
|
283
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
284
|
+
'create.fail.detail',
|
|
285
|
+
"Please consult the error log and try again later."
|
|
286
|
+
)));
|
|
287
|
+
return "CANCEL" ;
|
|
288
|
+
}
|
|
289
|
+
switch (session.editMode) {
|
|
290
|
+
case "live" :
|
|
291
|
+
this._strategy = this._instaService.createInstance(LiveStrategy, session, this._editor, this._zone.value);
|
|
292
|
+
break;
|
|
293
|
+
case "live3" :
|
|
294
|
+
this._strategy = this._instaService.createInstance(LiveStrategy3, session, this._editor, this._zone.value);
|
|
295
|
+
break;
|
|
296
|
+
case "preview" :
|
|
297
|
+
this._strategy = this._instaService.createInstance(PreviewStrategy, session, this._zone.value);
|
|
298
|
+
break;
|
|
299
|
+
case "livePreview" :
|
|
300
|
+
default:
|
|
301
|
+
this._strategy = this._instaService.createInstance(LivePreviewStrategy, session, this._editor, this._zone.value);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
this._activeSession = session;
|
|
305
|
+
return "INIT_UI" ;
|
|
306
|
+
}
|
|
307
|
+
async ["INIT_UI" ](options) {
|
|
308
|
+
assertType(this._activeSession);
|
|
309
|
+
assertType(this._strategy);
|
|
310
|
+
InlineCompletionsController.get(this._editor)?.hide();
|
|
311
|
+
this._sessionStore.clear();
|
|
312
|
+
const wholeRangeDecoration = this._editor.createDecorationsCollection();
|
|
313
|
+
const updateWholeRangeDecoration = () => {
|
|
314
|
+
const ranges = [this._activeSession.wholeRange.value];
|
|
315
|
+
const newDecorations = ( ranges.map(
|
|
316
|
+
range => range.isEmpty() ? undefined : ({ range, options: InlineChatController_1._decoBlock })
|
|
317
|
+
));
|
|
318
|
+
coalesceInPlace(newDecorations);
|
|
319
|
+
wholeRangeDecoration.set(newDecorations);
|
|
320
|
+
};
|
|
321
|
+
this._sessionStore.add(toDisposable(() => wholeRangeDecoration.clear()));
|
|
322
|
+
this._sessionStore.add(this._activeSession.wholeRange.onDidChange(updateWholeRangeDecoration));
|
|
323
|
+
updateWholeRangeDecoration();
|
|
324
|
+
this._zone.value.widget.updateSlashCommands(this._activeSession.session.slashCommands ?? []);
|
|
325
|
+
this._updatePlaceholder();
|
|
326
|
+
this._zone.value.widget.updateInfo(this._activeSession.session.message ?? ( localizeWithPath(
|
|
327
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
328
|
+
'welcome.1',
|
|
329
|
+
"AI-generated code may be incorrect"
|
|
330
|
+
)));
|
|
331
|
+
this._zone.value.widget.preferredExpansionState = this._activeSession.lastExpansionState;
|
|
332
|
+
this._zone.value.widget.value = this._activeSession.session.input ?? this._activeSession.lastInput?.value ?? this._zone.value.widget.value;
|
|
333
|
+
if (this._activeSession.session.input) {
|
|
334
|
+
this._zone.value.widget.selectAll();
|
|
335
|
+
}
|
|
336
|
+
this._showWidget(true);
|
|
337
|
+
this._sessionStore.add(this._editor.onDidChangeModel((e) => {
|
|
338
|
+
const msg = this._activeSession?.lastExchange
|
|
339
|
+
? 4
|
|
340
|
+
: 2 ;
|
|
341
|
+
this._log('model changed, pause or cancel session', msg, e);
|
|
342
|
+
this._messages.fire(msg);
|
|
343
|
+
}));
|
|
344
|
+
const altVersionNow = this._editor.getModel()?.getAlternativeVersionId();
|
|
345
|
+
this._sessionStore.add(this._editor.onDidChangeModelContent(e => {
|
|
346
|
+
if (!this._ignoreModelContentChanged && this._strategy?.hasFocus()) {
|
|
347
|
+
this._ctxUserDidEdit.set(altVersionNow !== this._editor.getModel()?.getAlternativeVersionId());
|
|
348
|
+
}
|
|
349
|
+
if (this._ignoreModelContentChanged || this._strategy?.hasFocus()) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const wholeRange = this._activeSession.wholeRange;
|
|
353
|
+
let editIsOutsideOfWholeRange = false;
|
|
354
|
+
for (const { range } of e.changes) {
|
|
355
|
+
editIsOutsideOfWholeRange = !Range.areIntersectingOrTouching(range, wholeRange.value);
|
|
356
|
+
}
|
|
357
|
+
this._activeSession.recordExternalEditOccurred(editIsOutsideOfWholeRange);
|
|
358
|
+
if (editIsOutsideOfWholeRange) {
|
|
359
|
+
this._log('text changed outside of whole range, FINISH session');
|
|
360
|
+
this.finishExistingSession();
|
|
361
|
+
}
|
|
362
|
+
}));
|
|
363
|
+
this._ctxSupportIssueReporting.set(this._activeSession.provider.supportIssueReporting ?? false);
|
|
364
|
+
if (!this._activeSession.lastExchange) {
|
|
365
|
+
return "WAIT_FOR_INPUT" ;
|
|
366
|
+
}
|
|
367
|
+
else if (options.isUnstashed) {
|
|
368
|
+
delete options.isUnstashed;
|
|
369
|
+
return "APPLY_RESPONSE" ;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
return "SHOW_RESPONSE" ;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
setPlaceholder(text) {
|
|
376
|
+
this._forcedPlaceholder = text;
|
|
377
|
+
this._updatePlaceholder();
|
|
378
|
+
}
|
|
379
|
+
resetPlaceholder() {
|
|
380
|
+
this._forcedPlaceholder = undefined;
|
|
381
|
+
this._updatePlaceholder();
|
|
382
|
+
}
|
|
383
|
+
_updatePlaceholder() {
|
|
384
|
+
this._zone.value.widget.placeholder = this._getPlaceholderText();
|
|
385
|
+
}
|
|
386
|
+
_getPlaceholderText() {
|
|
387
|
+
return this._forcedPlaceholder ?? this._activeSession?.session.placeholder ?? ( localizeWithPath(
|
|
388
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
389
|
+
'default.placeholder',
|
|
390
|
+
"Ask a question"
|
|
391
|
+
));
|
|
392
|
+
}
|
|
393
|
+
async ["WAIT_FOR_INPUT" ](options) {
|
|
394
|
+
assertType(this._activeSession);
|
|
395
|
+
assertType(this._strategy);
|
|
396
|
+
this._updatePlaceholder();
|
|
397
|
+
if (options.message) {
|
|
398
|
+
this.updateInput(options.message);
|
|
399
|
+
aria.alert(options.message);
|
|
400
|
+
delete options.message;
|
|
401
|
+
}
|
|
402
|
+
let message = 0 ;
|
|
403
|
+
if (options.autoSend) {
|
|
404
|
+
message = 32 ;
|
|
405
|
+
delete options.autoSend;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
const barrier = ( new Barrier());
|
|
409
|
+
const store = ( new DisposableStore());
|
|
410
|
+
store.add(this._strategy.onDidAccept(() => this.acceptSession()));
|
|
411
|
+
store.add(this._strategy.onDidDiscard(() => this.cancelSession()));
|
|
412
|
+
store.add(Event.once(this._messages.event)(m => {
|
|
413
|
+
this._log('state=_waitForInput) message received', m);
|
|
414
|
+
message = m;
|
|
415
|
+
barrier.open();
|
|
416
|
+
}));
|
|
417
|
+
await barrier.wait();
|
|
418
|
+
store.dispose();
|
|
419
|
+
}
|
|
420
|
+
this._zone.value.widget.selectAll(false);
|
|
421
|
+
if (message & ((16 | 2) )) {
|
|
422
|
+
return "CANCEL" ;
|
|
423
|
+
}
|
|
424
|
+
if (message & 1 ) {
|
|
425
|
+
return "DONE" ;
|
|
426
|
+
}
|
|
427
|
+
if (message & 4 ) {
|
|
428
|
+
return "PAUSE" ;
|
|
429
|
+
}
|
|
430
|
+
if (message & 64 && this._activeSession.lastExchange) {
|
|
431
|
+
const { lastExchange } = this._activeSession;
|
|
432
|
+
this._activeSession.addInput(lastExchange.prompt.retry());
|
|
433
|
+
if (lastExchange.response instanceof ReplyResponse) {
|
|
434
|
+
try {
|
|
435
|
+
this._ignoreModelContentChanged = true;
|
|
436
|
+
await this._strategy.undoChanges(lastExchange.response.modelAltVersionId);
|
|
437
|
+
}
|
|
438
|
+
finally {
|
|
439
|
+
this._ignoreModelContentChanged = false;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return "MAKE_REQUEST" ;
|
|
443
|
+
}
|
|
444
|
+
if (!this.getInput()) {
|
|
445
|
+
return "WAIT_FOR_INPUT" ;
|
|
446
|
+
}
|
|
447
|
+
const input = this.getInput();
|
|
448
|
+
this._historyUpdate(input);
|
|
449
|
+
const refer = this._activeSession.session.slashCommands?.some(value => value.refer && input.startsWith(`/${value.command}`));
|
|
450
|
+
if (refer) {
|
|
451
|
+
this._log('[IE] seeing refer command, continuing outside editor', this._activeSession.provider.debugName);
|
|
452
|
+
this._editor.setSelection(this._activeSession.wholeRange.value);
|
|
453
|
+
let massagedInput = input;
|
|
454
|
+
if (input.startsWith(chatSubcommandLeader)) {
|
|
455
|
+
const withoutSubCommandLeader = input.slice(1);
|
|
456
|
+
const cts = ( new CancellationTokenSource());
|
|
457
|
+
this._sessionStore.add(cts);
|
|
458
|
+
for (const agent of this._chatAgentService.getAgents()) {
|
|
459
|
+
const commands = await agent.provideSlashCommands(cts.token);
|
|
460
|
+
if (commands.find((command) => withoutSubCommandLeader.startsWith(command.name))) {
|
|
461
|
+
massagedInput = `${chatAgentLeader}${agent.id} ${input}`;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
this._instaService.invokeFunction(sendRequest, massagedInput);
|
|
467
|
+
if (!this._activeSession.lastExchange) {
|
|
468
|
+
return "DONE" ;
|
|
469
|
+
}
|
|
470
|
+
return "WAIT_FOR_INPUT" ;
|
|
471
|
+
}
|
|
472
|
+
this._activeSession.addInput(( new SessionPrompt(input)));
|
|
473
|
+
return "MAKE_REQUEST" ;
|
|
474
|
+
}
|
|
475
|
+
async ["MAKE_REQUEST" ]() {
|
|
476
|
+
assertType(this._editor.hasModel());
|
|
477
|
+
assertType(this._activeSession);
|
|
478
|
+
assertType(this._strategy);
|
|
479
|
+
assertType(this._activeSession.lastInput);
|
|
480
|
+
const requestCts = ( new CancellationTokenSource());
|
|
481
|
+
let message = 0 ;
|
|
482
|
+
const msgListener = Event.once(this._messages.event)(m => {
|
|
483
|
+
this._log('state=_makeRequest) message received', m);
|
|
484
|
+
message = m;
|
|
485
|
+
requestCts.cancel();
|
|
486
|
+
});
|
|
487
|
+
const typeListener = this._zone.value.widget.onDidChangeInput(() => requestCts.cancel());
|
|
488
|
+
const requestClock = StopWatch.create();
|
|
489
|
+
const request = {
|
|
490
|
+
requestId: generateUuid(),
|
|
491
|
+
prompt: this._activeSession.lastInput.value,
|
|
492
|
+
attempt: this._activeSession.lastInput.attempt,
|
|
493
|
+
selection: this._editor.getSelection(),
|
|
494
|
+
wholeRange: this._activeSession.wholeRange.value,
|
|
495
|
+
live: this._activeSession.editMode !== "preview"
|
|
496
|
+
};
|
|
497
|
+
const modelAltVersionIdNow = this._activeSession.textModelN.getAlternativeVersionId();
|
|
498
|
+
const progressEdits = [];
|
|
499
|
+
const progressiveEditsAvgDuration = ( new MovingAverage());
|
|
500
|
+
const progressiveEditsCts = ( new CancellationTokenSource(requestCts.token));
|
|
501
|
+
const progressiveEditsClock = StopWatch.create();
|
|
502
|
+
const progressiveEditsQueue = ( new Queue());
|
|
503
|
+
let progressiveChatResponse;
|
|
504
|
+
const progress = ( new Progress(data => {
|
|
505
|
+
this._log('received chunk', data, request);
|
|
506
|
+
if (requestCts.token.isCancellationRequested) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (data.message) {
|
|
510
|
+
this._zone.value.widget.updateToolbar(false);
|
|
511
|
+
this._zone.value.widget.updateInfo(data.message);
|
|
512
|
+
}
|
|
513
|
+
if (data.slashCommand) {
|
|
514
|
+
const valueNow = this.getInput();
|
|
515
|
+
if (!valueNow.startsWith('/')) {
|
|
516
|
+
this._zone.value.widget.updateSlashCommandUsed(data.slashCommand);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
if (data.edits?.length) {
|
|
520
|
+
if (!request.live) {
|
|
521
|
+
throw new Error('Progress in NOT supported in non-live mode');
|
|
522
|
+
}
|
|
523
|
+
progressEdits.push(data.edits);
|
|
524
|
+
progressiveEditsAvgDuration.update(progressiveEditsClock.elapsed());
|
|
525
|
+
progressiveEditsClock.reset();
|
|
526
|
+
progressiveEditsQueue.queue(async () => {
|
|
527
|
+
const startThen = this._activeSession.wholeRange.value.getStartPosition();
|
|
528
|
+
await this._makeChanges(data.edits, data.editsShouldBeInstant
|
|
529
|
+
? undefined
|
|
530
|
+
: { duration: progressiveEditsAvgDuration.value, token: progressiveEditsCts.token });
|
|
531
|
+
const startNow = this._activeSession.wholeRange.value.getStartPosition();
|
|
532
|
+
if (!startNow.equals(startThen) || !this._zone.value.position?.equals(startNow)) {
|
|
533
|
+
this._showWidget(false, startNow.delta(-1));
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
if (data.markdownFragment) {
|
|
538
|
+
if (!progressiveChatResponse) {
|
|
539
|
+
const message = {
|
|
540
|
+
message: ( new MarkdownString(
|
|
541
|
+
data.markdownFragment,
|
|
542
|
+
{ supportThemeIcons: true, supportHtml: true, isTrusted: false }
|
|
543
|
+
)),
|
|
544
|
+
providerId: this._activeSession.provider.debugName,
|
|
545
|
+
requestId: request.requestId,
|
|
546
|
+
};
|
|
547
|
+
progressiveChatResponse = this._zone.value.widget.updateChatMessage(message, true);
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
progressiveChatResponse.appendContent(data.markdownFragment);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}));
|
|
554
|
+
let a11yResponse;
|
|
555
|
+
const a11yVerboseInlineChat = this._configurationService.getValue('accessibility.verbosity.inlineChat') === true;
|
|
556
|
+
const requestId = this._chatAccessibilityService.acceptRequest();
|
|
557
|
+
const task = this._activeSession.provider.provideResponse(this._activeSession.session, request, progress, requestCts.token);
|
|
558
|
+
this._log('request started', this._activeSession.provider.debugName, this._activeSession.session, request);
|
|
559
|
+
let response;
|
|
560
|
+
let reply;
|
|
561
|
+
try {
|
|
562
|
+
this._zone.value.widget.updateChatMessage(undefined);
|
|
563
|
+
this._zone.value.widget.updateFollowUps(undefined);
|
|
564
|
+
this._zone.value.widget.updateProgress(true);
|
|
565
|
+
this._zone.value.widget.updateInfo(!this._activeSession.lastExchange ? ( localizeWithPath(
|
|
566
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
567
|
+
'thinking',
|
|
568
|
+
"Thinking\u2026"
|
|
569
|
+
)) : '');
|
|
570
|
+
await this._strategy.start();
|
|
571
|
+
this._ctxHasActiveRequest.set(true);
|
|
572
|
+
reply = await raceCancellationError(Promise.resolve(task), requestCts.token);
|
|
573
|
+
if (progressiveEditsQueue.size > 0) {
|
|
574
|
+
await Event.toPromise(progressiveEditsQueue.onDrained);
|
|
575
|
+
}
|
|
576
|
+
if (progressiveChatResponse) {
|
|
577
|
+
progressiveChatResponse.cancel();
|
|
578
|
+
}
|
|
579
|
+
if (!reply) {
|
|
580
|
+
response = ( new EmptyResponse());
|
|
581
|
+
a11yResponse = ( localizeWithPath(
|
|
582
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
583
|
+
'empty',
|
|
584
|
+
"No results, please refine your input and try again"
|
|
585
|
+
));
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
const markdownContents = reply.message ?? ( new MarkdownString('', { supportThemeIcons: true, supportHtml: true, isTrusted: false }));
|
|
589
|
+
const replyResponse = response = this._instaService.createInstance(ReplyResponse, reply, markdownContents, this._activeSession.textModelN.uri, modelAltVersionIdNow, progressEdits, request.requestId);
|
|
590
|
+
for (let i = progressEdits.length; i < replyResponse.allLocalEdits.length; i++) {
|
|
591
|
+
await this._makeChanges(replyResponse.allLocalEdits[i], undefined);
|
|
592
|
+
}
|
|
593
|
+
const a11yMessageResponse = renderMarkdownAsPlaintext(replyResponse.mdContent);
|
|
594
|
+
a11yResponse = a11yVerboseInlineChat
|
|
595
|
+
? a11yMessageResponse ? ( localizeWithPath(
|
|
596
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
597
|
+
'editResponseMessage2',
|
|
598
|
+
"{0}, also review proposed changes in the diff editor.",
|
|
599
|
+
a11yMessageResponse
|
|
600
|
+
)) : ( localizeWithPath(
|
|
601
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
602
|
+
'editResponseMessage',
|
|
603
|
+
"Review proposed changes in the diff editor."
|
|
604
|
+
))
|
|
605
|
+
: a11yMessageResponse;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
catch (e) {
|
|
609
|
+
response = ( new ErrorResponse(e));
|
|
610
|
+
a11yResponse = response.message;
|
|
611
|
+
}
|
|
612
|
+
finally {
|
|
613
|
+
this._ctxHasActiveRequest.set(false);
|
|
614
|
+
this._zone.value.widget.updateProgress(false);
|
|
615
|
+
this._zone.value.widget.updateInfo('');
|
|
616
|
+
this._zone.value.widget.updateToolbar(true);
|
|
617
|
+
this._log('request took', requestClock.elapsed(), this._activeSession.provider.debugName);
|
|
618
|
+
this._chatAccessibilityService.acceptResponse(a11yResponse, requestId);
|
|
619
|
+
}
|
|
620
|
+
const diff = await this._editorWorkerService.computeDiff(this._activeSession.textModel0.uri, this._activeSession.textModelN.uri, { computeMoves: false, maxComputationTimeMs: Number.MAX_SAFE_INTEGER, ignoreTrimWhitespace: false }, 'advanced');
|
|
621
|
+
this._activeSession.wholeRange.fixup(diff?.changes ?? []);
|
|
622
|
+
progressiveEditsCts.dispose(true);
|
|
623
|
+
requestCts.dispose();
|
|
624
|
+
msgListener.dispose();
|
|
625
|
+
typeListener.dispose();
|
|
626
|
+
if (request.live && !(response instanceof ReplyResponse)) {
|
|
627
|
+
this._strategy?.undoChanges(modelAltVersionIdNow);
|
|
628
|
+
}
|
|
629
|
+
this._activeSession.addExchange(( new SessionExchange(this._activeSession.lastInput, response)));
|
|
630
|
+
if (message & 2 ) {
|
|
631
|
+
return "CANCEL" ;
|
|
632
|
+
}
|
|
633
|
+
else if (message & 4 ) {
|
|
634
|
+
return "PAUSE" ;
|
|
635
|
+
}
|
|
636
|
+
else if (message & 1 ) {
|
|
637
|
+
return "DONE" ;
|
|
638
|
+
}
|
|
639
|
+
else {
|
|
640
|
+
return "APPLY_RESPONSE" ;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
async ["APPLY_RESPONSE" ]() {
|
|
644
|
+
assertType(this._activeSession);
|
|
645
|
+
assertType(this._strategy);
|
|
646
|
+
const { response } = this._activeSession.lastExchange;
|
|
647
|
+
if (response instanceof ReplyResponse && response.workspaceEdit) {
|
|
648
|
+
this._bulkEditService.apply(response.workspaceEdit, { showPreview: true });
|
|
649
|
+
return "CANCEL" ;
|
|
650
|
+
}
|
|
651
|
+
return "SHOW_RESPONSE" ;
|
|
652
|
+
}
|
|
653
|
+
async _makeChanges(edits, opts) {
|
|
654
|
+
assertType(this._activeSession);
|
|
655
|
+
assertType(this._strategy);
|
|
656
|
+
const moreMinimalEdits = await this._editorWorkerService.computeMoreMinimalEdits(this._activeSession.textModelN.uri, edits);
|
|
657
|
+
this._log('edits from PROVIDER and after making them MORE MINIMAL', this._activeSession.provider.debugName, edits, moreMinimalEdits);
|
|
658
|
+
if (moreMinimalEdits?.length === 0) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
const actualEdits = !opts && moreMinimalEdits ? moreMinimalEdits : edits;
|
|
662
|
+
const editOperations = ( actualEdits.map(TextEdit.asEditOperation));
|
|
663
|
+
try {
|
|
664
|
+
this._ignoreModelContentChanged = true;
|
|
665
|
+
this._activeSession.wholeRange.trackEdits(editOperations);
|
|
666
|
+
if (opts) {
|
|
667
|
+
await this._strategy.makeProgressiveChanges(editOperations, opts);
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
await this._strategy.makeChanges(editOperations);
|
|
671
|
+
}
|
|
672
|
+
this._ctxDidEdit.set(this._activeSession.hasChangedText);
|
|
673
|
+
}
|
|
674
|
+
finally {
|
|
675
|
+
this._ignoreModelContentChanged = false;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
async ["SHOW_RESPONSE" ]() {
|
|
679
|
+
assertType(this._activeSession);
|
|
680
|
+
assertType(this._strategy);
|
|
681
|
+
const { response } = this._activeSession.lastExchange;
|
|
682
|
+
this._ctxLastResponseType.set(response instanceof ReplyResponse ? response.raw.type : undefined);
|
|
683
|
+
let responseTypes;
|
|
684
|
+
for (const { response } of this._activeSession.exchanges) {
|
|
685
|
+
const thisType = response instanceof ReplyResponse
|
|
686
|
+
? response.responseType
|
|
687
|
+
: undefined;
|
|
688
|
+
if (responseTypes === undefined) {
|
|
689
|
+
responseTypes = thisType;
|
|
690
|
+
}
|
|
691
|
+
else if (responseTypes !== thisType) {
|
|
692
|
+
responseTypes = "mixed" ;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
this._ctxResponseTypes.set(responseTypes);
|
|
697
|
+
this._ctxDidEdit.set(this._activeSession.hasChangedText);
|
|
698
|
+
let newPosition;
|
|
699
|
+
if (response instanceof EmptyResponse) {
|
|
700
|
+
const status = ( localizeWithPath(
|
|
701
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
702
|
+
'empty',
|
|
703
|
+
"No results, please refine your input and try again"
|
|
704
|
+
));
|
|
705
|
+
this._zone.value.widget.updateStatus(status, { classes: ['warn'] });
|
|
706
|
+
return "WAIT_FOR_INPUT" ;
|
|
707
|
+
}
|
|
708
|
+
else if (response instanceof ErrorResponse) {
|
|
709
|
+
if (!response.isCancellation) {
|
|
710
|
+
this._zone.value.widget.updateStatus(response.message, { classes: ['error'] });
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
else if (response instanceof ReplyResponse) {
|
|
714
|
+
this._zone.value.widget.updateStatus('');
|
|
715
|
+
const message = { message: response.mdContent, providerId: this._activeSession.provider.debugName, requestId: response.requestId };
|
|
716
|
+
this._zone.value.widget.updateChatMessage(message);
|
|
717
|
+
this._activeSession.lastExpansionState = this._zone.value.widget.expansionState;
|
|
718
|
+
this._zone.value.widget.updateToolbar(true);
|
|
719
|
+
newPosition = await this._strategy.renderChanges(response);
|
|
720
|
+
if (this._activeSession.provider.provideFollowups) {
|
|
721
|
+
const followupCts = ( new CancellationTokenSource());
|
|
722
|
+
const msgListener = Event.once(this._messages.event)(() => {
|
|
723
|
+
followupCts.cancel();
|
|
724
|
+
});
|
|
725
|
+
const followupTask = this._activeSession.provider.provideFollowups(this._activeSession.session, response.raw, followupCts.token);
|
|
726
|
+
this._log('followup request started', this._activeSession.provider.debugName, this._activeSession.session, response.raw);
|
|
727
|
+
raceCancellation(Promise.resolve(followupTask), followupCts.token).then(followupReply => {
|
|
728
|
+
if (followupReply && this._activeSession) {
|
|
729
|
+
this._log('followup request received', this._activeSession.provider.debugName, this._activeSession.session, followupReply);
|
|
730
|
+
this._zone.value.widget.updateFollowUps(followupReply, followup => {
|
|
731
|
+
this.updateInput(followup.message);
|
|
732
|
+
this.acceptInput();
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}).finally(() => {
|
|
736
|
+
msgListener.dispose();
|
|
737
|
+
followupCts.dispose();
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
this._showWidget(false, newPosition);
|
|
742
|
+
return "WAIT_FOR_INPUT" ;
|
|
743
|
+
}
|
|
744
|
+
async ["PAUSE" ]() {
|
|
745
|
+
this._ctxDidEdit.reset();
|
|
746
|
+
this._ctxUserDidEdit.reset();
|
|
747
|
+
this._ctxLastResponseType.reset();
|
|
748
|
+
this._ctxLastFeedbackKind.reset();
|
|
749
|
+
this._ctxSupportIssueReporting.reset();
|
|
750
|
+
this._zone.value.hide();
|
|
751
|
+
if (this._editor.hasWidgetFocus()) {
|
|
752
|
+
this._editor.focus();
|
|
753
|
+
}
|
|
754
|
+
this._strategy?.dispose();
|
|
755
|
+
this._strategy = undefined;
|
|
756
|
+
this._activeSession = undefined;
|
|
757
|
+
}
|
|
758
|
+
async ["DONE" ]() {
|
|
759
|
+
assertType(this._activeSession);
|
|
760
|
+
assertType(this._strategy);
|
|
761
|
+
this._sessionStore.clear();
|
|
762
|
+
try {
|
|
763
|
+
await this._strategy.apply();
|
|
764
|
+
}
|
|
765
|
+
catch (err) {
|
|
766
|
+
this._dialogService.error(( localizeWithPath(
|
|
767
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
768
|
+
'err.apply',
|
|
769
|
+
"Failed to apply changes.",
|
|
770
|
+
toErrorMessage(err)
|
|
771
|
+
)));
|
|
772
|
+
this._log('FAILED to apply changes');
|
|
773
|
+
this._log(err);
|
|
774
|
+
}
|
|
775
|
+
this._inlineChatSessionService.releaseSession(this._activeSession);
|
|
776
|
+
this["PAUSE" ]();
|
|
777
|
+
}
|
|
778
|
+
async ["CANCEL" ]() {
|
|
779
|
+
assertType(this._activeSession);
|
|
780
|
+
assertType(this._strategy);
|
|
781
|
+
this._sessionStore.clear();
|
|
782
|
+
const mySession = this._activeSession;
|
|
783
|
+
try {
|
|
784
|
+
await this._strategy.cancel();
|
|
785
|
+
}
|
|
786
|
+
catch (err) {
|
|
787
|
+
this._dialogService.error(( localizeWithPath(
|
|
788
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatController',
|
|
789
|
+
'err.discard',
|
|
790
|
+
"Failed to discard changes.",
|
|
791
|
+
toErrorMessage(err)
|
|
792
|
+
)));
|
|
793
|
+
this._log('FAILED to discard changes');
|
|
794
|
+
this._log(err);
|
|
795
|
+
}
|
|
796
|
+
this["PAUSE" ]();
|
|
797
|
+
this._stashedSession.clear();
|
|
798
|
+
if (!mySession.isUnstashed && mySession.lastExchange) {
|
|
799
|
+
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
|
|
800
|
+
}
|
|
801
|
+
else {
|
|
802
|
+
this._inlineChatSessionService.releaseSession(mySession);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
acceptInput() {
|
|
806
|
+
this._messages.fire(32 );
|
|
807
|
+
}
|
|
808
|
+
updateInput(text, selectAll = true) {
|
|
809
|
+
this._zone.value.widget.value = text;
|
|
810
|
+
if (selectAll) {
|
|
811
|
+
this._zone.value.widget.selectAll();
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
getInput() {
|
|
815
|
+
return this._zone.value.widget.value;
|
|
816
|
+
}
|
|
817
|
+
regenerate() {
|
|
818
|
+
this._messages.fire(64 );
|
|
819
|
+
}
|
|
820
|
+
cancelCurrentRequest() {
|
|
821
|
+
this._messages.fire(16 | 8 );
|
|
822
|
+
}
|
|
823
|
+
arrowOut(up) {
|
|
824
|
+
if (this._zone.value.position && this._editor.hasModel()) {
|
|
825
|
+
const { column } = this._editor.getPosition();
|
|
826
|
+
const { lineNumber } = this._zone.value.position;
|
|
827
|
+
const newLine = up ? lineNumber : lineNumber + 1;
|
|
828
|
+
this._editor.setPosition({ lineNumber: newLine, column });
|
|
829
|
+
this._editor.focus();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
focus() {
|
|
833
|
+
this._zone.value.widget.focus();
|
|
834
|
+
}
|
|
835
|
+
hasFocus() {
|
|
836
|
+
return this._zone.value.widget.hasFocus();
|
|
837
|
+
}
|
|
838
|
+
populateHistory(up) {
|
|
839
|
+
const len = InlineChatController_1._promptHistory.length;
|
|
840
|
+
if (len === 0) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const pos = (len + this._historyOffset + (up ? 1 : -1)) % len;
|
|
844
|
+
const entry = InlineChatController_1._promptHistory[pos];
|
|
845
|
+
this._zone.value.widget.value = entry;
|
|
846
|
+
this._zone.value.widget.selectAll();
|
|
847
|
+
this._historyOffset = pos;
|
|
848
|
+
}
|
|
849
|
+
viewInChat() {
|
|
850
|
+
if (this._activeSession?.lastExchange?.response instanceof ReplyResponse) {
|
|
851
|
+
this._instaService.invokeFunction(showMessageResponse, this._activeSession.lastExchange.prompt.value, this._activeSession.lastExchange.response.mdContent.value);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
updateExpansionState(expand) {
|
|
855
|
+
if (this._activeSession) {
|
|
856
|
+
const expansionState = expand ? ExpansionState.EXPANDED : ExpansionState.CROPPED;
|
|
857
|
+
this._zone.value.widget.updateChatMessageExpansionState(expansionState);
|
|
858
|
+
this._activeSession.lastExpansionState = expansionState;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
toggleDiff() {
|
|
862
|
+
this._strategy?.toggleDiff?.();
|
|
863
|
+
}
|
|
864
|
+
feedbackLast(kind) {
|
|
865
|
+
if (this._activeSession?.lastExchange && this._activeSession.lastExchange.response instanceof ReplyResponse) {
|
|
866
|
+
this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, kind);
|
|
867
|
+
switch (kind) {
|
|
868
|
+
case 1 :
|
|
869
|
+
this._ctxLastFeedbackKind.set('helpful');
|
|
870
|
+
break;
|
|
871
|
+
case 0 :
|
|
872
|
+
this._ctxLastFeedbackKind.set('unhelpful');
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
this._zone.value.widget.updateStatus('Thank you for your feedback!', { resetAfter: 1250 });
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
createSnapshot() {
|
|
879
|
+
if (this._activeSession && !this._activeSession.textModel0.equalsTextBuffer(this._activeSession.textModelN.getTextBuffer())) {
|
|
880
|
+
this._activeSession.createSnapshot();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
acceptSession() {
|
|
884
|
+
if (this._activeSession?.lastExchange && this._activeSession.lastExchange.response instanceof ReplyResponse) {
|
|
885
|
+
this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, 3 );
|
|
886
|
+
}
|
|
887
|
+
this._messages.fire(1 );
|
|
888
|
+
}
|
|
889
|
+
async cancelSession() {
|
|
890
|
+
let result;
|
|
891
|
+
if (this._activeSession) {
|
|
892
|
+
const diff = await this._editorWorkerService.computeDiff(this._activeSession.textModel0.uri, this._activeSession.textModelN.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: 5000, computeMoves: false }, 'advanced');
|
|
893
|
+
result = this._activeSession.asChangedText(diff?.changes ?? []);
|
|
894
|
+
if (this._activeSession.lastExchange && this._activeSession.lastExchange.response instanceof ReplyResponse) {
|
|
895
|
+
this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, 2 );
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
this._messages.fire(2 );
|
|
899
|
+
return result;
|
|
900
|
+
}
|
|
901
|
+
finishExistingSession() {
|
|
902
|
+
if (this._activeSession) {
|
|
903
|
+
if (this._activeSession.editMode === "preview" ) {
|
|
904
|
+
this._log('finishing existing session, using CANCEL', this._activeSession.editMode);
|
|
905
|
+
this.cancelSession();
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
this._log('finishing existing session, using APPLY', this._activeSession.editMode);
|
|
909
|
+
this.acceptSession();
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
unstashLastSession() {
|
|
914
|
+
return this._stashedSession.value?.unstash();
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
InlineChatController = InlineChatController_1 = ( __decorate([
|
|
918
|
+
( __param(1, IInstantiationService)),
|
|
919
|
+
( __param(2, IInlineChatSessionService)),
|
|
920
|
+
( __param(3, IEditorWorkerService)),
|
|
921
|
+
( __param(4, ILogService)),
|
|
922
|
+
( __param(5, IConfigurationService)),
|
|
923
|
+
( __param(6, IDialogService)),
|
|
924
|
+
( __param(7, IContextKeyService)),
|
|
925
|
+
( __param(8, IAccessibilityService)),
|
|
926
|
+
( __param(9, IChatAccessibilityService)),
|
|
927
|
+
( __param(10, IChatAgentService)),
|
|
928
|
+
( __param(11, IBulkEditService)),
|
|
929
|
+
( __param(12, IStorageService))
|
|
930
|
+
], InlineChatController));
|
|
931
|
+
let StashedSession = class StashedSession {
|
|
932
|
+
constructor(editor, session, contextKeyService, _sessionService, _logService) {
|
|
933
|
+
this._sessionService = _sessionService;
|
|
934
|
+
this._logService = _logService;
|
|
935
|
+
this._ctxHasStashedSession = CTX_INLINE_CHAT_HAS_STASHED_SESSION.bindTo(contextKeyService);
|
|
936
|
+
this._session = session;
|
|
937
|
+
this._ctxHasStashedSession.set(true);
|
|
938
|
+
this._listener = Event.once(Event.any(editor.onDidChangeCursorSelection, editor.onDidChangeModelContent, editor.onDidChangeModel))(() => {
|
|
939
|
+
this._session = undefined;
|
|
940
|
+
this._sessionService.releaseSession(session);
|
|
941
|
+
this._ctxHasStashedSession.reset();
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
dispose() {
|
|
945
|
+
this._listener.dispose();
|
|
946
|
+
this._ctxHasStashedSession.reset();
|
|
947
|
+
if (this._session) {
|
|
948
|
+
this._sessionService.releaseSession(this._session);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
unstash() {
|
|
952
|
+
if (!this._session) {
|
|
953
|
+
return undefined;
|
|
954
|
+
}
|
|
955
|
+
this._listener.dispose();
|
|
956
|
+
const result = this._session;
|
|
957
|
+
result.markUnstashed();
|
|
958
|
+
this._session = undefined;
|
|
959
|
+
this._logService.debug('[IE] Unstashed session');
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
StashedSession = ( __decorate([
|
|
964
|
+
( __param(2, IContextKeyService)),
|
|
965
|
+
( __param(3, IInlineChatSessionService)),
|
|
966
|
+
( __param(4, ILogService))
|
|
967
|
+
], StashedSession));
|
|
968
|
+
async function showMessageResponse(accessor, query, response) {
|
|
969
|
+
const chatService = accessor.get(IChatService);
|
|
970
|
+
const providerId = chatService.getProviderInfos()[0]?.id;
|
|
971
|
+
const chatWidgetService = accessor.get(IChatWidgetService);
|
|
972
|
+
const widget = await chatWidgetService.revealViewForProvider(providerId);
|
|
973
|
+
if (widget && widget.viewModel) {
|
|
974
|
+
chatService.addCompleteRequest(widget.viewModel.sessionId, query, { message: response });
|
|
975
|
+
widget.focusLastMessage();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
async function sendRequest(accessor, query) {
|
|
979
|
+
const chatService = accessor.get(IChatService);
|
|
980
|
+
const widgetService = accessor.get(IChatWidgetService);
|
|
981
|
+
const providerId = chatService.getProviderInfos()[0]?.id;
|
|
982
|
+
const widget = await widgetService.revealViewForProvider(providerId);
|
|
983
|
+
if (!widget) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
widget.acceptInput(query);
|
|
987
|
+
}
|
|
988
|
+
export { InlineChatController, InlineChatRunOptions };
|