@codingame/monaco-vscode-chat-service-override 14.0.6 → 15.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.
Files changed (110) hide show
  1. package/index.js +14 -8
  2. package/package.json +20 -20
  3. package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
  4. package/vscode/src/vs/base/common/objectCache.js +1 -1
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +43 -42
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +25 -25
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
  17. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -1
  18. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
  19. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
  20. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
  21. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
  22. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
  23. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +4 -3
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
  29. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
  30. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
  31. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
  32. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
  33. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
  34. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
  35. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
  36. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
  37. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
  38. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
  39. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
  40. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
  42. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  44. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
  46. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
  47. package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
  48. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
  49. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
  50. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
  52. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  53. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
  54. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
  56. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
  57. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
  58. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
  59. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
  60. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
  61. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
  62. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
  63. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
  64. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
  65. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
  66. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
  67. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
  68. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
  69. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
  70. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
  71. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
  72. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +19 -0
  73. package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
  74. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
  75. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
  76. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
  77. package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
  78. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
  79. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
  80. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
  81. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
  82. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
  83. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
  84. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
  86. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
  87. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
  88. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
  89. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
  90. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
  91. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
  92. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
  93. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
  94. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
  95. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
  96. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
  97. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  98. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +12 -12
  99. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
  100. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
  101. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
  102. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
  103. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
  107. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
  108. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
  109. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
  110. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
