@codingame/monaco-vscode-api 1.85.0-next.2 → 1.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -10
- package/contributions.js +1 -0
- package/missing-services.js +91 -5
- package/monaco-editor-treemending.patch +2540 -2533
- package/package.json +6 -6
- package/vscode/src/vs/base/common/jsonFormatter.js +8 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +128 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
- package/vscode/src/vs/platform/layout/browser/zIndexRegistry.js +58 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +56 -1
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +186 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +191 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +238 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +205 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +168 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +340 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1195 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +81 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommandContentWidget.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +583 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +290 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +167 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +562 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +31 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProvider.js +24 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +193 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +22 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +52 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +258 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +25 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +388 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +61 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +49 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +647 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +300 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +60 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +333 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +99 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +55 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +2 -0
- package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +20 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +855 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +410 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1485 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +125 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +41 -0
- package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +102 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +988 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget.js +431 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +417 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +806 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +915 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/utils.js +19 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +129 -10
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +205 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +150 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +480 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +90 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +258 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +614 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +44 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +169 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +64 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/cellOutputClipboard.js +49 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +120 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +416 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +663 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +593 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/coreActions.js +326 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +539 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/foldingController.js +265 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +348 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebook.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellEditorHint.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellInsertToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellOutput.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellStatusBar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellTitleToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookDnd.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookEditorStickyScroll.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFocusIndicator.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookFolding.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookKernelActionViewItem.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookOutline.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookToolbar.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +95 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditor.js +437 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorExtensions.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2730 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +139 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookLogger.js +17 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +564 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookViewEvents.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellPart.js +119 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +27 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys.js +178 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDecorations.js +35 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +377 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDragRenderer.js +97 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions.js +194 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellExecution.js +71 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocus.js +20 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +652 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +303 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbarStickyScroll.js +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +228 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatActions.js +302 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatController.js +438 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/chat/cellChatPart.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellExecutionIcon.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +107 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellInput.js +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/collapsedCellOutput.js +59 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/foldedCellHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +430 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellAnchor.js +54 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.js +1131 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/notebookCellListView.js +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +1591 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +341 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +2155 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewThemeMapping.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.js +95 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +507 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions.js +85 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel.js +47 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/cellSelectionCollection.js +40 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +435 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/eventDispatcher.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/foldingModel.js +257 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/markupCellViewModel.js +239 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.js +211 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +808 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/viewContext.js +8 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +381 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +527 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorWidgetContextKeys.js +163 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy.js +651 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookOverviewRuler.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellOutputTextModel.js +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookCellTextModel.js +346 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +152 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +296 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +261 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookExecutionService.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKernelService.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookKeymapService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookLoggingService.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookPerformance.js +16 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookRange.js +66 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWorkerService.js +4 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +130 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +847 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +89 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +1942 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/urlFinder.js +107 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsBase.js +49 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +387 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/common/constants.js +66 -0
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +24 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +95 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -1
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/featuredExtensionService.js +159 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +375 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +563 -0
- package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +932 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +15 -1
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +2 -2
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.js +190 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +77 -0
- package/assets/break.mp3 +0 -0
- package/assets/chatRequestSent.mp3 +0 -0
- package/assets/chatResponsePending.mp3 +0 -0
- package/assets/chatResponseReceived1.mp3 +0 -0
- package/assets/chatResponseReceived2.mp3 +0 -0
- package/assets/chatResponseReceived3.mp3 +0 -0
- package/assets/chatResponseReceived4.mp3 +0 -0
- package/assets/clear.mp3 +0 -0
- package/assets/defaultIcon.png +0 -0
- package/assets/diffLineDeleted.mp3 +0 -0
- package/assets/diffLineInserted.mp3 +0 -0
- package/assets/diffLineModified.mp3 +0 -0
- package/assets/error.mp3 +0 -0
- package/assets/fake.html +0 -10
- package/assets/foldedAreas.mp3 +0 -0
- package/assets/format.mp3 +0 -0
- package/assets/index-no-csp.html +0 -1226
- package/assets/index.html +0 -1227
- package/assets/quickFixes.mp3 +0 -0
- package/assets/save.mp3 +0 -0
- package/assets/service-worker.js +0 -457
- package/assets/taskCompleted.mp3 +0 -0
- package/assets/taskFailed.mp3 +0 -0
- package/assets/terminalBell.mp3 +0 -0
- package/assets/warning.mp3 +0 -0
- package/assets/webWorkerExtensionHostIframe.html +0 -123
- package/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
- package/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +0 -2
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -5
|
@@ -0,0 +1,915 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './inlineChat.css.js';
|
|
3
|
+
import { DisposableStore, MutableDisposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
5
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
6
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
7
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
8
|
+
import { ZoneWidget } from 'monaco-editor/esm/vs/editor/contrib/zoneWidget/browser/zoneWidget.js';
|
|
9
|
+
import { CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_INNER_CURSOR_START, CTX_INLINE_CHAT_INNER_CURSOR_END, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, MENU_INLINE_CHAT_WIDGET_TOGGLE, ACTION_REGENERATE_RESPONSE, ACTION_VIEW_IN_CHAT, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_WIDGET_FEEDBACK } from '../common/inlineChat.js';
|
|
10
|
+
import { h, addDisposableListener, EventType, getWindow, getTotalWidth, Dimension, getTotalHeight, reset, getActiveElement } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
11
|
+
import { MicrotaskEmitter, Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
12
|
+
import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
|
|
13
|
+
import { SnippetController2 } from 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetController2.js';
|
|
14
|
+
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
15
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
16
|
+
import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'monaco-editor/esm/vs/editor/browser/widget/embeddedCodeEditorWidget.js';
|
|
17
|
+
import { MenuWorkbenchToolBar } from 'monaco-editor/esm/vs/platform/actions/browser/toolbar.js';
|
|
18
|
+
import { ProgressBar } from 'monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js';
|
|
19
|
+
import { SuggestController } from 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestController.js';
|
|
20
|
+
import { DEFAULT_FONT_FAMILY } from '../../../browser/style.js';
|
|
21
|
+
import { ResourceLabel } from '../../../browser/labels.js';
|
|
22
|
+
import { FileKind } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
23
|
+
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
24
|
+
import { createTextBufferFactoryFromSnapshot } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
|
|
25
|
+
import { invertLineRange, lineRangeAsRange } from './utils.js';
|
|
26
|
+
import { LineRange } from 'monaco-editor/esm/vs/editor/common/core/lineRange.js';
|
|
27
|
+
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
|
|
28
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
29
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
30
|
+
import { renderLabelWithIcons } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabels.js';
|
|
31
|
+
import { ExpansionState } from './inlineChatSession.js';
|
|
32
|
+
import * as aria from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
33
|
+
import { MenuWorkbenchButtonBar, WorkbenchButtonBar } from '../../../../platform/actions/browser/buttonbar.js';
|
|
34
|
+
import { SlashCommandContentWidget } from '../../chat/browser/chatSlashCommandContentWidget.js';
|
|
35
|
+
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
36
|
+
import { IAccessibleViewService } from '../../accessibility/browser/accessibleView.js';
|
|
37
|
+
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
38
|
+
import { assertType } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
39
|
+
import { renderFormattedText } from 'monaco-editor/esm/vs/base/browser/formattedTextRenderer.js';
|
|
40
|
+
import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
41
|
+
import { ChatEditorOptions } from '../../chat/browser/chatOptions.js';
|
|
42
|
+
import { editorForeground, inputBackground, editorBackground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
43
|
+
import { Lazy } from 'monaco-editor/esm/vs/base/common/lazy.js';
|
|
44
|
+
import { IEditorWorkerService } from 'monaco-editor/esm/vs/editor/common/services/editorWorker.js';
|
|
45
|
+
import { ChatResponseViewModel } from '../../chat/common/chatViewModel.js';
|
|
46
|
+
import { ChatModel, ChatResponseModel } from '../../chat/common/chatModel.js';
|
|
47
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
48
|
+
import { ChatListItemRenderer } from '../../chat/browser/chatListRenderer.js';
|
|
49
|
+
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
50
|
+
import { IChatAgentService } from '../../chat/common/chatAgents.js';
|
|
51
|
+
import { ChatFollowups } from '../../chat/browser/chatFollowups.js';
|
|
52
|
+
var InlineChatWidget_1;
|
|
53
|
+
const defaultAriaLabel = ( localizeWithPath(
|
|
54
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
55
|
+
'aria-label',
|
|
56
|
+
"Inline Chat Input"
|
|
57
|
+
));
|
|
58
|
+
const _inputEditorOptions = {
|
|
59
|
+
padding: { top: 2, bottom: 2 },
|
|
60
|
+
overviewRulerLanes: 0,
|
|
61
|
+
glyphMargin: false,
|
|
62
|
+
lineNumbers: 'off',
|
|
63
|
+
folding: false,
|
|
64
|
+
hideCursorInOverviewRuler: true,
|
|
65
|
+
selectOnLineNumbers: false,
|
|
66
|
+
selectionHighlight: false,
|
|
67
|
+
scrollbar: {
|
|
68
|
+
useShadows: false,
|
|
69
|
+
vertical: 'hidden',
|
|
70
|
+
horizontal: 'auto',
|
|
71
|
+
alwaysConsumeMouseWheel: false
|
|
72
|
+
},
|
|
73
|
+
lineDecorationsWidth: 0,
|
|
74
|
+
overviewRulerBorder: false,
|
|
75
|
+
scrollBeyondLastLine: false,
|
|
76
|
+
renderLineHighlight: 'none',
|
|
77
|
+
fixedOverflowWidgets: true,
|
|
78
|
+
dragAndDrop: false,
|
|
79
|
+
revealHorizontalRightPadding: 5,
|
|
80
|
+
minimap: { enabled: false },
|
|
81
|
+
guides: { indentation: false },
|
|
82
|
+
rulers: [],
|
|
83
|
+
cursorWidth: 1,
|
|
84
|
+
cursorStyle: 'line',
|
|
85
|
+
cursorBlinking: 'blink',
|
|
86
|
+
wrappingStrategy: 'advanced',
|
|
87
|
+
wrappingIndent: 'none',
|
|
88
|
+
renderWhitespace: 'none',
|
|
89
|
+
dropIntoEditor: { enabled: true },
|
|
90
|
+
quickSuggestions: false,
|
|
91
|
+
suggest: {
|
|
92
|
+
showIcons: false,
|
|
93
|
+
showSnippets: false,
|
|
94
|
+
showStatusBar: false,
|
|
95
|
+
},
|
|
96
|
+
wordWrap: 'on',
|
|
97
|
+
ariaLabel: defaultAriaLabel,
|
|
98
|
+
fontFamily: DEFAULT_FONT_FAMILY,
|
|
99
|
+
fontSize: 13,
|
|
100
|
+
lineHeight: 20
|
|
101
|
+
};
|
|
102
|
+
const _previewEditorEditorOptions = {
|
|
103
|
+
scrollbar: { useShadows: false, alwaysConsumeMouseWheel: false, ignoreHorizontalScrollbarInContentHeight: true, },
|
|
104
|
+
renderMarginRevertIcon: false,
|
|
105
|
+
diffCodeLens: false,
|
|
106
|
+
scrollBeyondLastLine: false,
|
|
107
|
+
stickyScroll: { enabled: false },
|
|
108
|
+
originalAriaLabel: ( localizeWithPath(
|
|
109
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
110
|
+
'original',
|
|
111
|
+
'Original'
|
|
112
|
+
)),
|
|
113
|
+
modifiedAriaLabel: ( localizeWithPath(
|
|
114
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
115
|
+
'modified',
|
|
116
|
+
'Modified'
|
|
117
|
+
)),
|
|
118
|
+
diffAlgorithm: 'advanced',
|
|
119
|
+
readOnly: true,
|
|
120
|
+
isInEmbeddedEditor: true
|
|
121
|
+
};
|
|
122
|
+
let InlineChatWidget = class InlineChatWidget {
|
|
123
|
+
static { InlineChatWidget_1 = this; }
|
|
124
|
+
static { this._modelPool = 1; }
|
|
125
|
+
constructor(parentEditor, _options, _modelService, _contextKeyService, _languageFeaturesService, _keybindingService, _instantiationService, _accessibilityService, _configurationService, _contextMenuService, _accessibleViewService, _editorWorkerService, _logService, _textModelResolverService, _chatAgentService) {
|
|
126
|
+
this.parentEditor = parentEditor;
|
|
127
|
+
this._modelService = _modelService;
|
|
128
|
+
this._contextKeyService = _contextKeyService;
|
|
129
|
+
this._languageFeaturesService = _languageFeaturesService;
|
|
130
|
+
this._keybindingService = _keybindingService;
|
|
131
|
+
this._instantiationService = _instantiationService;
|
|
132
|
+
this._accessibilityService = _accessibilityService;
|
|
133
|
+
this._configurationService = _configurationService;
|
|
134
|
+
this._contextMenuService = _contextMenuService;
|
|
135
|
+
this._accessibleViewService = _accessibleViewService;
|
|
136
|
+
this._editorWorkerService = _editorWorkerService;
|
|
137
|
+
this._logService = _logService;
|
|
138
|
+
this._textModelResolverService = _textModelResolverService;
|
|
139
|
+
this._chatAgentService = _chatAgentService;
|
|
140
|
+
this._elements = h('div.inline-chat@root', [
|
|
141
|
+
h('div.body', [
|
|
142
|
+
h('div.content@content', [
|
|
143
|
+
h('div.input@input', [
|
|
144
|
+
h('div.editor-placeholder@placeholder'),
|
|
145
|
+
h('div.editor-container@editor'),
|
|
146
|
+
]),
|
|
147
|
+
h('div.toolbar@editorToolbar'),
|
|
148
|
+
]),
|
|
149
|
+
]),
|
|
150
|
+
h('div.progress@progress'),
|
|
151
|
+
h('div.previewDiff.hidden@previewDiff'),
|
|
152
|
+
h('div.previewCreateTitle.show-file-icons@previewCreateTitle'),
|
|
153
|
+
h('div.previewCreate.hidden@previewCreate'),
|
|
154
|
+
h('div.chatMessage.hidden@chatMessage', [
|
|
155
|
+
h('div.chatMessageContent@chatMessageContent'),
|
|
156
|
+
h('div.messageActions@messageActions')
|
|
157
|
+
]),
|
|
158
|
+
h('div.followUps.hidden@followUps'),
|
|
159
|
+
h('div.status@status', [
|
|
160
|
+
h('div.label.info.hidden@infoLabel'),
|
|
161
|
+
h('div.actions.hidden@extraToolbar'),
|
|
162
|
+
h('div.actions.hidden@statusToolbar'),
|
|
163
|
+
h('div.label.status.hidden@statusLabel'),
|
|
164
|
+
h('div.actions.hidden@feedbackToolbar'),
|
|
165
|
+
]),
|
|
166
|
+
]);
|
|
167
|
+
this._store = ( new DisposableStore());
|
|
168
|
+
this._slashCommands = this._store.add(( new DisposableStore()));
|
|
169
|
+
this._previewDiffModel = this._store.add(( new MutableDisposable()));
|
|
170
|
+
this._previewCreateDispoable = this._store.add(( new MutableDisposable()));
|
|
171
|
+
this._onDidChangeHeight = this._store.add(( new MicrotaskEmitter()));
|
|
172
|
+
this.onDidChangeHeight = Event.filter(this._onDidChangeHeight.event, _ => !this._isLayouting);
|
|
173
|
+
this._onDidChangeLayout = this._store.add(( new MicrotaskEmitter()));
|
|
174
|
+
this._onDidChangeInput = this._store.add(( new Emitter()));
|
|
175
|
+
this.onDidChangeInput = this._onDidChangeInput.event;
|
|
176
|
+
this._isLayouting = false;
|
|
177
|
+
this._expansionState = ExpansionState.NOT_CROPPED;
|
|
178
|
+
this._slashCommandDetails = [];
|
|
179
|
+
this._chatMessageDisposables = this._store.add(( new DisposableStore()));
|
|
180
|
+
this._followUpDisposables = this._store.add(( new DisposableStore()));
|
|
181
|
+
this._extraButtonsCleanup = this._store.add(( new MutableDisposable()));
|
|
182
|
+
const codeEditorWidgetOptions = {
|
|
183
|
+
isSimpleWidget: true,
|
|
184
|
+
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
|
|
185
|
+
SnippetController2.ID,
|
|
186
|
+
SuggestController.ID
|
|
187
|
+
])
|
|
188
|
+
};
|
|
189
|
+
this._inputEditor = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.editor, _inputEditorOptions, codeEditorWidgetOptions, this.parentEditor);
|
|
190
|
+
this._updateAriaLabel();
|
|
191
|
+
this._store.add(this._inputEditor);
|
|
192
|
+
this._store.add(this._inputEditor.onDidChangeModelContent(() => this._onDidChangeInput.fire(this)));
|
|
193
|
+
this._store.add(this._inputEditor.onDidLayoutChange(() => this._onDidChangeHeight.fire()));
|
|
194
|
+
this._store.add(this._inputEditor.onDidContentSizeChange(() => this._onDidChangeHeight.fire()));
|
|
195
|
+
this._store.add(addDisposableListener(this._elements.chatMessageContent, 'focus', () => this._ctxResponseFocused.set(true)));
|
|
196
|
+
this._store.add(addDisposableListener(this._elements.chatMessageContent, 'blur', () => this._ctxResponseFocused.reset()));
|
|
197
|
+
this._store.add(this._configurationService.onDidChangeConfiguration(e => {
|
|
198
|
+
if (e.affectsConfiguration("accessibility.verbosity.inlineChat" )) {
|
|
199
|
+
this._updateAriaLabel();
|
|
200
|
+
}
|
|
201
|
+
}));
|
|
202
|
+
const uri = ( URI.from(
|
|
203
|
+
{ scheme: 'vscode', authority: 'inline-chat', path: `/inline-chat/model${InlineChatWidget_1._modelPool++}.txt` }
|
|
204
|
+
));
|
|
205
|
+
this._inputModel = this._store.add(this._modelService.getModel(uri) ?? this._modelService.createModel('', null, uri));
|
|
206
|
+
this._inputEditor.setModel(this._inputModel);
|
|
207
|
+
this._editorOptions = this._store.add(_instantiationService.createInstance(ChatEditorOptions, undefined, editorForeground, inputBackground, editorBackground));
|
|
208
|
+
this._ctxMessageCropState = CTX_INLINE_CHAT_MESSAGE_CROP_STATE.bindTo(this._contextKeyService);
|
|
209
|
+
this._ctxInputEmpty = CTX_INLINE_CHAT_EMPTY.bindTo(this._contextKeyService);
|
|
210
|
+
this._ctxInnerCursorFirst = CTX_INLINE_CHAT_INNER_CURSOR_FIRST.bindTo(this._contextKeyService);
|
|
211
|
+
this._ctxInnerCursorLast = CTX_INLINE_CHAT_INNER_CURSOR_LAST.bindTo(this._contextKeyService);
|
|
212
|
+
this._ctxInnerCursorStart = CTX_INLINE_CHAT_INNER_CURSOR_START.bindTo(this._contextKeyService);
|
|
213
|
+
this._ctxInnerCursorEnd = CTX_INLINE_CHAT_INNER_CURSOR_END.bindTo(this._contextKeyService);
|
|
214
|
+
this._ctxInputEditorFocused = CTX_INLINE_CHAT_FOCUSED.bindTo(this._contextKeyService);
|
|
215
|
+
this._ctxResponseFocused = CTX_INLINE_CHAT_RESPONSE_FOCUSED.bindTo(this._contextKeyService);
|
|
216
|
+
const updateInnerCursorFirstLast = () => {
|
|
217
|
+
const selection = this._inputEditor.getSelection();
|
|
218
|
+
const fullRange = this._inputModel.getFullModelRange();
|
|
219
|
+
let onFirst = false;
|
|
220
|
+
let onLast = false;
|
|
221
|
+
if (selection.isEmpty()) {
|
|
222
|
+
const selectionTop = this._inputEditor.getTopForPosition(selection.startLineNumber, selection.startColumn);
|
|
223
|
+
const firstViewLineTop = this._inputEditor.getTopForPosition(fullRange.startLineNumber, fullRange.startColumn);
|
|
224
|
+
const lastViewLineTop = this._inputEditor.getTopForPosition(fullRange.endLineNumber, fullRange.endColumn);
|
|
225
|
+
if (selectionTop === firstViewLineTop) {
|
|
226
|
+
onFirst = true;
|
|
227
|
+
}
|
|
228
|
+
if (selectionTop === lastViewLineTop) {
|
|
229
|
+
onLast = true;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
this._ctxInnerCursorFirst.set(onFirst);
|
|
233
|
+
this._ctxInnerCursorLast.set(onLast);
|
|
234
|
+
this._ctxInnerCursorStart.set(fullRange.getStartPosition().equals(selection.getStartPosition()));
|
|
235
|
+
this._ctxInnerCursorEnd.set(fullRange.getEndPosition().equals(selection.getEndPosition()));
|
|
236
|
+
};
|
|
237
|
+
this._store.add(this._inputEditor.onDidChangeCursorPosition(updateInnerCursorFirstLast));
|
|
238
|
+
updateInnerCursorFirstLast();
|
|
239
|
+
const updateFocused = () => {
|
|
240
|
+
const hasFocus = this._inputEditor.hasWidgetFocus();
|
|
241
|
+
this._ctxInputEditorFocused.set(hasFocus);
|
|
242
|
+
this._elements.content.classList.toggle('synthetic-focus', hasFocus);
|
|
243
|
+
this.readPlaceholder();
|
|
244
|
+
};
|
|
245
|
+
this._store.add(this._inputEditor.onDidFocusEditorWidget(updateFocused));
|
|
246
|
+
this._store.add(this._inputEditor.onDidBlurEditorWidget(updateFocused));
|
|
247
|
+
this._store.add(toDisposable(() => {
|
|
248
|
+
this._ctxInnerCursorFirst.reset();
|
|
249
|
+
this._ctxInnerCursorLast.reset();
|
|
250
|
+
this._ctxInputEditorFocused.reset();
|
|
251
|
+
}));
|
|
252
|
+
updateFocused();
|
|
253
|
+
this._elements.placeholder.style.fontSize = `${this._inputEditor.getOption(52 )}px`;
|
|
254
|
+
this._elements.placeholder.style.lineHeight = `${this._inputEditor.getOption(66 )}px`;
|
|
255
|
+
this._store.add(addDisposableListener(this._elements.placeholder, 'click', () => this._inputEditor.focus()));
|
|
256
|
+
const currentContentHeight = 0;
|
|
257
|
+
const togglePlaceholder = () => {
|
|
258
|
+
const hasText = this._inputModel.getValueLength() > 0;
|
|
259
|
+
this._elements.placeholder.classList.toggle('hidden', hasText);
|
|
260
|
+
this._ctxInputEmpty.set(!hasText);
|
|
261
|
+
this.readPlaceholder();
|
|
262
|
+
const contentHeight = this._inputEditor.getContentHeight();
|
|
263
|
+
if (contentHeight !== currentContentHeight && this._lastDim) {
|
|
264
|
+
this._lastDim = this._lastDim.with(undefined, contentHeight);
|
|
265
|
+
this._inputEditor.layout(this._lastDim);
|
|
266
|
+
this._onDidChangeHeight.fire();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
this._store.add(this._inputModel.onDidChangeContent(togglePlaceholder));
|
|
270
|
+
togglePlaceholder();
|
|
271
|
+
this._slashCommandContentWidget = ( new SlashCommandContentWidget(this._inputEditor));
|
|
272
|
+
this._store.add(this._slashCommandContentWidget);
|
|
273
|
+
const toolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.editorToolbar, _options.menuId, {
|
|
274
|
+
telemetrySource: 'interactiveEditorWidget-toolbar',
|
|
275
|
+
toolbarOptions: { primaryGroup: 'main' }
|
|
276
|
+
});
|
|
277
|
+
this._store.add(toolbar);
|
|
278
|
+
this._progressBar = ( new ProgressBar(this._elements.progress));
|
|
279
|
+
this._store.add(this._progressBar);
|
|
280
|
+
const workbenchMenubarOptions = {
|
|
281
|
+
telemetrySource: 'interactiveEditorWidget-toolbar',
|
|
282
|
+
buttonConfigProvider: action => {
|
|
283
|
+
if (action.id === ACTION_REGENERATE_RESPONSE) {
|
|
284
|
+
return { showIcon: true, showLabel: false, isSecondary: true };
|
|
285
|
+
}
|
|
286
|
+
else if (action.id === ACTION_VIEW_IN_CHAT || action.id === ACTION_ACCEPT_CHANGES) {
|
|
287
|
+
return { isSecondary: false };
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
return { isSecondary: true };
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const statusButtonBar = this._instantiationService.createInstance(MenuWorkbenchButtonBar, this._elements.statusToolbar, _options.statusMenuId, workbenchMenubarOptions);
|
|
295
|
+
this._store.add(statusButtonBar.onDidChange(() => this._onDidChangeHeight.fire()));
|
|
296
|
+
this._store.add(statusButtonBar);
|
|
297
|
+
const workbenchToolbarOptions = {
|
|
298
|
+
hiddenItemStrategy: -1 ,
|
|
299
|
+
toolbarOptions: {
|
|
300
|
+
primaryGroup: () => true,
|
|
301
|
+
useSeparatorsInPrimaryActions: true
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, _options.feedbackMenuId, { ...workbenchToolbarOptions, hiddenItemStrategy: 0 });
|
|
305
|
+
this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
|
|
306
|
+
this._store.add(feedbackToolbar);
|
|
307
|
+
this._previewDiffEditor = ( new Lazy(
|
|
308
|
+
() => this._store.add(_instantiationService.createInstance(EmbeddedDiffEditorWidget, this._elements.previewDiff, {
|
|
309
|
+
..._previewEditorEditorOptions,
|
|
310
|
+
onlyShowAccessibleDiffViewer: this._accessibilityService.isScreenReaderOptimized(),
|
|
311
|
+
}, { modifiedEditor: codeEditorWidgetOptions, originalEditor: codeEditorWidgetOptions }, parentEditor))
|
|
312
|
+
));
|
|
313
|
+
this._previewCreateTitle = this._store.add(_instantiationService.createInstance(ResourceLabel, this._elements.previewCreateTitle, { supportIcons: true }));
|
|
314
|
+
this._previewCreateEditor = ( new Lazy(
|
|
315
|
+
() => this._store.add(_instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.previewCreate, _previewEditorEditorOptions, codeEditorWidgetOptions, parentEditor))
|
|
316
|
+
));
|
|
317
|
+
this._elements.chatMessageContent.tabIndex = 0;
|
|
318
|
+
this._elements.chatMessageContent.ariaLabel = this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat" );
|
|
319
|
+
this._elements.followUps.tabIndex = 0;
|
|
320
|
+
this._elements.followUps.ariaLabel = this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat" );
|
|
321
|
+
this._elements.statusLabel.tabIndex = 0;
|
|
322
|
+
const markdownMessageToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.messageActions, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, workbenchToolbarOptions);
|
|
323
|
+
this._store.add(markdownMessageToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
|
|
324
|
+
this._store.add(markdownMessageToolbar);
|
|
325
|
+
this._store.add(addDisposableListener(this._elements.root, EventType.CONTEXT_MENU, async (event) => {
|
|
326
|
+
this._onContextMenu(event);
|
|
327
|
+
}));
|
|
328
|
+
this._store.add(this._configurationService.onDidChangeConfiguration(e => {
|
|
329
|
+
if (e.affectsConfiguration("accessibility.verbosity.inlineChat" )) {
|
|
330
|
+
this._elements.chatMessageContent.ariaLabel = this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat" );
|
|
331
|
+
this._elements.followUps.ariaLabel = this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.inlineChat" );
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
_onContextMenu(e) {
|
|
336
|
+
const event = ( new StandardMouseEvent(getWindow(this._elements.root), e));
|
|
337
|
+
this._contextMenuService.showContextMenu({
|
|
338
|
+
menuId: MENU_INLINE_CHAT_WIDGET_TOGGLE,
|
|
339
|
+
getAnchor: () => event,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
_updateAriaLabel() {
|
|
343
|
+
if (!this._accessibilityService.isScreenReaderOptimized()) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
let label = defaultAriaLabel;
|
|
347
|
+
if (this._configurationService.getValue("accessibility.verbosity.inlineChat" )) {
|
|
348
|
+
const kbLabel = this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp" )?.getLabel();
|
|
349
|
+
label = kbLabel ? ( localizeWithPath(
|
|
350
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
351
|
+
'inlineChat.accessibilityHelp',
|
|
352
|
+
"Inline Chat Input, Use {0} for Inline Chat Accessibility Help.",
|
|
353
|
+
kbLabel
|
|
354
|
+
)) : ( localizeWithPath(
|
|
355
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
356
|
+
'inlineChat.accessibilityHelpNoKb',
|
|
357
|
+
"Inline Chat Input, Run the Inline Chat Accessibility Help command for more information."
|
|
358
|
+
));
|
|
359
|
+
}
|
|
360
|
+
_inputEditorOptions.ariaLabel = label;
|
|
361
|
+
this._inputEditor.updateOptions({ ariaLabel: label });
|
|
362
|
+
}
|
|
363
|
+
dispose() {
|
|
364
|
+
this._store.dispose();
|
|
365
|
+
this._ctxInputEmpty.reset();
|
|
366
|
+
this._ctxMessageCropState.reset();
|
|
367
|
+
}
|
|
368
|
+
get domNode() {
|
|
369
|
+
return this._elements.root;
|
|
370
|
+
}
|
|
371
|
+
layout(dim) {
|
|
372
|
+
this._isLayouting = true;
|
|
373
|
+
try {
|
|
374
|
+
const innerEditorWidth = dim.width - ((getTotalWidth(this._elements.editorToolbar) + 8) );
|
|
375
|
+
dim = ( new Dimension(innerEditorWidth, dim.height));
|
|
376
|
+
if (!this._lastDim || !Dimension.equals(this._lastDim, dim)) {
|
|
377
|
+
this._lastDim = dim;
|
|
378
|
+
this._inputEditor.layout(( new Dimension(innerEditorWidth, this._inputEditor.getContentHeight())));
|
|
379
|
+
this._elements.placeholder.style.width = `${innerEditorWidth }px`;
|
|
380
|
+
if (this._previewDiffEditor.hasValue) {
|
|
381
|
+
const previewDiffDim = ( new Dimension(
|
|
382
|
+
dim.width,
|
|
383
|
+
Math.min(300, Math.max(0, this._previewDiffEditor.value.getContentHeight()))
|
|
384
|
+
));
|
|
385
|
+
this._previewDiffEditor.value.layout(previewDiffDim);
|
|
386
|
+
this._elements.previewDiff.style.height = `${previewDiffDim.height}px`;
|
|
387
|
+
}
|
|
388
|
+
if (this._previewCreateEditor.hasValue) {
|
|
389
|
+
const previewCreateDim = ( new Dimension(
|
|
390
|
+
dim.width,
|
|
391
|
+
Math.min(300, Math.max(0, this._previewCreateEditor.value.getContentHeight()))
|
|
392
|
+
));
|
|
393
|
+
this._previewCreateEditor.value.layout(previewCreateDim);
|
|
394
|
+
this._elements.previewCreate.style.height = `${previewCreateDim.height}px`;
|
|
395
|
+
}
|
|
396
|
+
const lineHeight = this.parentEditor.getOption(66 );
|
|
397
|
+
const editorHeight = this.parentEditor.getLayoutInfo().height;
|
|
398
|
+
const editorHeightInLines = Math.floor(editorHeight / lineHeight);
|
|
399
|
+
this._elements.root.style.setProperty('--vscode-inline-chat-cropped', String(Math.floor(editorHeightInLines / 5)));
|
|
400
|
+
this._elements.root.style.setProperty('--vscode-inline-chat-expanded', String(Math.floor(editorHeightInLines / 3)));
|
|
401
|
+
this._onDidChangeLayout.fire();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
finally {
|
|
405
|
+
this._isLayouting = false;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
getHeight() {
|
|
409
|
+
const base = getTotalHeight(this._elements.progress) + getTotalHeight(this._elements.status);
|
|
410
|
+
const editorHeight = this._inputEditor.getContentHeight() + 12 ;
|
|
411
|
+
const followUpsHeight = getTotalHeight(this._elements.followUps);
|
|
412
|
+
const chatResponseHeight = getTotalHeight(this._elements.chatMessage);
|
|
413
|
+
const previewDiffHeight = this._previewDiffEditor.hasValue && this._previewDiffEditor.value.getModel() ? 12 + Math.min(300, Math.max(0, this._previewDiffEditor.value.getContentHeight())) : 0;
|
|
414
|
+
const previewCreateTitleHeight = getTotalHeight(this._elements.previewCreateTitle);
|
|
415
|
+
const previewCreateHeight = this._previewCreateEditor.hasValue && this._previewCreateEditor.value.getModel() ? 18 + Math.min(300, Math.max(0, this._previewCreateEditor.value.getContentHeight())) : 0;
|
|
416
|
+
return base + editorHeight + followUpsHeight + chatResponseHeight + previewDiffHeight + previewCreateTitleHeight + previewCreateHeight + 18 + 8 ;
|
|
417
|
+
}
|
|
418
|
+
updateProgress(show) {
|
|
419
|
+
if (show) {
|
|
420
|
+
this._progressBar.infinite();
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
this._progressBar.stop();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
get value() {
|
|
427
|
+
return this._inputModel.getValue();
|
|
428
|
+
}
|
|
429
|
+
set value(value) {
|
|
430
|
+
this._inputModel.setValue(value);
|
|
431
|
+
this._inputEditor.setPosition(this._inputModel.getFullModelRange().getEndPosition());
|
|
432
|
+
}
|
|
433
|
+
selectAll(includeSlashCommand = true) {
|
|
434
|
+
let selection = this._inputModel.getFullModelRange();
|
|
435
|
+
if (!includeSlashCommand) {
|
|
436
|
+
const firstLine = this._inputModel.getLineContent(1);
|
|
437
|
+
const slashCommand = this._slashCommandDetails.find(c => firstLine.startsWith(`/${c.command} `));
|
|
438
|
+
selection = slashCommand ? ( new Range(
|
|
439
|
+
1,
|
|
440
|
+
slashCommand.command.length + 3,
|
|
441
|
+
selection.endLineNumber,
|
|
442
|
+
selection.endColumn
|
|
443
|
+
)) : selection;
|
|
444
|
+
}
|
|
445
|
+
this._inputEditor.setSelection(selection);
|
|
446
|
+
}
|
|
447
|
+
set placeholder(value) {
|
|
448
|
+
this._elements.placeholder.innerText = value;
|
|
449
|
+
}
|
|
450
|
+
readPlaceholder() {
|
|
451
|
+
const slashCommand = this._slashCommandDetails.find(c => `${c.command} ` === this._inputModel.getValue().substring(1));
|
|
452
|
+
const hasText = this._inputModel.getValueLength() > 0;
|
|
453
|
+
if (!hasText) {
|
|
454
|
+
aria.status(this._elements.placeholder.innerText);
|
|
455
|
+
}
|
|
456
|
+
else if (slashCommand) {
|
|
457
|
+
aria.status(slashCommand.detail);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
updateToolbar(show) {
|
|
461
|
+
this._elements.statusToolbar.classList.toggle('hidden', !show);
|
|
462
|
+
this._elements.feedbackToolbar.classList.toggle('hidden', !show);
|
|
463
|
+
this._elements.status.classList.toggle('actions', show);
|
|
464
|
+
this._elements.infoLabel.classList.toggle('hidden', show);
|
|
465
|
+
this._onDidChangeHeight.fire();
|
|
466
|
+
}
|
|
467
|
+
setExtraButtons(buttons) {
|
|
468
|
+
const bar = this._instantiationService.createInstance(WorkbenchButtonBar, this._elements.extraToolbar, { telemetrySource: 'inlineChat' });
|
|
469
|
+
bar.update(buttons);
|
|
470
|
+
this._elements.extraToolbar.classList.toggle('hidden', buttons.length === 0);
|
|
471
|
+
this._extraButtonsCleanup.value = bar;
|
|
472
|
+
}
|
|
473
|
+
get expansionState() {
|
|
474
|
+
return this._expansionState;
|
|
475
|
+
}
|
|
476
|
+
set preferredExpansionState(expansionState) {
|
|
477
|
+
this._preferredExpansionState = expansionState;
|
|
478
|
+
}
|
|
479
|
+
get responseContent() {
|
|
480
|
+
return this._chatMessage?.value;
|
|
481
|
+
}
|
|
482
|
+
updateChatMessage(message, isIncomplete) {
|
|
483
|
+
let expansionState;
|
|
484
|
+
this._chatMessageDisposables.clear();
|
|
485
|
+
this._chatMessage = message ? ( new MarkdownString(message.message.value)) : undefined;
|
|
486
|
+
const hasMessage = message?.message.value;
|
|
487
|
+
this._elements.chatMessage.classList.toggle('hidden', !hasMessage);
|
|
488
|
+
reset(this._elements.chatMessageContent);
|
|
489
|
+
let resultingAppender;
|
|
490
|
+
if (!hasMessage) {
|
|
491
|
+
this._ctxMessageCropState.reset();
|
|
492
|
+
expansionState = ExpansionState.NOT_CROPPED;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
const sessionModel = this._chatMessageDisposables.add(( new ChatModel(message.providerId, undefined, this._logService, this._chatAgentService)));
|
|
496
|
+
const responseModel = this._chatMessageDisposables.add(( new ChatResponseModel(
|
|
497
|
+
message.message,
|
|
498
|
+
sessionModel,
|
|
499
|
+
undefined,
|
|
500
|
+
message.requestId,
|
|
501
|
+
!isIncomplete,
|
|
502
|
+
false,
|
|
503
|
+
undefined
|
|
504
|
+
)));
|
|
505
|
+
const viewModel = this._chatMessageDisposables.add(( new ChatResponseViewModel(responseModel, this._logService)));
|
|
506
|
+
const renderOptions = { renderStyle: 'compact', noHeader: true, noPadding: true };
|
|
507
|
+
const chatRendererDelegate = { getListLength() { return 1; } };
|
|
508
|
+
const renderer = this._chatMessageDisposables.add(this._instantiationService.createInstance(ChatListItemRenderer, this._editorOptions, renderOptions, chatRendererDelegate));
|
|
509
|
+
renderer.layout(this._elements.chatMessageContent.clientWidth - 4);
|
|
510
|
+
this._chatMessageDisposables.add(this._onDidChangeLayout.event(() => {
|
|
511
|
+
renderer.layout(this._elements.chatMessageContent.clientWidth - 4);
|
|
512
|
+
}));
|
|
513
|
+
const template = renderer.renderTemplate(this._elements.chatMessageContent);
|
|
514
|
+
this._chatMessageDisposables.add(template.elementDisposables);
|
|
515
|
+
this._chatMessageDisposables.add(template.templateDisposables);
|
|
516
|
+
renderer.renderChatTreeItem(viewModel, 0, template);
|
|
517
|
+
this._chatMessageDisposables.add(renderer.onDidChangeItemHeight(() => this._onDidChangeHeight.fire()));
|
|
518
|
+
if (this._preferredExpansionState) {
|
|
519
|
+
expansionState = this._preferredExpansionState;
|
|
520
|
+
this._preferredExpansionState = undefined;
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
this._updateLineClamp(ExpansionState.CROPPED);
|
|
524
|
+
expansionState = template.value.scrollHeight > template.value.clientHeight ? ExpansionState.CROPPED : ExpansionState.NOT_CROPPED;
|
|
525
|
+
}
|
|
526
|
+
this._ctxMessageCropState.set(expansionState);
|
|
527
|
+
this._updateLineClamp(expansionState);
|
|
528
|
+
resultingAppender = isIncomplete ? {
|
|
529
|
+
cancel: () => responseModel.cancel(),
|
|
530
|
+
complete: () => responseModel.complete(),
|
|
531
|
+
appendContent: (fragment) => {
|
|
532
|
+
responseModel.updateContent({ kind: 'markdownContent', content: ( new MarkdownString(fragment)) });
|
|
533
|
+
this._chatMessage?.appendMarkdown(fragment);
|
|
534
|
+
}
|
|
535
|
+
} : undefined;
|
|
536
|
+
}
|
|
537
|
+
this._expansionState = expansionState;
|
|
538
|
+
this._onDidChangeHeight.fire();
|
|
539
|
+
return resultingAppender;
|
|
540
|
+
}
|
|
541
|
+
updateFollowUps(items, onFollowup) {
|
|
542
|
+
this._followUpDisposables.clear();
|
|
543
|
+
this._elements.followUps.classList.toggle('hidden', !items || items.length === 0);
|
|
544
|
+
reset(this._elements.followUps);
|
|
545
|
+
if (items && items.length > 0 && onFollowup) {
|
|
546
|
+
this._followUpDisposables.add(( new ChatFollowups(
|
|
547
|
+
this._elements.followUps,
|
|
548
|
+
items,
|
|
549
|
+
undefined,
|
|
550
|
+
onFollowup,
|
|
551
|
+
this._contextKeyService
|
|
552
|
+
)));
|
|
553
|
+
}
|
|
554
|
+
this._onDidChangeHeight.fire();
|
|
555
|
+
}
|
|
556
|
+
updateChatMessageExpansionState(expansionState) {
|
|
557
|
+
this._ctxMessageCropState.set(expansionState);
|
|
558
|
+
const heightBefore = this._elements.chatMessageContent.scrollHeight;
|
|
559
|
+
this._updateLineClamp(expansionState);
|
|
560
|
+
const heightAfter = this._elements.chatMessageContent.scrollHeight;
|
|
561
|
+
if (heightBefore === heightAfter) {
|
|
562
|
+
this._ctxMessageCropState.set(ExpansionState.NOT_CROPPED);
|
|
563
|
+
}
|
|
564
|
+
this._onDidChangeHeight.fire();
|
|
565
|
+
}
|
|
566
|
+
_updateLineClamp(expansionState) {
|
|
567
|
+
this._elements.chatMessageContent.setAttribute('state', expansionState);
|
|
568
|
+
}
|
|
569
|
+
updateSlashCommandUsed(command) {
|
|
570
|
+
const details = this._slashCommandDetails.find(candidate => candidate.command === command);
|
|
571
|
+
if (!details) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
this._elements.infoLabel.classList.toggle('hidden', false);
|
|
575
|
+
const label = ( localizeWithPath(
|
|
576
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
577
|
+
'slashCommandUsed',
|
|
578
|
+
"Using {0} to generate response...",
|
|
579
|
+
`\`\`/${details.command}\`\``
|
|
580
|
+
));
|
|
581
|
+
const e = renderFormattedText(label, { inline: true, renderCodeSegments: true, className: 'slash-command-pill' });
|
|
582
|
+
reset(this._elements.infoLabel, e);
|
|
583
|
+
this._onDidChangeHeight.fire();
|
|
584
|
+
}
|
|
585
|
+
updateInfo(message) {
|
|
586
|
+
this._elements.infoLabel.classList.toggle('hidden', !message);
|
|
587
|
+
const renderedMessage = renderLabelWithIcons(message);
|
|
588
|
+
reset(this._elements.infoLabel, ...renderedMessage);
|
|
589
|
+
this._onDidChangeHeight.fire();
|
|
590
|
+
}
|
|
591
|
+
updateStatus(message, ops = {}) {
|
|
592
|
+
const isTempMessage = typeof ops.resetAfter === 'number';
|
|
593
|
+
if (isTempMessage && !this._elements.statusLabel.dataset['state']) {
|
|
594
|
+
const statusLabel = this._elements.statusLabel.innerText;
|
|
595
|
+
const classes = Array.from(( this._elements.statusLabel.classList.values()));
|
|
596
|
+
setTimeout(() => {
|
|
597
|
+
this.updateStatus(statusLabel, { classes, keepMessage: true });
|
|
598
|
+
}, ops.resetAfter);
|
|
599
|
+
}
|
|
600
|
+
reset(this._elements.statusLabel, message);
|
|
601
|
+
this._elements.statusLabel.className = `label status ${(ops.classes ?? []).join(' ')}`;
|
|
602
|
+
this._elements.statusLabel.classList.toggle('hidden', !message);
|
|
603
|
+
if (isTempMessage) {
|
|
604
|
+
this._elements.statusLabel.dataset['state'] = 'temp';
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
delete this._elements.statusLabel.dataset['state'];
|
|
608
|
+
}
|
|
609
|
+
this._onDidChangeHeight.fire();
|
|
610
|
+
}
|
|
611
|
+
reset() {
|
|
612
|
+
this._ctxInputEmpty.reset();
|
|
613
|
+
this._ctxInnerCursorFirst.reset();
|
|
614
|
+
this._ctxInnerCursorLast.reset();
|
|
615
|
+
this._ctxInputEditorFocused.reset();
|
|
616
|
+
this.value = '';
|
|
617
|
+
this.updateChatMessage(undefined);
|
|
618
|
+
this.updateFollowUps(undefined);
|
|
619
|
+
reset(this._elements.statusLabel);
|
|
620
|
+
this._elements.statusLabel.classList.toggle('hidden', true);
|
|
621
|
+
this._elements.extraToolbar.classList.add('hidden');
|
|
622
|
+
this._elements.statusToolbar.classList.add('hidden');
|
|
623
|
+
this._elements.feedbackToolbar.classList.add('hidden');
|
|
624
|
+
this.hideCreatePreview();
|
|
625
|
+
this.hideEditsPreview();
|
|
626
|
+
this._onDidChangeHeight.fire();
|
|
627
|
+
}
|
|
628
|
+
focus() {
|
|
629
|
+
this._inputEditor.focus();
|
|
630
|
+
}
|
|
631
|
+
hasFocus() {
|
|
632
|
+
return this.domNode.contains(getActiveElement());
|
|
633
|
+
}
|
|
634
|
+
async showEditsPreview(textModel0, textModelN, allEdits) {
|
|
635
|
+
this._elements.previewDiff.classList.remove('hidden');
|
|
636
|
+
const languageSelection = { languageId: textModel0.getLanguageId(), onDidChange: Event.None };
|
|
637
|
+
const modified = this._modelService.createModel(createTextBufferFactoryFromSnapshot(textModel0.createSnapshot()), languageSelection, undefined, true);
|
|
638
|
+
for (const edits of allEdits) {
|
|
639
|
+
modified.applyEdits(edits, false);
|
|
640
|
+
}
|
|
641
|
+
const diff = await this._editorWorkerService.computeDiff(textModel0.uri, modified.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: 5000, computeMoves: false }, 'advanced');
|
|
642
|
+
if (!diff || diff.changes.length === 0) {
|
|
643
|
+
this.hideEditsPreview();
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
this._previewDiffEditor.value.setModel({ original: textModel0, modified });
|
|
647
|
+
let originalLineRange = diff.changes[0].original;
|
|
648
|
+
let modifiedLineRange = diff.changes[0].modified;
|
|
649
|
+
for (let i = 1; i < diff.changes.length; i++) {
|
|
650
|
+
originalLineRange = originalLineRange.join(diff.changes[i].original);
|
|
651
|
+
modifiedLineRange = modifiedLineRange.join(diff.changes[i].modified);
|
|
652
|
+
}
|
|
653
|
+
const pad = 3;
|
|
654
|
+
const newStartLine = Math.max(1, originalLineRange.startLineNumber - pad);
|
|
655
|
+
modifiedLineRange = ( new LineRange(newStartLine, modifiedLineRange.endLineNumberExclusive));
|
|
656
|
+
originalLineRange = ( new LineRange(newStartLine, originalLineRange.endLineNumberExclusive));
|
|
657
|
+
const newEndLineModified = Math.min(modifiedLineRange.endLineNumberExclusive + pad, modified.getLineCount());
|
|
658
|
+
modifiedLineRange = ( new LineRange(modifiedLineRange.startLineNumber, newEndLineModified));
|
|
659
|
+
const newEndLineOriginal = Math.min(originalLineRange.endLineNumberExclusive + pad, textModel0.getLineCount());
|
|
660
|
+
originalLineRange = ( new LineRange(originalLineRange.startLineNumber, newEndLineOriginal));
|
|
661
|
+
const hiddenOriginal = invertLineRange(originalLineRange, textModel0);
|
|
662
|
+
const hiddenModified = invertLineRange(modifiedLineRange, modified);
|
|
663
|
+
this._previewDiffEditor.value.getOriginalEditor().setHiddenAreas(( hiddenOriginal.map(lineRangeAsRange)), 'diff-hidden');
|
|
664
|
+
this._previewDiffEditor.value.getModifiedEditor().setHiddenAreas(( hiddenModified.map(lineRangeAsRange)), 'diff-hidden');
|
|
665
|
+
this._previewDiffEditor.value.revealLine(modifiedLineRange.startLineNumber, 1 );
|
|
666
|
+
this._onDidChangeHeight.fire();
|
|
667
|
+
}
|
|
668
|
+
hideEditsPreview() {
|
|
669
|
+
this._elements.previewDiff.classList.add('hidden');
|
|
670
|
+
if (this._previewDiffEditor.hasValue) {
|
|
671
|
+
this._previewDiffEditor.value.setModel(null);
|
|
672
|
+
}
|
|
673
|
+
this._previewDiffModel.clear();
|
|
674
|
+
this._onDidChangeHeight.fire();
|
|
675
|
+
}
|
|
676
|
+
async showCreatePreview(model) {
|
|
677
|
+
this._elements.previewCreateTitle.classList.remove('hidden');
|
|
678
|
+
this._elements.previewCreate.classList.remove('hidden');
|
|
679
|
+
const ref = await this._textModelResolverService.createModelReference(model.resource);
|
|
680
|
+
this._previewCreateDispoable.value = ref;
|
|
681
|
+
this._previewCreateTitle.element.setFile(model.resource, { fileKind: FileKind.FILE });
|
|
682
|
+
this._previewCreateEditor.value.setModel(ref.object.textEditorModel);
|
|
683
|
+
this._onDidChangeHeight.fire();
|
|
684
|
+
}
|
|
685
|
+
hideCreatePreview() {
|
|
686
|
+
this._elements.previewCreateTitle.classList.add('hidden');
|
|
687
|
+
this._elements.previewCreate.classList.add('hidden');
|
|
688
|
+
this._previewCreateEditor.rawValue?.setModel(null);
|
|
689
|
+
this._previewCreateDispoable.clear();
|
|
690
|
+
this._previewCreateTitle.element.clear();
|
|
691
|
+
this._onDidChangeHeight.fire();
|
|
692
|
+
}
|
|
693
|
+
showsAnyPreview() {
|
|
694
|
+
return !this._elements.previewDiff.classList.contains('hidden') ||
|
|
695
|
+
!this._elements.previewCreate.classList.contains('hidden');
|
|
696
|
+
}
|
|
697
|
+
updateSlashCommands(commands) {
|
|
698
|
+
this._slashCommands.clear();
|
|
699
|
+
if (commands.length === 0) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
this._slashCommandDetails = ( commands.filter(c => c.command && c.detail).map(c => { return { command: c.command, detail: c.detail }; }));
|
|
703
|
+
const selector = { scheme: this._inputModel.uri.scheme, pattern: this._inputModel.uri.path, language: this._inputModel.getLanguageId() };
|
|
704
|
+
this._slashCommands.add(this._languageFeaturesService.completionProvider.register(selector, new (class {
|
|
705
|
+
constructor() {
|
|
706
|
+
this._debugDisplayName = 'InlineChatSlashCommandProvider';
|
|
707
|
+
this.triggerCharacters = ['/'];
|
|
708
|
+
}
|
|
709
|
+
provideCompletionItems(_model, position) {
|
|
710
|
+
if (position.lineNumber !== 1 && position.column !== 1) {
|
|
711
|
+
return undefined;
|
|
712
|
+
}
|
|
713
|
+
const suggestions = ( commands.map(command => {
|
|
714
|
+
const withSlash = `/${command.command}`;
|
|
715
|
+
return {
|
|
716
|
+
label: { label: withSlash, description: command.detail },
|
|
717
|
+
insertText: `${withSlash} $0`,
|
|
718
|
+
insertTextRules: 4 ,
|
|
719
|
+
kind: 18 ,
|
|
720
|
+
range: ( new Range(1, 1, 1, 1)),
|
|
721
|
+
command: command.executeImmediately ? { id: 'inlineChat.accept', title: withSlash } : undefined
|
|
722
|
+
};
|
|
723
|
+
}));
|
|
724
|
+
return { suggestions };
|
|
725
|
+
}
|
|
726
|
+
})));
|
|
727
|
+
const decorations = this._inputEditor.createDecorationsCollection();
|
|
728
|
+
const updateSlashDecorations = () => {
|
|
729
|
+
this._slashCommandContentWidget.hide();
|
|
730
|
+
const newDecorations = [];
|
|
731
|
+
for (const command of commands) {
|
|
732
|
+
const withSlash = `/${command.command}`;
|
|
733
|
+
const firstLine = this._inputModel.getLineContent(1);
|
|
734
|
+
if (firstLine.startsWith(withSlash)) {
|
|
735
|
+
newDecorations.push({
|
|
736
|
+
range: ( new Range(1, 1, 1, withSlash.length + 1)),
|
|
737
|
+
options: {
|
|
738
|
+
description: 'inline-chat-slash-command',
|
|
739
|
+
inlineClassName: 'inline-chat-slash-command',
|
|
740
|
+
after: {
|
|
741
|
+
content: ' '
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
this._slashCommandContentWidget.setCommandText(command.command);
|
|
746
|
+
this._slashCommandContentWidget.show();
|
|
747
|
+
if (firstLine === `/${command.command}`) {
|
|
748
|
+
newDecorations.push({
|
|
749
|
+
range: ( new Range(1, withSlash.length + 1, 1, withSlash.length + 2)),
|
|
750
|
+
options: {
|
|
751
|
+
description: 'inline-chat-slash-command-detail',
|
|
752
|
+
after: {
|
|
753
|
+
content: `${command.detail}`,
|
|
754
|
+
inlineClassName: 'inline-chat-slash-command-detail'
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
decorations.set(newDecorations);
|
|
763
|
+
};
|
|
764
|
+
this._slashCommands.add(this._inputEditor.onDidChangeModelContent(updateSlashDecorations));
|
|
765
|
+
updateSlashDecorations();
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
InlineChatWidget = InlineChatWidget_1 = ( __decorate([
|
|
769
|
+
( __param(2, IModelService)),
|
|
770
|
+
( __param(3, IContextKeyService)),
|
|
771
|
+
( __param(4, ILanguageFeaturesService)),
|
|
772
|
+
( __param(5, IKeybindingService)),
|
|
773
|
+
( __param(6, IInstantiationService)),
|
|
774
|
+
( __param(7, IAccessibilityService)),
|
|
775
|
+
( __param(8, IConfigurationService)),
|
|
776
|
+
( __param(9, IContextMenuService)),
|
|
777
|
+
( __param(10, IAccessibleViewService)),
|
|
778
|
+
( __param(11, IEditorWorkerService)),
|
|
779
|
+
( __param(12, ILogService)),
|
|
780
|
+
( __param(13, ITextModelService)),
|
|
781
|
+
( __param(14, IChatAgentService))
|
|
782
|
+
], InlineChatWidget));
|
|
783
|
+
let InlineChatZoneWidget = class InlineChatZoneWidget extends ZoneWidget {
|
|
784
|
+
constructor(editor, _instaService, contextKeyService) {
|
|
785
|
+
super(editor, { showFrame: false, showArrow: false, isAccessible: true, className: 'inline-chat-widget', keepEditorSelection: true, showInHiddenAreas: true, ordinal: 10000 });
|
|
786
|
+
this._instaService = _instaService;
|
|
787
|
+
this._ctxVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
|
|
788
|
+
this._ctxCursorPosition = CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.bindTo(contextKeyService);
|
|
789
|
+
this._disposables.add(toDisposable(() => {
|
|
790
|
+
this._ctxVisible.reset();
|
|
791
|
+
this._ctxCursorPosition.reset();
|
|
792
|
+
}));
|
|
793
|
+
this.widget = this._instaService.createInstance(InlineChatWidget, this.editor, {
|
|
794
|
+
menuId: MENU_INLINE_CHAT_WIDGET,
|
|
795
|
+
statusMenuId: MENU_INLINE_CHAT_WIDGET_STATUS,
|
|
796
|
+
feedbackMenuId: MENU_INLINE_CHAT_WIDGET_FEEDBACK
|
|
797
|
+
});
|
|
798
|
+
this._disposables.add(this.widget.onDidChangeHeight(() => this._relayout()));
|
|
799
|
+
this._disposables.add(this.widget);
|
|
800
|
+
this.create();
|
|
801
|
+
this._disposables.add(addDisposableListener(this.domNode, 'click', e => {
|
|
802
|
+
if (!this.widget.hasFocus()) {
|
|
803
|
+
this.widget.focus();
|
|
804
|
+
}
|
|
805
|
+
}, true));
|
|
806
|
+
const updateCursorIsAboveContextKey = () => {
|
|
807
|
+
if (!this.position || !this.editor.hasModel()) {
|
|
808
|
+
this._ctxCursorPosition.reset();
|
|
809
|
+
}
|
|
810
|
+
else if (this.position.lineNumber === this.editor.getPosition().lineNumber) {
|
|
811
|
+
this._ctxCursorPosition.set('above');
|
|
812
|
+
}
|
|
813
|
+
else if (this.position.lineNumber + 1 === this.editor.getPosition().lineNumber) {
|
|
814
|
+
this._ctxCursorPosition.set('below');
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
this._ctxCursorPosition.reset();
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
this._disposables.add(this.editor.onDidChangeCursorPosition(e => updateCursorIsAboveContextKey()));
|
|
821
|
+
this._disposables.add(this.editor.onDidFocusEditorText(e => updateCursorIsAboveContextKey()));
|
|
822
|
+
updateCursorIsAboveContextKey();
|
|
823
|
+
}
|
|
824
|
+
_fillContainer(container) {
|
|
825
|
+
container.appendChild(this.widget.domNode);
|
|
826
|
+
}
|
|
827
|
+
_doLayout(heightInPixel) {
|
|
828
|
+
const maxWidth = !this.widget.showsAnyPreview() ? 640 : Number.MAX_SAFE_INTEGER;
|
|
829
|
+
const width = Math.min(maxWidth, this._availableSpaceGivenIndentation(this._indentationWidth));
|
|
830
|
+
this._dimension = ( new Dimension(width, heightInPixel));
|
|
831
|
+
this.widget.domNode.style.width = `${width}px`;
|
|
832
|
+
this.widget.layout(this._dimension);
|
|
833
|
+
}
|
|
834
|
+
_availableSpaceGivenIndentation(indentationWidth) {
|
|
835
|
+
const info = this.editor.getLayoutInfo();
|
|
836
|
+
return info.contentWidth - (info.glyphMarginWidth + info.decorationsWidth + (indentationWidth ?? 0));
|
|
837
|
+
}
|
|
838
|
+
_computeHeightInLines() {
|
|
839
|
+
const lineHeight = this.editor.getOption(66 );
|
|
840
|
+
return this.widget.getHeight() / lineHeight;
|
|
841
|
+
}
|
|
842
|
+
_relayout() {
|
|
843
|
+
if (this._dimension) {
|
|
844
|
+
this._doLayout(this._dimension.height);
|
|
845
|
+
}
|
|
846
|
+
super._relayout(this._computeHeightInLines());
|
|
847
|
+
}
|
|
848
|
+
show(position) {
|
|
849
|
+
super.show(position, this._computeHeightInLines());
|
|
850
|
+
this.widget.focus();
|
|
851
|
+
this._ctxVisible.set(true);
|
|
852
|
+
}
|
|
853
|
+
_getWidth(info) {
|
|
854
|
+
return info.width - info.minimap.minimapWidth;
|
|
855
|
+
}
|
|
856
|
+
updateBackgroundColor(newPosition, wholeRange) {
|
|
857
|
+
assertType(this.container);
|
|
858
|
+
const widgetLineNumber = newPosition.lineNumber;
|
|
859
|
+
this.container.classList.toggle('inside-selection', widgetLineNumber > wholeRange.startLineNumber && widgetLineNumber < wholeRange.endLineNumber);
|
|
860
|
+
}
|
|
861
|
+
_calculateIndentationWidth(position) {
|
|
862
|
+
const viewModel = this.editor._getViewModel();
|
|
863
|
+
if (!viewModel) {
|
|
864
|
+
return 0;
|
|
865
|
+
}
|
|
866
|
+
const visibleRange = viewModel.getCompletelyVisibleViewRange();
|
|
867
|
+
const startLineVisibleRange = visibleRange.startLineNumber;
|
|
868
|
+
const positionLine = position.lineNumber;
|
|
869
|
+
let indentationLineNumber;
|
|
870
|
+
let indentationLevel;
|
|
871
|
+
for (let lineNumber = positionLine; lineNumber >= startLineVisibleRange; lineNumber--) {
|
|
872
|
+
const currentIndentationLevel = viewModel.getLineFirstNonWhitespaceColumn(lineNumber);
|
|
873
|
+
if (currentIndentationLevel !== 0) {
|
|
874
|
+
indentationLineNumber = lineNumber;
|
|
875
|
+
indentationLevel = currentIndentationLevel;
|
|
876
|
+
break;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return this.editor.getOffsetForColumn(indentationLineNumber ?? positionLine, indentationLevel ?? viewModel.getLineFirstNonWhitespaceColumn(positionLine));
|
|
880
|
+
}
|
|
881
|
+
setContainerMargins() {
|
|
882
|
+
assertType(this.container);
|
|
883
|
+
const info = this.editor.getLayoutInfo();
|
|
884
|
+
const marginWithoutIndentation = info.glyphMarginWidth + info.decorationsWidth + info.lineNumbersWidth;
|
|
885
|
+
this.container.style.marginLeft = `${marginWithoutIndentation}px`;
|
|
886
|
+
}
|
|
887
|
+
setWidgetMargins(position, indentationWidth) {
|
|
888
|
+
if (indentationWidth === undefined) {
|
|
889
|
+
indentationWidth = this._calculateIndentationWidth(position);
|
|
890
|
+
}
|
|
891
|
+
if (this._indentationWidth === indentationWidth) {
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
894
|
+
this._indentationWidth = this._availableSpaceGivenIndentation(indentationWidth) > 400 ? indentationWidth : 0;
|
|
895
|
+
this.widget.domNode.style.marginLeft = `${this._indentationWidth}px`;
|
|
896
|
+
this.widget.domNode.style.marginRight = `${this.editor.getLayoutInfo().minimap.minimapWidth}px`;
|
|
897
|
+
}
|
|
898
|
+
hide() {
|
|
899
|
+
this.container.classList.remove('inside-selection');
|
|
900
|
+
this._ctxVisible.reset();
|
|
901
|
+
this._ctxCursorPosition.reset();
|
|
902
|
+
this.widget.reset();
|
|
903
|
+
super.hide();
|
|
904
|
+
aria.status(( localizeWithPath(
|
|
905
|
+
'vs/workbench/contrib/inlineChat/browser/inlineChatWidget',
|
|
906
|
+
'inlineChatClosed',
|
|
907
|
+
'Closed inline chat widget'
|
|
908
|
+
)));
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
InlineChatZoneWidget = ( __decorate([
|
|
912
|
+
( __param(1, IInstantiationService)),
|
|
913
|
+
( __param(2, IContextKeyService))
|
|
914
|
+
], InlineChatZoneWidget));
|
|
915
|
+
export { InlineChatWidget, InlineChatZoneWidget, _inputEditorOptions };
|