@codingame/monaco-vscode-chat-service-override 15.0.2 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -8
- package/package.json +29 -20
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +22 -0
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +80 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +17 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/{askToSelectPrompt.d.ts → askToSelectPrompt/askToSelectPrompt.d.ts} +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/askToSelectPrompt.js +79 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/constants.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/attachPrompts.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPlaceholderText.js +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/createPromptPickItem.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt/utils/handleButtonClick.js +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +163 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +22 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTransfer.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +242 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.js +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +47 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +688 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +355 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +395 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +98 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +216 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +97 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +831 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +32 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +110 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +985 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookDiff.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +147 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +284 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +578 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookFileSystemProvider.js +122 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.js +320 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.js +50 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +22 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +166 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +6 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +704 -732
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +10 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +329 -236
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatusItemService.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +14 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +217 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditorController.css +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css +90 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +65 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +14 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +16 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +175 -57
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.d.ts +66 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +313 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatTransferService.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +18 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkDiagnosticsProvider.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +3 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +157 -65
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +39 -21
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +11 -10
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +47 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.d.ts +5 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceUtils.js +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +0 -142
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +0 -331
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +0 -85
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/common/tools/tools.js +0 -22
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import './media/chatStatus.css
|
|
3
|
+
import './media/chatStatus.css';
|
|
4
4
|
import { safeIntl } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
|
|
5
|
-
import { Disposable, MutableDisposable, DisposableStore
|
|
6
|
-
import { language
|
|
5
|
+
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { language } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
7
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
-
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
-
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
10
|
-
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
11
8
|
import { StatusbarAlignment, ShowTooltipCommand } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
12
9
|
import { IStatusbarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { IChatEntitlementsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEntitlementsService.service';
|
|
18
|
-
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
19
|
-
import { KeybindingLabel } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/keybindingLabel/keybindingLabel';
|
|
20
|
-
import { defaultKeybindingLabelStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
10
|
+
import { $, clearNode, append, EventType, addDisposableListener, EventHelper } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
11
|
+
import { ChatSentiment, ChatEntitlement } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/chat/common/chatEntitlementService';
|
|
12
|
+
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEntitlementService.service';
|
|
13
|
+
import { defaultButtonStyles, defaultCheckboxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
21
14
|
import { Checkbox } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
|
|
22
15
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
23
16
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
@@ -34,89 +27,93 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/misc
|
|
|
34
27
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
35
28
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
36
29
|
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
37
|
-
import { coalesce } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
38
|
-
import { CTX_INLINE_CHAT_POSSIBLE } from '@codingame/monaco-vscode-9a6d8b6c-ad4c-5ea3-9558-f43d6dc4c0ad-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
39
|
-
import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
|
|
40
30
|
import { Color } from '@codingame/monaco-vscode-api/vscode/vs/base/common/color';
|
|
41
|
-
import { StandardKeyboardEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/keyboardEvent';
|
|
42
|
-
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
43
31
|
import { Gesture, EventType as EventType$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/touch';
|
|
44
32
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
45
|
-
import
|
|
33
|
+
import product from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/product';
|
|
46
34
|
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
47
35
|
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
36
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
37
|
+
import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
38
|
+
import { renderLabelWithIcons } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
39
|
+
import { parseLinkedText } from '@codingame/monaco-vscode-api/vscode/vs/base/common/linkedText';
|
|
40
|
+
import { Link } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/browser/link';
|
|
41
|
+
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
42
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
43
|
+
import { IChatStatusItemService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatStatusItemService.service';
|
|
44
|
+
import { ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
45
|
+
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
46
|
+
import { getCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
48
47
|
|
|
49
|
-
var ChatStatusBarEntry_1;
|
|
50
48
|
const gaugeBackground = registerColor('gauge.background', {
|
|
51
49
|
dark: inputValidationInfoBorder,
|
|
52
50
|
light: inputValidationInfoBorder,
|
|
53
51
|
hcDark: contrastBorder,
|
|
54
52
|
hcLight: contrastBorder
|
|
55
|
-
}, ( localize(
|
|
53
|
+
}, ( localize(4841, "Gauge background color.")));
|
|
56
54
|
registerColor('gauge.foreground', {
|
|
57
55
|
dark: ( transparent(gaugeBackground, 0.3)),
|
|
58
56
|
light: ( transparent(gaugeBackground, 0.3)),
|
|
59
57
|
hcDark: Color.white,
|
|
60
58
|
hcLight: Color.white
|
|
61
|
-
}, ( localize(
|
|
59
|
+
}, ( localize(4842, "Gauge foreground color.")));
|
|
62
60
|
registerColor('gauge.border', {
|
|
63
61
|
dark: null,
|
|
64
62
|
light: null,
|
|
65
63
|
hcDark: contrastBorder,
|
|
66
64
|
hcLight: contrastBorder
|
|
67
|
-
}, ( localize(
|
|
65
|
+
}, ( localize(4843, "Gauge border color.")));
|
|
68
66
|
const gaugeWarningBackground = registerColor('gauge.warningBackground', {
|
|
69
67
|
dark: inputValidationWarningBorder,
|
|
70
68
|
light: inputValidationWarningBorder,
|
|
71
69
|
hcDark: contrastBorder,
|
|
72
70
|
hcLight: contrastBorder
|
|
73
|
-
}, ( localize(
|
|
71
|
+
}, ( localize(4844, "Gauge warning background color.")));
|
|
74
72
|
registerColor('gauge.warningForeground', {
|
|
75
73
|
dark: ( transparent(gaugeWarningBackground, 0.3)),
|
|
76
74
|
light: ( transparent(gaugeWarningBackground, 0.3)),
|
|
77
75
|
hcDark: Color.white,
|
|
78
76
|
hcLight: Color.white
|
|
79
|
-
}, ( localize(
|
|
77
|
+
}, ( localize(4845, "Gauge warning foreground color.")));
|
|
80
78
|
const gaugeErrorBackground = registerColor('gauge.errorBackground', {
|
|
81
79
|
dark: inputValidationErrorBorder,
|
|
82
80
|
light: inputValidationErrorBorder,
|
|
83
81
|
hcDark: contrastBorder,
|
|
84
82
|
hcLight: contrastBorder
|
|
85
|
-
}, ( localize(
|
|
83
|
+
}, ( localize(4846, "Gauge error background color.")));
|
|
86
84
|
registerColor('gauge.errorForeground', {
|
|
87
85
|
dark: ( transparent(gaugeErrorBackground, 0.3)),
|
|
88
86
|
light: ( transparent(gaugeErrorBackground, 0.3)),
|
|
89
87
|
hcDark: Color.white,
|
|
90
88
|
hcLight: Color.white
|
|
91
|
-
}, ( localize(
|
|
89
|
+
}, ( localize(4847, "Gauge error foreground color.")));
|
|
90
|
+
const defaultChat = {
|
|
91
|
+
extensionId: product.defaultChatAgent?.extensionId ?? '',
|
|
92
|
+
completionsEnablementSetting: product.defaultChatAgent?.completionsEnablementSetting ?? '',
|
|
93
|
+
nextEditSuggestionsSetting: product.defaultChatAgent?.nextEditSuggestionsSetting ?? ''
|
|
94
|
+
};
|
|
92
95
|
let ChatStatusBarEntry = class ChatStatusBarEntry extends Disposable {
|
|
93
|
-
static {
|
|
94
|
-
|
|
95
|
-
constructor(statusbarService, chatQuotasService, chatEntitlementsService, contextKeyService, keybindingService, configurationService, commandService, hoverService, editorService, productService, languageService) {
|
|
96
|
+
static { this.ID = 'workbench.contrib.chatStatusBarEntry'; }
|
|
97
|
+
constructor(chatEntitlementService, instantiationService, statusbarService, editorService, configurationService) {
|
|
96
98
|
super();
|
|
99
|
+
this.chatEntitlementService = chatEntitlementService;
|
|
100
|
+
this.instantiationService = instantiationService;
|
|
97
101
|
this.statusbarService = statusbarService;
|
|
98
|
-
this.chatQuotasService = chatQuotasService;
|
|
99
|
-
this.chatEntitlementsService = chatEntitlementsService;
|
|
100
|
-
this.contextKeyService = contextKeyService;
|
|
101
|
-
this.keybindingService = keybindingService;
|
|
102
|
-
this.configurationService = configurationService;
|
|
103
|
-
this.commandService = commandService;
|
|
104
|
-
this.hoverService = hoverService;
|
|
105
102
|
this.editorService = editorService;
|
|
106
|
-
this.
|
|
107
|
-
this.languageService = languageService;
|
|
103
|
+
this.configurationService = configurationService;
|
|
108
104
|
this.entry = undefined;
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
() => safeIntl.DateTimeFormat(language, { year: 'numeric', month: 'long', day: 'numeric' })
|
|
112
|
-
));
|
|
105
|
+
this.dashboard = ( new Lazy(() => this.instantiationService.createInstance(ChatStatusDashboard)));
|
|
106
|
+
this.activeCodeEditorListener = this._register(( new MutableDisposable()));
|
|
113
107
|
this.create();
|
|
114
108
|
this.registerListeners();
|
|
115
109
|
}
|
|
116
110
|
async create() {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.statusbarService.
|
|
111
|
+
const hidden = this.chatEntitlementService.sentiment === ChatSentiment.Disabled;
|
|
112
|
+
if (!hidden) {
|
|
113
|
+
this.entry ||= this.statusbarService.addEntry(this.getEntryProps(), 'chat.statusBarEntry', StatusbarAlignment.RIGHT, { location: { id: 'status.editor.mode', priority: 100.1 }, alignment: StatusbarAlignment.RIGHT });
|
|
114
|
+
const completionsStatusId = `${defaultChat.extensionId}.status`;
|
|
115
|
+
this.statusbarService.updateEntryVisibility(completionsStatusId, false);
|
|
116
|
+
this.statusbarService.overrideEntry(completionsStatusId, { name: ( localize(4848, "Copilot Code Completions")), text: ( localize(4849, "$(copilot) Completions")) });
|
|
120
117
|
}
|
|
121
118
|
else {
|
|
122
119
|
this.entry?.dispose();
|
|
@@ -124,126 +121,231 @@ let ChatStatusBarEntry = class ChatStatusBarEntry extends Disposable {
|
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
123
|
registerListeners() {
|
|
124
|
+
this._register(this.chatEntitlementService.onDidChangeQuotaExceeded(() => this.entry?.update(this.getEntryProps())));
|
|
125
|
+
this._register(this.chatEntitlementService.onDidChangeSentiment(() => this.entry?.update(this.getEntryProps())));
|
|
126
|
+
this._register(this.chatEntitlementService.onDidChangeEntitlement(() => this.entry?.update(this.getEntryProps())));
|
|
127
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.onDidActiveEditorChange()));
|
|
127
128
|
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
128
|
-
if (e.affectsConfiguration(
|
|
129
|
-
this.
|
|
129
|
+
if (e.affectsConfiguration(defaultChat.completionsEnablementSetting)) {
|
|
130
|
+
this.entry?.update(this.getEntryProps());
|
|
130
131
|
}
|
|
131
132
|
}));
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (e.affectsSome(contextKeysSet)) {
|
|
143
|
-
this.entry.update(this.getEntryProps());
|
|
144
|
-
}
|
|
145
|
-
}));
|
|
146
|
-
this._register(this.chatQuotasService.onDidChangeQuotaExceeded(() => this.entry?.update(this.getEntryProps())));
|
|
133
|
+
}
|
|
134
|
+
onDidActiveEditorChange() {
|
|
135
|
+
this.entry?.update(this.getEntryProps());
|
|
136
|
+
this.activeCodeEditorListener.clear();
|
|
137
|
+
const activeCodeEditor = getCodeEditor(this.editorService.activeTextEditorControl);
|
|
138
|
+
if (activeCodeEditor) {
|
|
139
|
+
this.activeCodeEditorListener.value = activeCodeEditor.onDidChangeModelLanguage(() => {
|
|
140
|
+
this.entry?.update(this.getEntryProps());
|
|
141
|
+
});
|
|
142
|
+
}
|
|
147
143
|
}
|
|
148
144
|
getEntryProps() {
|
|
149
|
-
const disposables = ( new DisposableStore());
|
|
150
|
-
this.entryDisposables.value = disposables;
|
|
151
145
|
let text = '$(copilot)';
|
|
152
|
-
let ariaLabel = ( localize(
|
|
153
|
-
let command = TOGGLE_CHAT_ACTION_ID;
|
|
154
|
-
let tooltip;
|
|
146
|
+
let ariaLabel = ( localize(4850, "Copilot Status"));
|
|
155
147
|
let kind;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
quotaWarning = ( localize(4738, "Completions limit reached"));
|
|
148
|
+
if (!isNewUser(this.chatEntitlementService)) {
|
|
149
|
+
const { chatQuotaExceeded, completionsQuotaExceeded } = this.chatEntitlementService.quotas;
|
|
150
|
+
if (this.chatEntitlementService.entitlement === ChatEntitlement.Unknown) {
|
|
151
|
+
const signedOutWarning = ( localize(4851, "Signed out"));
|
|
152
|
+
text = `$(copilot-not-connected) ${signedOutWarning}`;
|
|
153
|
+
ariaLabel = signedOutWarning;
|
|
154
|
+
kind = 'prominent';
|
|
164
155
|
}
|
|
165
|
-
else {
|
|
166
|
-
quotaWarning
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
ariaLabel = quotaWarning;
|
|
170
|
-
command = OPEN_CHAT_QUOTA_EXCEEDED_DIALOG;
|
|
171
|
-
tooltip = quotaToButtonMessage({ chatQuotaExceeded, completionsQuotaExceeded });
|
|
172
|
-
kind = 'prominent';
|
|
173
|
-
}
|
|
174
|
-
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.installed.key) === false ||
|
|
175
|
-
this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.canSignUp.key) === true) {
|
|
176
|
-
tooltip = CHAT_SETUP_ACTION_LABEL.value;
|
|
177
|
-
}
|
|
178
|
-
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.signedOut.key) === true) {
|
|
179
|
-
text = '$(copilot-not-connected)';
|
|
180
|
-
ariaLabel = ( localize(4740, "Sign in to Use Copilot..."));
|
|
181
|
-
tooltip = ( localize(4740, "Sign in to Use Copilot..."));
|
|
182
|
-
}
|
|
183
|
-
else if (this.contextKeyService.getContextKeyValue(ChatContextKeys.Setup.limited.key) === true) {
|
|
184
|
-
tooltip = () => {
|
|
185
|
-
const container = $('div.chat-status-bar-entry-tooltip');
|
|
186
|
-
{
|
|
187
|
-
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining, quotaResetDate } = this.chatQuotasService.quotas;
|
|
188
|
-
container.appendChild($('div.header', undefined, ( localize(4741, "Copilot Free Usage"))));
|
|
189
|
-
const chatQuotaIndicator = this.createQuotaIndicator(container, chatTotal, chatRemaining, ( localize(4742, "Chat messages")));
|
|
190
|
-
const completionsQuotaIndicator = this.createQuotaIndicator(container, completionsTotal, completionsRemaining, ( localize(4743, "Code completions")));
|
|
191
|
-
container.appendChild($('div.description', undefined, ( localize(
|
|
192
|
-
4744,
|
|
193
|
-
"Limits will reset on {0}.",
|
|
194
|
-
this.dateFormatter.value.format(quotaResetDate)
|
|
195
|
-
))));
|
|
196
|
-
const cts = ( new CancellationTokenSource());
|
|
197
|
-
disposables.add(toDisposable(() => cts.dispose(true)));
|
|
198
|
-
this.chatEntitlementsService.resolve(cts.token).then(() => {
|
|
199
|
-
if (cts.token.isCancellationRequested) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining } = this.chatQuotasService.quotas;
|
|
203
|
-
chatQuotaIndicator(chatTotal, chatRemaining);
|
|
204
|
-
completionsQuotaIndicator(completionsTotal, completionsRemaining);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
{
|
|
208
|
-
container.appendChild($('hr'));
|
|
209
|
-
container.appendChild($('div.header', undefined, ( localize(4745, "Settings"))));
|
|
210
|
-
this.createSettings(container, disposables);
|
|
156
|
+
else if (chatQuotaExceeded || completionsQuotaExceeded) {
|
|
157
|
+
let quotaWarning;
|
|
158
|
+
if (chatQuotaExceeded && !completionsQuotaExceeded) {
|
|
159
|
+
quotaWarning = ( localize(4852, "Chat limit reached"));
|
|
211
160
|
}
|
|
212
|
-
{
|
|
213
|
-
|
|
214
|
-
container.appendChild($('div.header', undefined, ( localize(4746, "Keybindings"))));
|
|
215
|
-
this.createShortcuts(container, disposables);
|
|
216
|
-
}
|
|
217
|
-
return container;
|
|
218
|
-
};
|
|
219
|
-
command = ShowTooltipCommand;
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
tooltip = () => {
|
|
223
|
-
const container = $('div.chat-status-bar-entry-tooltip');
|
|
224
|
-
{
|
|
225
|
-
container.appendChild($('div.header', undefined, ( localize(4745, "Settings"))));
|
|
226
|
-
this.createSettings(container, disposables);
|
|
161
|
+
else if (completionsQuotaExceeded && !chatQuotaExceeded) {
|
|
162
|
+
quotaWarning = ( localize(4853, "Completions limit reached"));
|
|
227
163
|
}
|
|
228
|
-
{
|
|
229
|
-
|
|
230
|
-
container.appendChild($('div.header', undefined, ( localize(4746, "Keybindings"))));
|
|
231
|
-
this.createShortcuts(container, disposables);
|
|
164
|
+
else {
|
|
165
|
+
quotaWarning = ( localize(4854, "Limit reached"));
|
|
232
166
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
167
|
+
text = `$(copilot-warning) ${quotaWarning}`;
|
|
168
|
+
ariaLabel = quotaWarning;
|
|
169
|
+
kind = 'prominent';
|
|
170
|
+
}
|
|
171
|
+
else if (this.editorService.activeTextEditorLanguageId && !isCompletionsEnabled(this.configurationService, this.editorService.activeTextEditorLanguageId)) {
|
|
172
|
+
text = `$(copilot-not-connected)`;
|
|
173
|
+
ariaLabel = ( localize(4855, "Code Completions Disabled"));
|
|
174
|
+
}
|
|
236
175
|
}
|
|
237
176
|
return {
|
|
238
|
-
name: ( localize(
|
|
177
|
+
name: ( localize(4850, "Copilot Status")),
|
|
239
178
|
text,
|
|
240
179
|
ariaLabel,
|
|
241
|
-
command,
|
|
180
|
+
command: ShowTooltipCommand,
|
|
242
181
|
showInAllWindows: true,
|
|
243
182
|
kind,
|
|
244
|
-
tooltip
|
|
183
|
+
tooltip: { element: token => this.dashboard.value.show(token) }
|
|
245
184
|
};
|
|
246
185
|
}
|
|
186
|
+
dispose() {
|
|
187
|
+
super.dispose();
|
|
188
|
+
this.entry?.dispose();
|
|
189
|
+
this.entry = undefined;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
ChatStatusBarEntry = ( __decorate([
|
|
193
|
+
( __param(0, IChatEntitlementService)),
|
|
194
|
+
( __param(1, IInstantiationService)),
|
|
195
|
+
( __param(2, IStatusbarService)),
|
|
196
|
+
( __param(3, IEditorService)),
|
|
197
|
+
( __param(4, IConfigurationService))
|
|
198
|
+
], ChatStatusBarEntry));
|
|
199
|
+
function isNewUser(chatEntitlementService) {
|
|
200
|
+
return chatEntitlementService.sentiment !== ChatSentiment.Installed ||
|
|
201
|
+
chatEntitlementService.entitlement === ChatEntitlement.Available;
|
|
202
|
+
}
|
|
203
|
+
function canUseCopilot(chatEntitlementService) {
|
|
204
|
+
const newUser = isNewUser(chatEntitlementService);
|
|
205
|
+
const signedOut = chatEntitlementService.entitlement === ChatEntitlement.Unknown;
|
|
206
|
+
const allQuotaReached = chatEntitlementService.quotas.chatQuotaExceeded && chatEntitlementService.quotas.completionsQuotaExceeded;
|
|
207
|
+
return !newUser && !signedOut && !allQuotaReached;
|
|
208
|
+
}
|
|
209
|
+
function isCompletionsEnabled(configurationService, modeId = '*') {
|
|
210
|
+
const result = configurationService.getValue(defaultChat.completionsEnablementSetting);
|
|
211
|
+
if (!isObject(result)) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (typeof result[modeId] !== 'undefined') {
|
|
215
|
+
return Boolean(result[modeId]);
|
|
216
|
+
}
|
|
217
|
+
return Boolean(result['*']);
|
|
218
|
+
}
|
|
219
|
+
let ChatStatusDashboard = class ChatStatusDashboard extends Disposable {
|
|
220
|
+
constructor(chatEntitlementService, chatStatusItemService, commandService, configurationService, editorService, hoverService, languageService, openerService, telemetryService, textResourceConfigurationService) {
|
|
221
|
+
super();
|
|
222
|
+
this.chatEntitlementService = chatEntitlementService;
|
|
223
|
+
this.chatStatusItemService = chatStatusItemService;
|
|
224
|
+
this.commandService = commandService;
|
|
225
|
+
this.configurationService = configurationService;
|
|
226
|
+
this.editorService = editorService;
|
|
227
|
+
this.hoverService = hoverService;
|
|
228
|
+
this.languageService = languageService;
|
|
229
|
+
this.openerService = openerService;
|
|
230
|
+
this.telemetryService = telemetryService;
|
|
231
|
+
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
232
|
+
this.element = $('div.chat-status-bar-entry-tooltip');
|
|
233
|
+
this.dateFormatter = ( new Lazy(
|
|
234
|
+
() => safeIntl.DateTimeFormat(language, { year: 'numeric', month: 'long', day: 'numeric' })
|
|
235
|
+
));
|
|
236
|
+
this.entryDisposables = this._register(( new MutableDisposable()));
|
|
237
|
+
}
|
|
238
|
+
show(token) {
|
|
239
|
+
clearNode(this.element);
|
|
240
|
+
const disposables = this.entryDisposables.value = ( new DisposableStore());
|
|
241
|
+
disposables.add(token.onCancellationRequested(() => disposables.dispose()));
|
|
242
|
+
let needsSeparator = false;
|
|
243
|
+
const addSeparator = (label) => {
|
|
244
|
+
if (needsSeparator) {
|
|
245
|
+
this.element.appendChild($('hr'));
|
|
246
|
+
needsSeparator = false;
|
|
247
|
+
}
|
|
248
|
+
if (label) {
|
|
249
|
+
this.element.appendChild($('div.header', undefined, label));
|
|
250
|
+
}
|
|
251
|
+
needsSeparator = true;
|
|
252
|
+
};
|
|
253
|
+
if (this.chatEntitlementService.entitlement === ChatEntitlement.Limited) {
|
|
254
|
+
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining, quotaResetDate, chatQuotaExceeded, completionsQuotaExceeded } = this.chatEntitlementService.quotas;
|
|
255
|
+
addSeparator(( localize(4856, "Copilot Free Plan Usage")));
|
|
256
|
+
const chatQuotaIndicator = this.createQuotaIndicator(this.element, chatTotal, chatRemaining, ( localize(4857, "Chat messages")));
|
|
257
|
+
const completionsQuotaIndicator = this.createQuotaIndicator(this.element, completionsTotal, completionsRemaining, ( localize(4858, "Code completions")));
|
|
258
|
+
this.element.appendChild($('div.description', undefined, ( localize(
|
|
259
|
+
4859,
|
|
260
|
+
"Limits will reset on {0}.",
|
|
261
|
+
this.dateFormatter.value.format(quotaResetDate)
|
|
262
|
+
))));
|
|
263
|
+
if (chatQuotaExceeded || completionsQuotaExceeded) {
|
|
264
|
+
const upgradePlanButton = disposables.add(( new Button(
|
|
265
|
+
this.element,
|
|
266
|
+
{ ...defaultButtonStyles, secondary: canUseCopilot(this.chatEntitlementService) }
|
|
267
|
+
)));
|
|
268
|
+
upgradePlanButton.label = ( localize(4860, "Upgrade to Copilot Pro"));
|
|
269
|
+
disposables.add(upgradePlanButton.onDidClick(() => this.runCommandAndClose('workbench.action.chat.upgradePlan')));
|
|
270
|
+
}
|
|
271
|
+
(async () => {
|
|
272
|
+
await this.chatEntitlementService.update(token);
|
|
273
|
+
if (token.isCancellationRequested) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining } = this.chatEntitlementService.quotas;
|
|
277
|
+
chatQuotaIndicator(chatTotal, chatRemaining);
|
|
278
|
+
completionsQuotaIndicator(completionsTotal, completionsRemaining);
|
|
279
|
+
})();
|
|
280
|
+
}
|
|
281
|
+
{
|
|
282
|
+
for (const item of this.chatStatusItemService.getEntries()) {
|
|
283
|
+
addSeparator(undefined);
|
|
284
|
+
const chatItemDisposables = disposables.add(( new MutableDisposable()));
|
|
285
|
+
let rendered = this.renderContributedChatStatusItem(item);
|
|
286
|
+
chatItemDisposables.value = rendered.disposables;
|
|
287
|
+
this.element.appendChild(rendered.element);
|
|
288
|
+
disposables.add(this.chatStatusItemService.onDidChange(e => {
|
|
289
|
+
if (e.entry.id === item.id) {
|
|
290
|
+
const oldEl = rendered.element;
|
|
291
|
+
rendered = this.renderContributedChatStatusItem(e.entry);
|
|
292
|
+
chatItemDisposables.value = rendered.disposables;
|
|
293
|
+
oldEl.replaceWith(rendered.element);
|
|
294
|
+
}
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
{
|
|
299
|
+
addSeparator(( localize(4861, "Settings")));
|
|
300
|
+
this.createSettings(this.element, disposables);
|
|
301
|
+
}
|
|
302
|
+
{
|
|
303
|
+
const newUser = isNewUser(this.chatEntitlementService);
|
|
304
|
+
const signedOut = this.chatEntitlementService.entitlement === ChatEntitlement.Unknown;
|
|
305
|
+
if (newUser || signedOut) {
|
|
306
|
+
addSeparator(undefined);
|
|
307
|
+
this.element.appendChild($('div.description', undefined, newUser ? ( localize(4862, "Set up Copilot to use AI features.")) : ( localize(4863, "Sign in to use Copilot AI features."))));
|
|
308
|
+
const button = disposables.add(( new Button(this.element, { ...defaultButtonStyles })));
|
|
309
|
+
button.label = newUser ? ( localize(4864, "Set up Copilot")) : ( localize(4865, "Sign in to use Copilot"));
|
|
310
|
+
disposables.add(button.onDidClick(() => this.runCommandAndClose(newUser ? 'workbench.action.chat.triggerSetup' : () => this.chatEntitlementService.requests?.value.signIn())));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return this.element;
|
|
314
|
+
}
|
|
315
|
+
renderContributedChatStatusItem(item) {
|
|
316
|
+
const disposables = ( new DisposableStore());
|
|
317
|
+
const entryEl = $('div.contribution');
|
|
318
|
+
entryEl.appendChild($('div.header', undefined, item.label));
|
|
319
|
+
const bodyEl = entryEl.appendChild($('div.body'));
|
|
320
|
+
const descriptionEl = bodyEl.appendChild($('span.description'));
|
|
321
|
+
this.renderTextPlus(descriptionEl, item.description, disposables);
|
|
322
|
+
if (item.detail) {
|
|
323
|
+
const itemElement = bodyEl.appendChild($('div.detail-item'));
|
|
324
|
+
this.renderTextPlus(itemElement, item.detail, disposables);
|
|
325
|
+
}
|
|
326
|
+
return { element: entryEl, disposables };
|
|
327
|
+
}
|
|
328
|
+
renderTextPlus(target, text, store) {
|
|
329
|
+
for (const node of parseLinkedText(text).nodes) {
|
|
330
|
+
if (typeof node === 'string') {
|
|
331
|
+
const parts = renderLabelWithIcons(node);
|
|
332
|
+
target.append(...parts);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
store.add(( new Link(target, node, undefined, this.hoverService, this.openerService)));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
runCommandAndClose(commandOrFn) {
|
|
340
|
+
if (typeof commandOrFn === 'function') {
|
|
341
|
+
commandOrFn();
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', { id: commandOrFn, from: 'chat-status' });
|
|
345
|
+
this.commandService.executeCommand(commandOrFn);
|
|
346
|
+
}
|
|
347
|
+
this.hoverService.hideHover(true);
|
|
348
|
+
}
|
|
247
349
|
createQuotaIndicator(container, total, remaining, label) {
|
|
248
350
|
const quotaText = $('span');
|
|
249
351
|
const quotaBit = $('div.quota-bit');
|
|
@@ -256,7 +358,7 @@ let ChatStatusBarEntry = class ChatStatusBarEntry extends Disposable {
|
|
|
256
358
|
if (total !== remaining && usedPercentage === 0) {
|
|
257
359
|
usedPercentage = 1;
|
|
258
360
|
}
|
|
259
|
-
quotaText.textContent = ( localize(
|
|
361
|
+
quotaText.textContent = ( localize(4866, "{0}%", usedPercentage));
|
|
260
362
|
quotaBit.style.width = `${usedPercentage}%`;
|
|
261
363
|
if (usedPercentage >= 90) {
|
|
262
364
|
quotaIndicator.classList.add('error');
|
|
@@ -269,118 +371,109 @@ let ChatStatusBarEntry = class ChatStatusBarEntry extends Disposable {
|
|
|
269
371
|
update(total, remaining);
|
|
270
372
|
return update;
|
|
271
373
|
}
|
|
272
|
-
createShortcuts(container, disposables) {
|
|
273
|
-
const shortcuts = container.appendChild($('div.shortcuts'));
|
|
274
|
-
const entries = coalesce([
|
|
275
|
-
{ text: ( localize(4748, "Chat")), id: CHAT_OPEN_ACTION_ID },
|
|
276
|
-
{ text: ( localize(4749, "Copilot Edits")), id: 'workbench.action.chat.openEditSession' },
|
|
277
|
-
this.contextKeyService.contextMatchesRules(( ContextKeyExpr.and(CTX_INLINE_CHAT_POSSIBLE, EditorContextKeys.writable, ( EditorContextKeys.editorSimpleInput.negate())))) ? { text: ( localize(4750, "Inline Chat")), id: 'inlineChat.start' } : undefined,
|
|
278
|
-
{ text: ( localize(4751, "Quick Chat")), id: 'workbench.action.quickchat.toggle' },
|
|
279
|
-
]);
|
|
280
|
-
const onTrigger = (commandId, e) => {
|
|
281
|
-
EventHelper.stop(e, true);
|
|
282
|
-
this.hoverService.hideHover(true);
|
|
283
|
-
this.commandService.executeCommand(commandId);
|
|
284
|
-
};
|
|
285
|
-
for (const entry of entries) {
|
|
286
|
-
const keys = this.keybindingService.lookupKeybinding(entry.id);
|
|
287
|
-
if (!keys) {
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
const shortcut = append(shortcuts, $('div.shortcut', { tabIndex: 0, role: 'button', 'aria-label': entry.text }));
|
|
291
|
-
append(shortcut, $('span.shortcut-label', undefined, entry.text));
|
|
292
|
-
const shortcutKey = disposables.add(( new KeybindingLabel(shortcut, OS, { ...defaultKeybindingLabelStyles })));
|
|
293
|
-
shortcutKey.set(keys);
|
|
294
|
-
disposables.add(Gesture.addTarget(shortcut));
|
|
295
|
-
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
296
|
-
disposables.add(addDisposableListener(shortcut, eventType, e => onTrigger(entry.id, e)));
|
|
297
|
-
});
|
|
298
|
-
disposables.add(addDisposableListener(shortcut, EventType.KEY_DOWN, e => {
|
|
299
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
300
|
-
if ((event.equals(KeyCode.Enter) || event.equals(KeyCode.Space))) {
|
|
301
|
-
onTrigger(entry.id, e);
|
|
302
|
-
}
|
|
303
|
-
}));
|
|
304
|
-
}
|
|
305
|
-
return shortcuts;
|
|
306
|
-
}
|
|
307
374
|
createSettings(container, disposables) {
|
|
308
|
-
const
|
|
375
|
+
const modeId = this.editorService.activeTextEditorLanguageId;
|
|
309
376
|
const settings = container.appendChild($('div.settings'));
|
|
310
377
|
{
|
|
311
378
|
const globalSetting = append(settings, $('div.setting'));
|
|
312
|
-
this.createCodeCompletionsSetting(globalSetting, ( localize(
|
|
313
|
-
if (
|
|
379
|
+
this.createCodeCompletionsSetting(globalSetting, ( localize(4867, "Code Completions (all files)")), '*', disposables);
|
|
380
|
+
if (modeId) {
|
|
314
381
|
const languageSetting = append(settings, $('div.setting'));
|
|
315
382
|
this.createCodeCompletionsSetting(languageSetting, ( localize(
|
|
316
|
-
|
|
317
|
-
"Code
|
|
318
|
-
this.languageService.getLanguageName(
|
|
319
|
-
)),
|
|
383
|
+
4868,
|
|
384
|
+
"Code Completions ({0})",
|
|
385
|
+
this.languageService.getLanguageName(modeId) ?? modeId
|
|
386
|
+
)), modeId, disposables);
|
|
320
387
|
}
|
|
321
388
|
}
|
|
389
|
+
{
|
|
390
|
+
const setting = append(settings, $('div.setting'));
|
|
391
|
+
this.createNextEditSuggestionsSetting(setting, ( localize(4869, "Next Edit Suggestions")), modeId, this.getCompletionsSettingAccessor(modeId), disposables);
|
|
392
|
+
}
|
|
322
393
|
return settings;
|
|
323
394
|
}
|
|
324
|
-
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
const result = this.configurationService.getValue(settingId);
|
|
328
|
-
if (!isObject(result)) {
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
if (typeof result[language] !== 'undefined') {
|
|
332
|
-
return Boolean(result[language]);
|
|
333
|
-
}
|
|
334
|
-
return Boolean(result['*']);
|
|
335
|
-
};
|
|
336
|
-
const writeSetting = (checkbox) => {
|
|
337
|
-
let result = this.configurationService.getValue(settingId);
|
|
338
|
-
if (!isObject(result)) {
|
|
339
|
-
result = Object.create(null);
|
|
340
|
-
}
|
|
341
|
-
return this.configurationService.updateValue(settingId, { ...result, [language]: checkbox.checked });
|
|
342
|
-
};
|
|
343
|
-
const settingCheckbox = disposables.add(( new Checkbox(label, readSetting(), defaultCheckboxStyles)));
|
|
344
|
-
container.appendChild(settingCheckbox.domNode);
|
|
395
|
+
createSetting(container, settingId, label, accessor, disposables) {
|
|
396
|
+
const checkbox = disposables.add(( new Checkbox(label, Boolean(accessor.readSetting()), defaultCheckboxStyles)));
|
|
397
|
+
container.appendChild(checkbox.domNode);
|
|
345
398
|
const settingLabel = append(container, $('span.setting-label', undefined, label));
|
|
346
399
|
disposables.add(Gesture.addTarget(settingLabel));
|
|
347
400
|
[EventType.CLICK, EventType$1.Tap].forEach(eventType => {
|
|
348
401
|
disposables.add(addDisposableListener(settingLabel, eventType, e => {
|
|
349
|
-
if (
|
|
402
|
+
if (checkbox?.enabled) {
|
|
350
403
|
EventHelper.stop(e, true);
|
|
351
|
-
|
|
352
|
-
writeSetting(
|
|
353
|
-
|
|
404
|
+
checkbox.checked = !checkbox.checked;
|
|
405
|
+
accessor.writeSetting(checkbox.checked);
|
|
406
|
+
checkbox.focus();
|
|
354
407
|
}
|
|
355
408
|
}));
|
|
356
409
|
});
|
|
357
|
-
disposables.add(
|
|
358
|
-
writeSetting(
|
|
410
|
+
disposables.add(checkbox.onChange(() => {
|
|
411
|
+
accessor.writeSetting(checkbox.checked);
|
|
359
412
|
}));
|
|
360
413
|
disposables.add(this.configurationService.onDidChangeConfiguration(e => {
|
|
361
414
|
if (e.affectsConfiguration(settingId)) {
|
|
362
|
-
|
|
415
|
+
checkbox.checked = Boolean(accessor.readSetting());
|
|
363
416
|
}
|
|
364
417
|
}));
|
|
418
|
+
if (!canUseCopilot(this.chatEntitlementService)) {
|
|
419
|
+
container.classList.add('disabled');
|
|
420
|
+
checkbox.disable();
|
|
421
|
+
}
|
|
422
|
+
return checkbox;
|
|
365
423
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
424
|
+
createCodeCompletionsSetting(container, label, modeId, disposables) {
|
|
425
|
+
this.createSetting(container, defaultChat.completionsEnablementSetting, label, this.getCompletionsSettingAccessor(modeId), disposables);
|
|
426
|
+
}
|
|
427
|
+
getCompletionsSettingAccessor(modeId = '*') {
|
|
428
|
+
const settingId = defaultChat.completionsEnablementSetting;
|
|
429
|
+
return {
|
|
430
|
+
readSetting: () => isCompletionsEnabled(this.configurationService, modeId),
|
|
431
|
+
writeSetting: (value) => {
|
|
432
|
+
let result = this.configurationService.getValue(settingId);
|
|
433
|
+
if (!isObject(result)) {
|
|
434
|
+
result = Object.create(null);
|
|
435
|
+
}
|
|
436
|
+
return this.configurationService.updateValue(settingId, { ...result, [modeId]: value });
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
createNextEditSuggestionsSetting(container, label, modeId, completionsSettingAccessor, disposables) {
|
|
441
|
+
const nesSettingId = defaultChat.nextEditSuggestionsSetting;
|
|
442
|
+
const completionsSettingId = defaultChat.completionsEnablementSetting;
|
|
443
|
+
const resource = EditorResourceAccessor.getOriginalUri(this.editorService.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
444
|
+
const checkbox = this.createSetting(container, nesSettingId, label, {
|
|
445
|
+
readSetting: () => this.textResourceConfigurationService.getValue(resource, nesSettingId),
|
|
446
|
+
writeSetting: (value) => this.textResourceConfigurationService.updateValue(resource, nesSettingId, value)
|
|
447
|
+
}, disposables);
|
|
448
|
+
if (!completionsSettingAccessor.readSetting()) {
|
|
449
|
+
container.classList.add('disabled');
|
|
450
|
+
checkbox.disable();
|
|
451
|
+
}
|
|
452
|
+
disposables.add(this.configurationService.onDidChangeConfiguration(e => {
|
|
453
|
+
if (e.affectsConfiguration(completionsSettingId)) {
|
|
454
|
+
if (completionsSettingAccessor.readSetting() && canUseCopilot(this.chatEntitlementService)) {
|
|
455
|
+
checkbox.enable();
|
|
456
|
+
container.classList.remove('disabled');
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
checkbox.disable();
|
|
460
|
+
container.classList.add('disabled');
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}));
|
|
370
464
|
}
|
|
371
465
|
};
|
|
372
|
-
|
|
373
|
-
( __param(0,
|
|
374
|
-
( __param(1,
|
|
375
|
-
( __param(2,
|
|
376
|
-
( __param(3,
|
|
377
|
-
( __param(4,
|
|
378
|
-
( __param(5,
|
|
379
|
-
( __param(6,
|
|
380
|
-
( __param(7,
|
|
381
|
-
( __param(8,
|
|
382
|
-
( __param(9,
|
|
383
|
-
|
|
384
|
-
], ChatStatusBarEntry));
|
|
466
|
+
ChatStatusDashboard = ( __decorate([
|
|
467
|
+
( __param(0, IChatEntitlementService)),
|
|
468
|
+
( __param(1, IChatStatusItemService)),
|
|
469
|
+
( __param(2, ICommandService)),
|
|
470
|
+
( __param(3, IConfigurationService)),
|
|
471
|
+
( __param(4, IEditorService)),
|
|
472
|
+
( __param(5, IHoverService)),
|
|
473
|
+
( __param(6, ILanguageService)),
|
|
474
|
+
( __param(7, IOpenerService)),
|
|
475
|
+
( __param(8, ITelemetryService)),
|
|
476
|
+
( __param(9, ITextResourceConfigurationService))
|
|
477
|
+
], ChatStatusDashboard));
|
|
385
478
|
|
|
386
479
|
export { ChatStatusBarEntry };
|