@@ -1,54 +0,0 @@
1
- import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
2
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
3
- import { IContextMenuService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service";
4
- import { IHoverService } from "@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service";
5
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
6
- import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
7
- import { ILayoutService } from "@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service";
8
- import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
9
- import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
10
- import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
11
- import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
12
- import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
13
- import { IViewPaneOptions, ViewPane } from "@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common/vscode/vs/workbench/browser/parts/views/viewPane";
14
- import { IViewDescriptorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service";
15
- import { IChatViewTitleActionContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatActions";
16
- import { ChatAgentLocation } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents";
17
- import { IChatAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service";
18
- import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
19
- import { ChatWidget, IChatViewState } from "@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget";
20
- import { IViewWelcomeDelegate } from "@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController";
21
- export declare const CHAT_SIDEBAR_OLD_VIEW_PANEL_ID = "workbench.panel.chatSidebar";
22
- export declare const CHAT_SIDEBAR_PANEL_ID = "workbench.panel.chat";
23
- export declare const CHAT_EDITING_SIDEBAR_PANEL_ID = "workbench.panel.chatEditing";
24
- export declare class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
25
- private readonly chatOptions;
26
- private readonly storageService;
27
- private readonly chatService;
28
- private readonly chatAgentService;
29
- private readonly logService;
30
- private readonly layoutService;
31
- private _widget;
32
- get widget(): ChatWidget;
33
- private readonly modelDisposables;
34
- private memento;
35
- private readonly viewState;
36
- private defaultParticipantRegistrationFailed;
37
- private didUnregisterProvider;
38
- constructor(chatOptions: {
39
- location: ChatAgentLocation.Panel | ChatAgentLocation.EditingSession;
40
- }, options: IViewPaneOptions, keybindingService: IKeybindingService, contextMenuService: IContextMenuService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, viewDescriptorService: IViewDescriptorService, instantiationService: IInstantiationService, openerService: IOpenerService, themeService: IThemeService, telemetryService: ITelemetryService, hoverService: IHoverService, storageService: IStorageService, chatService: IChatService, chatAgentService: IChatAgentService, logService: ILogService, layoutService: ILayoutService);
41
- getActionsContext(): IChatViewTitleActionContext | undefined;
42
- private updateModel;
43
- shouldShowWelcome(): boolean;
44
- private getSessionId;
45
- protected renderBody(parent: HTMLElement): void;
46
- acceptInput(query?: string): void;
47
- private clear;
48
- loadSession(sessionId: string, viewState?: IChatViewState): void;
49
- focusInput(): void;
50
- focus(): void;
51
- protected layoutBody(height: number, width: number): void;
52
- saveState(): void;
53
- private updateViewState;
54
- }
@@ -1,245 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { getWindow, $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
4
- import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
5
- import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
- import { MarshalledId } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshallingIds';
7
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
8
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
9
- import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
10
- import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
11
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
12
- import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
13
- import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
14
- import { ILayoutService } from '@codingame/monaco-vscode-api/vscode/vs/platform/layout/browser/layoutService.service';
15
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
16
- import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
17
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
18
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
19
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
20
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
21
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
22
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
23
- import { editorBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
24
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
25
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
26
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
27
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
28
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
29
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
30
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
31
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
32
- import { ViewPane } from '@codingame/monaco-vscode-65619f8f-0eab-5d8b-855a-43b6353fe527-common/vscode/vs/workbench/browser/parts/views/viewPane';
33
- import { Memento } from '@codingame/monaco-vscode-91789cdf-e3cb-5a04-aaeb-6f7df7d3d231-common/vscode/vs/workbench/common/memento';
34
- import { SIDE_BAR_FOREGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
35
- import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
36
- import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
37
- import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service';
38
- import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
39
- import { ChatModelInitState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModel';
40
- import { CHAT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
41
- import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
42
- import { ChatWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/chatWidget';
43
- import { ChatViewWelcomeController } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController';
44
-
45
- const CHAT_SIDEBAR_PANEL_ID = 'workbench.panel.chat';
46
- const CHAT_EDITING_SIDEBAR_PANEL_ID = 'workbench.panel.chatEditing';
47
- let ChatViewPane = class ChatViewPane extends ViewPane {
48
- get widget() { return this._widget; }
49
- constructor(chatOptions, options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, hoverService, storageService, chatService, chatAgentService, logService, layoutService) {
50
- super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, hoverService);
51
- this.chatOptions = chatOptions;
52
- this.storageService = storageService;
53
- this.chatService = chatService;
54
- this.chatAgentService = chatAgentService;
55
- this.logService = logService;
56
- this.layoutService = layoutService;
57
- this.modelDisposables = this._register(( new DisposableStore()));
58
- this.defaultParticipantRegistrationFailed = false;
59
- this.didUnregisterProvider = false;
60
- this.memento = ( new Memento(
61
- 'interactive-session-view-' + CHAT_PROVIDER_ID + (this.chatOptions.location === ChatAgentLocation.EditingSession ? `-edits` : ''),
62
- this.storageService
63
- ));
64
- this.viewState = this.memento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
65
- this._register(this.chatAgentService.onDidChangeAgents(() => {
66
- if (this.chatAgentService.getDefaultAgent(this.chatOptions?.location)) {
67
- if (!this._widget?.viewModel) {
68
- const sessionId = this.getSessionId();
69
- const model = sessionId ? this.chatService.getOrRestoreSession(sessionId) : undefined;
70
- const wasVisible = this._widget.visible;
71
- try {
72
- this._widget.setVisible(false);
73
- this.updateModel(model);
74
- this.defaultParticipantRegistrationFailed = false;
75
- this.didUnregisterProvider = false;
76
- this._onDidChangeViewWelcomeState.fire();
77
- }
78
- finally {
79
- this.widget.setVisible(wasVisible);
80
- }
81
- }
82
- }
83
- else if (this._widget?.viewModel?.initState === ChatModelInitState.Initialized) {
84
- this.didUnregisterProvider = true;
85
- }
86
- this._onDidChangeViewWelcomeState.fire();
87
- }));
88
- this._register(this.contextKeyService.onDidChangeContext(e => {
89
- if (e.affectsSome(ChatContextKeys.SetupViewKeys)) {
90
- this._onDidChangeViewWelcomeState.fire();
91
- }
92
- }));
93
- }
94
- getActionsContext() {
95
- return this.widget?.viewModel ? {
96
- sessionId: this.widget.viewModel.sessionId,
97
- $mid: MarshalledId.ChatViewContext
98
- } : undefined;
99
- }
100
- updateModel(model, viewState) {
101
- this.modelDisposables.clear();
102
- model = model ?? (this.chatService.transferredSessionData?.sessionId
103
- ? this.chatService.getOrRestoreSession(this.chatService.transferredSessionData.sessionId)
104
- : this.chatService.startSession(this.chatOptions.location, CancellationToken.None));
105
- if (!model) {
106
- throw ( new Error('Could not start chat session'));
107
- }
108
- if (viewState) {
109
- this.updateViewState(viewState);
110
- }
111
- this.viewState.sessionId = model.sessionId;
112
- this._widget.setModel(model, { ...this.viewState });
113
- this.updateActions();
114
- }
115
- shouldShowWelcome() {
116
- const showSetup = this.contextKeyService.contextMatchesRules(ChatContextKeys.SetupViewCondition);
117
- const noPersistedSessions = !this.chatService.hasSessions();
118
- const shouldShow = this.didUnregisterProvider || !this._widget?.viewModel && noPersistedSessions || this.defaultParticipantRegistrationFailed || showSetup;
119
- this.logService.trace(`ChatViewPane#shouldShowWelcome(${this.chatOptions.location}) = ${shouldShow}: didUnregister=${this.didUnregisterProvider} || noViewModel:${!this._widget?.viewModel} && noPersistedSessions=${noPersistedSessions} || defaultParticipantRegistrationFailed=${this.defaultParticipantRegistrationFailed} || showSetup=${showSetup}`);
120
- return !!shouldShow;
121
- }
122
- getSessionId() {
123
- let sessionId;
124
- if (this.chatService.transferredSessionData) {
125
- sessionId = this.chatService.transferredSessionData.sessionId;
126
- this.viewState.inputValue = this.chatService.transferredSessionData.inputValue;
127
- }
128
- else {
129
- sessionId = this.viewState.sessionId;
130
- }
131
- return sessionId;
132
- }
133
- renderBody(parent) {
134
- try {
135
- super.renderBody(parent);
136
- this._register(this.instantiationService.createInstance(ChatViewWelcomeController, parent, this, this.chatOptions.location));
137
- const scopedInstantiationService = this._register(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, this.scopedContextKeyService]))));
138
- const locationBasedColors = this.getLocationBasedColors();
139
- const editorOverflowNode = this.layoutService.getContainer(getWindow(parent)).appendChild($('.chat-editor-overflow.monaco-editor'));
140
- this._register({ dispose: () => editorOverflowNode.remove() });
141
- this._widget = this._register(scopedInstantiationService.createInstance(ChatWidget, this.chatOptions.location, { viewId: this.id }, {
142
- autoScroll: this.chatOptions.location === ChatAgentLocation.EditingSession,
143
- renderFollowups: this.chatOptions.location === ChatAgentLocation.Panel,
144
- supportsFileReferences: true,
145
- supportsAdditionalParticipants: this.chatOptions.location === ChatAgentLocation.Panel,
146
- rendererOptions: {
147
- renderCodeBlockPills: this.chatOptions.location === ChatAgentLocation.EditingSession,
148
- renderTextEditsAsSummary: (uri) => {
149
- return this.chatOptions.location === ChatAgentLocation.EditingSession;
150
- },
151
- },
152
- enableImplicitContext: this.chatOptions.location === ChatAgentLocation.Panel,
153
- editorOverflowWidgetsDomNode: editorOverflowNode,
154
- enableWorkingSet: this.chatOptions.location === ChatAgentLocation.EditingSession ? 'explicit' : undefined
155
- }, {
156
- listForeground: SIDE_BAR_FOREGROUND,
157
- listBackground: locationBasedColors.background,
158
- overlayBackground: locationBasedColors.overlayBackground,
159
- inputEditorBackground: locationBasedColors.background,
160
- resultEditorBackground: editorBackground,
161
- }));
162
- this._register(this.onDidChangeBodyVisibility(visible => {
163
- this._widget.setVisible(visible);
164
- }));
165
- this._register(this._widget.onDidClear(() => this.clear()));
166
- this._widget.render(parent);
167
- const sessionId = this.getSessionId();
168
- const disposeListener = this._register(this.chatService.onDidDisposeSession((e) => {
169
- if (e.reason === 'initializationFailed') {
170
- this.defaultParticipantRegistrationFailed = true;
171
- disposeListener?.dispose();
172
- this._onDidChangeViewWelcomeState.fire();
173
- }
174
- }));
175
- const model = sessionId ? this.chatService.getOrRestoreSession(sessionId) : undefined;
176
- this.updateModel(model);
177
- }
178
- catch (e) {
179
- this.logService.error(e);
180
- throw e;
181
- }
182
- }
183
- acceptInput(query) {
184
- this._widget.acceptInput(query);
185
- }
186
- clear() {
187
- if (this.widget.viewModel) {
188
- this.chatService.clearSession(this.widget.viewModel.sessionId);
189
- }
190
- this.updateViewState();
191
- this.updateModel(undefined);
192
- this.updateActions();
193
- }
194
- loadSession(sessionId, viewState) {
195
- if (this.widget.viewModel) {
196
- this.chatService.clearSession(this.widget.viewModel.sessionId);
197
- }
198
- const newModel = this.chatService.getOrRestoreSession(sessionId);
199
- this.updateModel(newModel, viewState);
200
- }
201
- focusInput() {
202
- this._widget.focusInput();
203
- }
204
- focus() {
205
- super.focus();
206
- this._widget.focusInput();
207
- }
208
- layoutBody(height, width) {
209
- super.layoutBody(height, width);
210
- this._widget.layout(height, width);
211
- }
212
- saveState() {
213
- if (this._widget) {
214
- this._widget.saveState();
215
- this.updateViewState();
216
- this.memento.saveMemento();
217
- }
218
- super.saveState();
219
- }
220
- updateViewState(viewState) {
221
- const newViewState = viewState ?? this._widget.getViewState();
222
- for (const [key, value] of Object.entries(newViewState)) {
223
- this.viewState[key] = value;
224
- }
225
- }
226
- };
227
- ChatViewPane = ( __decorate([
228
- ( __param(2, IKeybindingService)),
229
- ( __param(3, IContextMenuService)),
230
- ( __param(4, IConfigurationService)),
231
- ( __param(5, IContextKeyService)),
232
- ( __param(6, IViewDescriptorService)),
233
- ( __param(7, IInstantiationService)),
234
- ( __param(8, IOpenerService)),
235
- ( __param(9, IThemeService)),
236
- ( __param(10, ITelemetryService)),
237
- ( __param(11, IHoverService)),
238
- ( __param(12, IStorageService)),
239
- ( __param(13, IChatService)),
240
- ( __param(14, IChatAgentService)),
241
- ( __param(15, ILogService)),
242
- ( __param(16, ILayoutService))
243
- ], ChatViewPane));
244
-
245
- export { CHAT_EDITING_SIDEBAR_PANEL_ID, CHAT_SIDEBAR_PANEL_ID, ChatViewPane };
@@ -1,39 +0,0 @@
1
- import { ICodeEditor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser";
2
- import { EditorAction2, ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions";
3
- import { IEditorContribution } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/editorCommon";
4
- import { IAction2Options } from "@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions";
5
- import { RawContextKey } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey";
6
- import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
7
- import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
8
- import { INotebookEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service";
9
- import { IInlineChatSessionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service";
10
- export declare const CTX_HAS_SESSION: RawContextKey<"active" | "empty" | undefined>;
11
- export declare class InlineChatController2 implements IEditorContribution {
12
- private readonly _editor;
13
- private readonly _instaService;
14
- private readonly _notebookEditorService;
15
- static readonly ID = "editor.contrib.inlineChatController2";
16
- static get(editor: ICodeEditor): InlineChatController2 | undefined;
17
- private readonly _store;
18
- private readonly _showWidgetOverrideObs;
19
- private readonly _isActiveController;
20
- constructor(_editor: ICodeEditor, _instaService: IInstantiationService, _notebookEditorService: INotebookEditorService, inlineChatSessions: IInlineChatSessionService, contextKeyService: IContextKeyService);
21
- dispose(): void;
22
- toggleWidgetUntilNextRequest(): void;
23
- markActiveController(): void;
24
- }
25
- export declare class StartSessionAction2 extends EditorAction2 {
26
- constructor();
27
- runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, ...args: any[]): Promise<void>;
28
- }
29
- declare abstract class AbstractInlineChatAction extends EditorAction2 {
30
- static readonly category: import("@codingame/monaco-vscode-api/vscode/vs/nls").ILocalizedString;
31
- constructor(desc: IAction2Options);
32
- runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]): void;
33
- abstract runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController2, editor: ICodeEditor, ...args: any[]): void;
34
- }
35
- export declare class StopSessionAction2 extends AbstractInlineChatAction {
36
- constructor();
37
- runInlineChatCommand(accessor: ServicesAccessor, _ctrl: InlineChatController2, editor: ICodeEditor, ...args: any[]): void;
38
- }
39
- export {};
@@ -1,314 +0,0 @@
1
-
2
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
- import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
4
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
5
- import { KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
6
- import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
7
- import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
8
- import { observableValue, transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
9
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
10
- import '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
11
- import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
12
- import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
13
- import { observableSignalFromEvent, observableFromEvent, constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
14
- import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
15
- import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
16
- import { isCodeEditor, isDiffEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
17
- import { EditorAction2 } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions';
18
- import { observableCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/observableCodeEditor';
19
- import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService';
20
- import { EmbeddedCodeEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
21
- import { EmbeddedDiffEditorWidget } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/widget/diffEditor/embeddedDiffEditorWidget';
22
- import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/editorContextKeys';
23
- import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
24
- import { MenuId, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
25
- import { RawContextKey, ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
26
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
27
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
28
- import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
29
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
30
- import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
31
- import { ctxIsGlobalEditingSession } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditorController';
32
- import { ChatEditorOverlayController } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditorOverlay';
33
- import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents';
34
- import { WorkingSetEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
35
- import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
36
- import { CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_HAS_AGENT2, CTX_INLINE_CHAT_POSSIBLE } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
37
- import { IInlineChatSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
38
- import { InlineChatZoneWidget } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget';
39
-
40
- var InlineChatController2_1;
41
- const CTX_HAS_SESSION = ( new RawContextKey('inlineChatHasSession', undefined, ( localize(6932, "The current editor has an active inline chat session"))));
42
- let InlineChatController2 = class InlineChatController2 {
43
- static { InlineChatController2_1 = this; }
44
- static { this.ID = 'editor.contrib.inlineChatController2'; }
45
- static get(editor) {
46
- return editor.getContribution(InlineChatController2_1.ID) ?? undefined;
47
- }
48
- constructor(_editor, _instaService, _notebookEditorService, inlineChatSessions, contextKeyService) {
49
- this._editor = _editor;
50
- this._instaService = _instaService;
51
- this._notebookEditorService = _notebookEditorService;
52
- this._store = ( new DisposableStore());
53
- this._showWidgetOverrideObs = observableValue(this, false);
54
- this._isActiveController = observableValue(this, false);
55
- const ctxHasSession = CTX_HAS_SESSION.bindTo(contextKeyService);
56
- const ctxInlineChatVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
57
- const zone = ( new Lazy(() => {
58
- const location = {
59
- location: ChatAgentLocation.Editor,
60
- resolveData: () => {
61
- assertType(this._editor.hasModel());
62
- return {
63
- type: ChatAgentLocation.Editor,
64
- selection: this._editor.getSelection(),
65
- document: this._editor.getModel().uri,
66
- wholeRange: this._editor.getSelection(),
67
- };
68
- }
69
- };
70
- for (const notebookEditor of this._notebookEditorService.listNotebookEditors()) {
71
- for (const [, codeEditor] of notebookEditor.codeEditors) {
72
- if (codeEditor === this._editor) {
73
- location.location = ChatAgentLocation.Notebook;
74
- break;
75
- }
76
- }
77
- }
78
- const result = this._instaService.createInstance(InlineChatZoneWidget, location, {
79
- enableWorkingSet: 'implicit',
80
- rendererOptions: {
81
- renderCodeBlockPills: true,
82
- renderTextEditsAsSummary: uri => isEqual(uri, _editor.getModel()?.uri)
83
- }
84
- }, this._editor);
85
- result.domNode.classList.add('inline-chat-2');
86
- return result;
87
- }));
88
- const editorObs = observableCodeEditor(_editor);
89
- const sessionsSignal = observableSignalFromEvent(this, inlineChatSessions.onDidChangeSessions);
90
- const sessionObs = derived(r => {
91
- sessionsSignal.read(r);
92
- const model = editorObs.model.read(r);
93
- const value = model && inlineChatSessions.getSession2(model.uri);
94
- return value ?? undefined;
95
- });
96
- this._store.add(autorunWithStore((r, store) => {
97
- const session = sessionObs.read(r);
98
- if (!session) {
99
- ctxHasSession.set(undefined);
100
- this._isActiveController.set(false, undefined);
101
- }
102
- else {
103
- const checkRequests = () => ctxHasSession.set(session.chatModel.getRequests().length === 0 ? 'empty' : 'active');
104
- store.add(session.chatModel.onDidChange(checkRequests));
105
- checkRequests();
106
- }
107
- }));
108
- const visibleSessionObs = observableValue(this, undefined);
109
- this._store.add(autorunWithStore((r, store) => {
110
- const session = sessionObs.read(r);
111
- const isActive = this._isActiveController.read(r);
112
- if (!session || !isActive) {
113
- visibleSessionObs.set(undefined, undefined);
114
- return;
115
- }
116
- const { chatModel } = session;
117
- const showShowUntil = this._showWidgetOverrideObs.read(r);
118
- const hasNoRequests = chatModel.getRequests().length === 0;
119
- store.add(chatModel.onDidChange(e => {
120
- if (e.kind === 'addRequest') {
121
- transaction(tx => {
122
- this._showWidgetOverrideObs.set(false, tx);
123
- visibleSessionObs.set(undefined, tx);
124
- });
125
- }
126
- }));
127
- if (showShowUntil || hasNoRequests) {
128
- visibleSessionObs.set(session, undefined);
129
- }
130
- else {
131
- visibleSessionObs.set(undefined, undefined);
132
- }
133
- }));
134
- this._store.add(autorun(r => {
135
- const session = visibleSessionObs.read(r);
136
- if (!session) {
137
- zone.rawValue?.hide();
138
- _editor.focus();
139
- ctxInlineChatVisible.reset();
140
- }
141
- else {
142
- ctxInlineChatVisible.set(true);
143
- zone.value.widget.setChatModel(session.chatModel);
144
- if (!zone.value.position) {
145
- zone.value.show(session.initialPosition);
146
- }
147
- zone.value.reveal(zone.value.position);
148
- zone.value.widget.focus();
149
- session.editingSession.getEntry(session.uri)?.autoAcceptController.get()?.cancel();
150
- }
151
- }));
152
- this._store.add(autorun(r => {
153
- const overlay = ChatEditorOverlayController.get(_editor);
154
- const session = sessionObs.read(r);
155
- const model = editorObs.model.read(r);
156
- if (!session || !model) {
157
- overlay.hide();
158
- return;
159
- }
160
- const lastResponse = observableFromEvent(this, session.chatModel.onDidChange, () => session.chatModel.getRequests().at(-1)?.response);
161
- const response = lastResponse.read(r);
162
- const isInProgress = response
163
- ? observableFromEvent(this, response.onDidChange, () => !response.isComplete)
164
- : constObservable(false);
165
- if (isInProgress.read(r)) {
166
- overlay.showRequest(session.editingSession);
167
- }
168
- else if (session.editingSession.getEntry(session.uri)?.state.get() !== WorkingSetEntryState.Modified) {
169
- overlay.hide();
170
- }
171
- }));
172
- }
173
- dispose() {
174
- this._store.dispose();
175
- }
176
- toggleWidgetUntilNextRequest() {
177
- const value = this._showWidgetOverrideObs.get();
178
- this._showWidgetOverrideObs.set(!value, undefined);
179
- }
180
- markActiveController() {
181
- this._isActiveController.set(true, undefined);
182
- }
183
- };
184
- InlineChatController2 = InlineChatController2_1 = ( __decorate([
185
- ( __param(1, IInstantiationService)),
186
- ( __param(2, INotebookEditorService)),
187
- ( __param(3, IInlineChatSessionService)),
188
- ( __param(4, IContextKeyService))
189
- ], InlineChatController2));
190
- class StartSessionAction2 extends EditorAction2 {
191
- constructor() {
192
- super({
193
- id: 'inlineChat2.start',
194
- title: ( localize2(6933, "Inline Chat")),
195
- precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, CTX_INLINE_CHAT_POSSIBLE, ( CTX_HAS_SESSION.negate()), EditorContextKeys.writable, ( EditorContextKeys.editorSimpleInput.negate()))),
196
- f1: true,
197
- category: AbstractInlineChatAction.category,
198
- keybinding: {
199
- when: EditorContextKeys.focus,
200
- weight: KeybindingWeight.WorkbenchContrib,
201
- primary: KeyMod.CtrlCmd | KeyCode.KeyI
202
- },
203
- menu: {
204
- id: MenuId.ChatCommandCenter,
205
- group: 'd_inlineChat',
206
- order: 10,
207
- when: CTX_INLINE_CHAT_HAS_AGENT2
208
- }
209
- });
210
- }
211
- async runEditorCommand(accessor, editor, ...args) {
212
- const inlineChatSessions = accessor.get(IInlineChatSessionService);
213
- if (!editor.hasModel()) {
214
- return;
215
- }
216
- const textModel = editor.getModel();
217
- await inlineChatSessions.createSession2(editor, textModel.uri, CancellationToken.None);
218
- InlineChatController2.get(editor)?.markActiveController();
219
- }
220
- }
221
- class AbstractInlineChatAction extends EditorAction2 {
222
- static { this.category = ( localize2(6934, "Inline Chat")); }
223
- constructor(desc) {
224
- super({
225
- ...desc,
226
- category: AbstractInlineChatAction.category,
227
- precondition: ( ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT2, desc.precondition))
228
- });
229
- }
230
- runEditorCommand(accessor, editor, ..._args) {
231
- const editorService = accessor.get(IEditorService);
232
- const logService = accessor.get(ILogService);
233
- let ctrl = InlineChatController2.get(editor);
234
- if (!ctrl) {
235
- const { activeTextEditorControl } = editorService;
236
- if (isCodeEditor(activeTextEditorControl)) {
237
- editor = activeTextEditorControl;
238
- }
239
- else if (isDiffEditor(activeTextEditorControl)) {
240
- editor = activeTextEditorControl.getModifiedEditor();
241
- }
242
- ctrl = InlineChatController2.get(editor);
243
- }
244
- if (!ctrl) {
245
- logService.warn('[IE] NO controller found for action', this.desc.id, editor.getModel()?.uri);
246
- return;
247
- }
248
- if (editor instanceof EmbeddedCodeEditorWidget) {
249
- editor = editor.getParentEditor();
250
- }
251
- if (!ctrl) {
252
- for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
253
- if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
254
- if (diffEditor instanceof EmbeddedDiffEditorWidget) {
255
- this.runEditorCommand(accessor, diffEditor.getParentEditor(), ..._args);
256
- }
257
- }
258
- }
259
- return;
260
- }
261
- this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
262
- }
263
- }
264
- class StopSessionAction2 extends AbstractInlineChatAction {
265
- constructor() {
266
- super({
267
- id: 'inlineChat2.stop',
268
- title: ( localize2(6935, "Stop")),
269
- f1: true,
270
- precondition: ( ContextKeyExpr.and(( CTX_HAS_SESSION.isEqualTo('empty')), CTX_INLINE_CHAT_VISIBLE)),
271
- keybinding: {
272
- weight: KeybindingWeight.WorkbenchContrib,
273
- primary: KeyCode.Escape,
274
- secondary: [KeyMod.CtrlCmd | KeyCode.KeyI]
275
- },
276
- });
277
- }
278
- runInlineChatCommand(accessor, _ctrl, editor, ...args) {
279
- const inlineChatSessions = accessor.get(IInlineChatSessionService);
280
- if (!editor.hasModel()) {
281
- return;
282
- }
283
- const textModel = editor.getModel();
284
- inlineChatSessions.getSession2(textModel.uri)?.dispose();
285
- }
286
- }
287
- class RevealWidget extends AbstractInlineChatAction {
288
- constructor() {
289
- super({
290
- id: 'inlineChat2.reveal',
291
- title: ( localize2(6936, "Toggle Inline Chat")),
292
- f1: true,
293
- icon: Codicon.copilot,
294
- precondition: ( ContextKeyExpr.and(CTX_HAS_SESSION)),
295
- keybinding: {
296
- weight: KeybindingWeight.WorkbenchContrib,
297
- primary: KeyMod.CtrlCmd | KeyCode.KeyI
298
- },
299
- menu: {
300
- id: MenuId.ChatEditingEditorContent,
301
- when: ( ContextKeyExpr.and(CTX_HAS_SESSION, ( ctxIsGlobalEditingSession.negate()))),
302
- group: 'navigate',
303
- order: 4,
304
- }
305
- });
306
- }
307
- runInlineChatCommand(_accessor, ctrl, _editor) {
308
- ctrl.toggleWidgetUntilNextRequest();
309
- ctrl.markActiveController();
310
- }
311
- }
312
- registerAction2(RevealWidget);
313
-
314
- export { CTX_HAS_SESSION, InlineChatController2, StartSessionAction2, StopSessionAction2 };