@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.
- package/index.js +14 -8
- package/package.json +20 -20
- package/vscode/src/vs/base/common/objectCache.d.ts +1 -1
- package/vscode/src/vs/base/common/objectCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +43 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/chatAttachPromptAction.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAttachPromptAction/dialogs/askToSelectPrompt.js +142 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +252 -260
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +12 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +31 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +151 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/{chatEditingService.d.ts → chatEditingServiceImpl.d.ts} +12 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +423 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +38 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +93 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +21 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +101 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +146 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +386 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +4 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +8 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +7 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +45 -45
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +11 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditingEditorOverlay.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +67 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/usePromptCommand.js +78 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatEntitlementsService.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +12 -10
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatQuotasService.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -27
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/constants.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contentProviders/textModelContentsProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.d.ts +4 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptLinkProvider.js +15 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageFeatures/promptPathAutocompletion.js +175 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +6 -7
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +101 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +12 -12
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +31 -36
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +0 -505
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +0 -871
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +0 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -245
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.d.ts +0 -39
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController2.js +0 -314
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import '../media/chatEditingEditorOverlay.css.js';
|
|
4
|
+
import { DisposableStore, MutableDisposable, toDisposable, DisposableMap, combinedDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
6
|
+
import { MenuWorkbenchToolBar, HiddenItemStrategy } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/toolbar';
|
|
7
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { WorkingSetEntryState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService';
|
|
9
|
+
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
10
|
+
import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
11
|
+
import { ActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
12
|
+
import { append, addDisposableGenericMouseMoveListener, reset } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
13
|
+
import { renderIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
14
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
15
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
16
|
+
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
17
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
18
|
+
import { navigationBearingFakeActionId, AcceptAction, RejectAction } from '@codingame/monaco-vscode-e4d0fd26-1b26-5583-b3f7-582e08d7b389-common/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions';
|
|
19
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service';
|
|
20
|
+
import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
21
|
+
import { EditorGroupView } from '@codingame/monaco-vscode-ad89fae6-94f0-5ac2-a185-22dea4b68ee0-common/vscode/vs/workbench/browser/parts/editor/editorGroupView';
|
|
22
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
23
|
+
import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
24
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
25
|
+
import { EditorResourceAccessor, SideBySideEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
26
|
+
import { IInlineChatSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.service';
|
|
27
|
+
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
28
|
+
import { ObservableEditorSession } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorContextKeys';
|
|
29
|
+
import { rcut } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
30
|
+
import { observableFromEvent, observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
31
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
32
|
+
import { derived, derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
33
|
+
import { observableValue, transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
|
|
34
|
+
|
|
35
|
+
let ChatEditorOverlayWidget = class ChatEditorOverlayWidget {
|
|
36
|
+
constructor(_editor, _chatService, instaService) {
|
|
37
|
+
this._editor = _editor;
|
|
38
|
+
this._chatService = _chatService;
|
|
39
|
+
this._showStore = ( new DisposableStore());
|
|
40
|
+
this._session = observableValue(this, undefined);
|
|
41
|
+
this._entry = observableValue(this, undefined);
|
|
42
|
+
this._navigationBearings = observableValue(this, { changeCount: -1, activeIdx: -1, entriesCount: -1 });
|
|
43
|
+
this._domNode = document.createElement('div');
|
|
44
|
+
this._domNode.classList.add('chat-editor-overlay-widget');
|
|
45
|
+
const progressNode = document.createElement('div');
|
|
46
|
+
progressNode.classList.add('chat-editor-overlay-progress');
|
|
47
|
+
append(progressNode, renderIcon(ThemeIcon.modify(Codicon.loading, 'spin')));
|
|
48
|
+
this._domNode.appendChild(progressNode);
|
|
49
|
+
const toolbarNode = document.createElement('div');
|
|
50
|
+
toolbarNode.classList.add('chat-editor-overlay-toolbar');
|
|
51
|
+
this._domNode.appendChild(toolbarNode);
|
|
52
|
+
this._toolbar = instaService.createInstance(MenuWorkbenchToolBar, toolbarNode, MenuId.ChatEditingEditorContent, {
|
|
53
|
+
telemetrySource: 'chatEditor.overlayToolbar',
|
|
54
|
+
hiddenItemStrategy: HiddenItemStrategy.Ignore,
|
|
55
|
+
toolbarOptions: {
|
|
56
|
+
primaryGroup: () => true,
|
|
57
|
+
useSeparatorsInPrimaryActions: true
|
|
58
|
+
},
|
|
59
|
+
menuOptions: { renderShortTitle: true },
|
|
60
|
+
actionViewItemProvider: (action, options) => {
|
|
61
|
+
const that = this;
|
|
62
|
+
if (action.id === navigationBearingFakeActionId) {
|
|
63
|
+
return new (class extends ActionViewItem {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(undefined, action, { ...options, icon: false, label: true, keybindingNotRenderedWithLabel: true });
|
|
66
|
+
}
|
|
67
|
+
render(container) {
|
|
68
|
+
super.render(container);
|
|
69
|
+
container.classList.add('label-item');
|
|
70
|
+
this._store.add(autorun(r => {
|
|
71
|
+
assertType(this.label);
|
|
72
|
+
const { changeCount, activeIdx } = that._navigationBearings.read(r);
|
|
73
|
+
if (changeCount > 0) {
|
|
74
|
+
const n = activeIdx === -1 ? '1' : `${activeIdx + 1}`;
|
|
75
|
+
this.label.innerText = ( localize(4564, "{0} of {1}", n, changeCount));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.label.innerText = ( localize(4565, "0 of 0"));
|
|
79
|
+
}
|
|
80
|
+
this.updateTooltip();
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
getTooltip() {
|
|
84
|
+
const { changeCount, entriesCount } = that._navigationBearings.get();
|
|
85
|
+
if (changeCount === -1 || entriesCount === -1) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
else if (changeCount === 1 && entriesCount === 1) {
|
|
89
|
+
return localize(4566, "1 change in 1 file");
|
|
90
|
+
}
|
|
91
|
+
else if (changeCount === 1) {
|
|
92
|
+
return localize(4567, "1 change in {0} files", entriesCount);
|
|
93
|
+
}
|
|
94
|
+
else if (entriesCount === 1) {
|
|
95
|
+
return localize(4568, "{0} changes in 1 file", changeCount);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
return localize(4569, "{0} changes in {1} files", changeCount, entriesCount);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (action.id === AcceptAction.ID || action.id === RejectAction.ID) {
|
|
104
|
+
return new (class extends ActionViewItem {
|
|
105
|
+
constructor() {
|
|
106
|
+
super(undefined, action, { ...options, icon: false, label: true, keybindingNotRenderedWithLabel: true });
|
|
107
|
+
this._reveal = this._store.add(( new MutableDisposable()));
|
|
108
|
+
}
|
|
109
|
+
render(container) {
|
|
110
|
+
super.render(container);
|
|
111
|
+
if (action.id === AcceptAction.ID) {
|
|
112
|
+
const listener = this._store.add(( new MutableDisposable()));
|
|
113
|
+
this._store.add(autorun(r => {
|
|
114
|
+
assertType(this.label);
|
|
115
|
+
assertType(this.element);
|
|
116
|
+
const ctrl = that._entry.read(r)?.autoAcceptController.read(r);
|
|
117
|
+
if (ctrl) {
|
|
118
|
+
const r = -100 * (ctrl.remaining / ctrl.total);
|
|
119
|
+
this.element.style.setProperty('--vscode-action-item-auto-timeout', `${r}%`);
|
|
120
|
+
this.element.classList.toggle('auto', true);
|
|
121
|
+
listener.value = addDisposableGenericMouseMoveListener(this.element, () => ctrl.cancel());
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.element.classList.toggle('auto', false);
|
|
125
|
+
listener.clear();
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
set actionRunner(actionRunner) {
|
|
131
|
+
super.actionRunner = actionRunner;
|
|
132
|
+
this._reveal.value = actionRunner.onWillRun(_e => {
|
|
133
|
+
that._editor.focus();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
get actionRunner() {
|
|
137
|
+
return super.actionRunner;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (action.id === 'inlineChat2.reveal' || action.id === 'workbench.action.chat.openEditSession') {
|
|
142
|
+
return new (class extends ActionViewItem {
|
|
143
|
+
constructor() {
|
|
144
|
+
super(undefined, action, options);
|
|
145
|
+
this._requestMessage = derived(r => {
|
|
146
|
+
const session = that._session.read(r);
|
|
147
|
+
const chatModel = that._chatService.getSession(session?.chatSessionId ?? '');
|
|
148
|
+
if (!session || !chatModel) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
const response = that._entry.read(r)?.isCurrentlyBeingModifiedBy.read(r);
|
|
152
|
+
if (response) {
|
|
153
|
+
if (response?.isPaused.read(r)) {
|
|
154
|
+
return { message: ( localize(4570, "Edits Paused")), paused: true };
|
|
155
|
+
}
|
|
156
|
+
const entry = that._entry.read(r);
|
|
157
|
+
if (entry) {
|
|
158
|
+
const progress = entry?.rewriteRatio.read(r);
|
|
159
|
+
const message = progress === 0
|
|
160
|
+
? ( localize(4571, "Generating Edits"))
|
|
161
|
+
: ( localize(4572, "{0}% Applying Edits", Math.round(progress * 100)));
|
|
162
|
+
return { message };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (session.isGlobalEditingSession) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const request = observableFromEvent(this, chatModel.onDidChange, () => chatModel.getRequests().at(-1)).read(r);
|
|
169
|
+
if (!request || request.response?.isComplete) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
return { message: request.message.text };
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
render(container) {
|
|
176
|
+
super.render(container);
|
|
177
|
+
container.classList.add('label-item');
|
|
178
|
+
this._store.add(autorun(r => {
|
|
179
|
+
assertType(this.label);
|
|
180
|
+
const value = this._requestMessage.read(r);
|
|
181
|
+
if (!value) {
|
|
182
|
+
this.options.icon = true;
|
|
183
|
+
this.options.label = false;
|
|
184
|
+
reset(this.label);
|
|
185
|
+
this.updateClass();
|
|
186
|
+
this.updateLabel();
|
|
187
|
+
this.updateTooltip();
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.options.icon = false;
|
|
191
|
+
this.options.label = true;
|
|
192
|
+
this.updateClass();
|
|
193
|
+
this.updateTooltip();
|
|
194
|
+
const message = rcut(value.message, 47);
|
|
195
|
+
reset(this.label, message);
|
|
196
|
+
}
|
|
197
|
+
const busy = Boolean(value && !value.paused);
|
|
198
|
+
that._domNode.classList.toggle('busy', busy);
|
|
199
|
+
this.label.classList.toggle('busy', busy);
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
getTooltip() {
|
|
203
|
+
return this._requestMessage.get()?.message || super.getTooltip();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
dispose() {
|
|
212
|
+
this.hide();
|
|
213
|
+
this._showStore.dispose();
|
|
214
|
+
this._toolbar.dispose();
|
|
215
|
+
}
|
|
216
|
+
getDomNode() {
|
|
217
|
+
return this._domNode;
|
|
218
|
+
}
|
|
219
|
+
show(session, entry, indicies) {
|
|
220
|
+
this._showStore.clear();
|
|
221
|
+
transaction(tx => {
|
|
222
|
+
this._session.set(session, tx);
|
|
223
|
+
this._entry.set(entry, tx);
|
|
224
|
+
});
|
|
225
|
+
this._showStore.add(autorun(r => {
|
|
226
|
+
const entryIndex = indicies.entryIndex.read(r);
|
|
227
|
+
const changeIndex = indicies.changeIndex.read(r);
|
|
228
|
+
const entries = session.entries.read(r);
|
|
229
|
+
let activeIdx = entryIndex !== undefined && changeIndex !== undefined
|
|
230
|
+
? changeIndex
|
|
231
|
+
: -1;
|
|
232
|
+
let totalChangesCount = 0;
|
|
233
|
+
for (let i = 0; i < entries.length; i++) {
|
|
234
|
+
const changesCount = entries[i].changesCount.read(r);
|
|
235
|
+
totalChangesCount += changesCount;
|
|
236
|
+
if (entryIndex !== undefined && i < entryIndex) {
|
|
237
|
+
activeIdx += changesCount;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
this._navigationBearings.set({ changeCount: totalChangesCount, activeIdx, entriesCount: entries.length }, undefined);
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
hide() {
|
|
244
|
+
transaction(tx => {
|
|
245
|
+
this._session.set(undefined, tx);
|
|
246
|
+
this._entry.set(undefined, tx);
|
|
247
|
+
this._navigationBearings.set({ changeCount: -1, activeIdx: -1, entriesCount: -1 }, tx);
|
|
248
|
+
});
|
|
249
|
+
this._showStore.clear();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
ChatEditorOverlayWidget = ( __decorate([
|
|
253
|
+
( __param(1, IChatService)),
|
|
254
|
+
( __param(2, IInstantiationService))
|
|
255
|
+
], ChatEditorOverlayWidget));
|
|
256
|
+
let ChatEditingOverlayController = class ChatEditingOverlayController {
|
|
257
|
+
constructor(container, group, instaService, chatService, chatEditingService, inlineChatService) {
|
|
258
|
+
this._store = ( new DisposableStore());
|
|
259
|
+
this._domNode = document.createElement('div');
|
|
260
|
+
this._domNode.classList.add('chat-editing-editor-overlay');
|
|
261
|
+
this._domNode.style.position = 'absolute';
|
|
262
|
+
this._domNode.style.bottom = `24px`;
|
|
263
|
+
this._domNode.style.right = `24px`;
|
|
264
|
+
this._domNode.style.zIndex = `100`;
|
|
265
|
+
const widget = instaService.createInstance(ChatEditorOverlayWidget, group);
|
|
266
|
+
this._domNode.appendChild(widget.getDomNode());
|
|
267
|
+
this._store.add(toDisposable(() => this._domNode.remove()));
|
|
268
|
+
this._store.add(widget);
|
|
269
|
+
const show = () => {
|
|
270
|
+
if (!container.contains(this._domNode)) {
|
|
271
|
+
container.appendChild(this._domNode);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const hide = () => {
|
|
275
|
+
if (container.contains(this._domNode)) {
|
|
276
|
+
widget.hide();
|
|
277
|
+
this._domNode.remove();
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const activeEditorSignal = observableSignalFromEvent(this, Event.any(group.onDidActiveEditorChange, group.onDidModelChange));
|
|
281
|
+
const activeUriObs = derivedOpts({ equalsFn: isEqual }, r => {
|
|
282
|
+
activeEditorSignal.read(r);
|
|
283
|
+
const editor = group.activeEditorPane;
|
|
284
|
+
const uri = EditorResourceAccessor.getOriginalUri(editor?.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
285
|
+
return uri;
|
|
286
|
+
});
|
|
287
|
+
const sessionAndEntry = derived(r => {
|
|
288
|
+
activeEditorSignal.read(r);
|
|
289
|
+
const uri = activeUriObs.read(r);
|
|
290
|
+
if (!uri) {
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
return ( new ObservableEditorSession(uri, chatEditingService, inlineChatService)).value.read(r);
|
|
294
|
+
});
|
|
295
|
+
const isInProgress = derived(r => {
|
|
296
|
+
const session = sessionAndEntry.read(r)?.session;
|
|
297
|
+
if (!session) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
const chatModel = chatService.getSession(session.chatSessionId);
|
|
301
|
+
const lastResponse = observableFromEvent(this, chatModel.onDidChange, () => chatModel.getRequests().at(-1)?.response);
|
|
302
|
+
const response = lastResponse.read(r);
|
|
303
|
+
if (!response) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
return observableFromEvent(this, response.onDidChange, () => !response.isComplete).read(r);
|
|
307
|
+
});
|
|
308
|
+
this._store.add(autorun(r => {
|
|
309
|
+
const data = sessionAndEntry.read(r);
|
|
310
|
+
if (!data) {
|
|
311
|
+
hide();
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const { session, entry } = data;
|
|
315
|
+
if (entry?.state.read(r) === WorkingSetEntryState.Modified
|
|
316
|
+
|| (!session.isGlobalEditingSession && isInProgress.read(r))
|
|
317
|
+
) {
|
|
318
|
+
const editorPane = group.activeEditorPane;
|
|
319
|
+
assertType(editorPane);
|
|
320
|
+
const changeIndex = derived(r => entry
|
|
321
|
+
? entry.getEditorIntegration(editorPane).currentIndex.read(r)
|
|
322
|
+
: 0);
|
|
323
|
+
const entryIndex = derived(r => entry
|
|
324
|
+
? session.entries.read(r).indexOf(entry)
|
|
325
|
+
: 0);
|
|
326
|
+
widget.show(session, entry, { entryIndex, changeIndex });
|
|
327
|
+
show();
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
hide();
|
|
331
|
+
}
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
dispose() {
|
|
335
|
+
this._store.dispose();
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
ChatEditingOverlayController = ( __decorate([
|
|
339
|
+
( __param(2, IInstantiationService)),
|
|
340
|
+
( __param(3, IChatService)),
|
|
341
|
+
( __param(4, IChatEditingService)),
|
|
342
|
+
( __param(5, IInlineChatSessionService))
|
|
343
|
+
], ChatEditingOverlayController));
|
|
344
|
+
let ChatEditingEditorOverlay = class ChatEditingEditorOverlay {
|
|
345
|
+
static { this.ID = 'chat.edits.editorOverlay'; }
|
|
346
|
+
constructor(editorGroupsService, instantiationService) {
|
|
347
|
+
this._store = ( new DisposableStore());
|
|
348
|
+
const editorGroups = observableFromEvent(this, Event.any(editorGroupsService.onDidAddGroup, editorGroupsService.onDidRemoveGroup), () => editorGroupsService.groups);
|
|
349
|
+
const overlayWidgets = ( new DisposableMap());
|
|
350
|
+
this._store.add(autorun(r => {
|
|
351
|
+
const toDelete = ( new Set(( overlayWidgets.keys())));
|
|
352
|
+
const groups = editorGroups.read(r);
|
|
353
|
+
for (const group of groups) {
|
|
354
|
+
if (!(group instanceof EditorGroupView)) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
toDelete.delete(group);
|
|
358
|
+
if (!( overlayWidgets.has(group))) {
|
|
359
|
+
const scopedInstaService = instantiationService.createChild(( new ServiceCollection([IContextKeyService, group.scopedContextKeyService])));
|
|
360
|
+
const container = group.element;
|
|
361
|
+
const ctrl = scopedInstaService.createInstance(ChatEditingOverlayController, container, group);
|
|
362
|
+
overlayWidgets.set(group, combinedDisposable(ctrl, scopedInstaService));
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
for (const group of toDelete) {
|
|
366
|
+
overlayWidgets.deleteAndDispose(group);
|
|
367
|
+
}
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
dispose() {
|
|
371
|
+
this._store.dispose();
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
ChatEditingEditorOverlay = ( __decorate([
|
|
375
|
+
( __param(0, IEditorGroupsService)),
|
|
376
|
+
( __param(1, IInstantiationService))
|
|
377
|
+
], ChatEditingEditorOverlay));
|
|
378
|
+
|
|
379
|
+
export { ChatEditingEditorOverlay };
|
|
@@ -1,69 +1,53 @@
|
|
|
1
|
-
import { CancellationToken
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
3
|
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
4
4
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
5
|
-
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService";
|
|
5
|
+
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
6
6
|
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
7
7
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
8
8
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
9
9
|
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
10
10
|
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
11
11
|
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
12
|
-
import { IWorkbenchAssignmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/assignment/common/assignmentService.service";
|
|
13
12
|
import { IDecorationsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/decorations/common/decorations.service";
|
|
14
13
|
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
15
14
|
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
16
15
|
import { ILifecycleService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service";
|
|
17
|
-
import { IMultiDiffSourceResolver, IResolvedMultiDiffSource } from "@codingame/monaco-vscode-
|
|
16
|
+
import { IMultiDiffSourceResolver, IResolvedMultiDiffSource } from "@codingame/monaco-vscode-1bb39316-6fbf-572e-ab6a-818a2496c14f-common/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService";
|
|
18
17
|
import { IMultiDiffSourceResolverService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.service";
|
|
19
|
-
import { IChatAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAgents.service";
|
|
20
18
|
import { IChatEditingSession, IChatRelatedFile, IChatRelatedFilesProvider } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService";
|
|
21
19
|
import { IChatEditingService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatEditingService.service";
|
|
22
20
|
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService.service";
|
|
23
|
-
import { ChatEditingSession } from "./chatEditingSession.js";
|
|
24
21
|
export declare class ChatEditingService extends Disposable implements IChatEditingService {
|
|
25
22
|
private readonly _instantiationService;
|
|
26
23
|
private readonly _chatService;
|
|
27
24
|
private readonly _editorService;
|
|
28
25
|
private readonly _fileService;
|
|
29
26
|
private readonly lifecycleService;
|
|
30
|
-
private readonly _workbenchAssignmentService;
|
|
31
|
-
private readonly _chatAgentService;
|
|
32
27
|
_serviceBrand: undefined;
|
|
33
|
-
private readonly
|
|
34
|
-
private readonly _currentSessionDisposables;
|
|
35
|
-
private readonly _adhocSessionsObs;
|
|
28
|
+
private readonly _sessionsObs;
|
|
36
29
|
readonly editingSessionsObs: IObservable<readonly IChatEditingSession[]>;
|
|
37
|
-
private readonly _currentAutoApplyOperationObs;
|
|
38
|
-
get currentAutoApplyOperation(): CancellationTokenSource | null;
|
|
39
|
-
get currentEditingSession(): IChatEditingSession | null;
|
|
40
|
-
get currentEditingSessionObs(): IObservable<IChatEditingSession | null>;
|
|
41
|
-
private _editingSessionFileLimitPromise;
|
|
42
|
-
private _editingSessionFileLimit;
|
|
43
|
-
get editingSessionFileLimit(): number;
|
|
44
30
|
private _restoringEditingSession;
|
|
45
|
-
private _applyingChatEditsFailedContextKey;
|
|
46
31
|
private _chatRelatedFilesProviders;
|
|
47
|
-
constructor(_instantiationService: IInstantiationService, multiDiffSourceResolverService: IMultiDiffSourceResolverService, textModelService: ITextModelService, contextKeyService: IContextKeyService, _chatService: IChatService, _editorService: IEditorService, decorationsService: IDecorationsService, _fileService: IFileService, lifecycleService: ILifecycleService,
|
|
48
|
-
getOrRestoreEditingSession(): Promise<IChatEditingSession | null>;
|
|
32
|
+
constructor(_instantiationService: IInstantiationService, multiDiffSourceResolverService: IMultiDiffSourceResolverService, textModelService: ITextModelService, contextKeyService: IContextKeyService, _chatService: IChatService, _editorService: IEditorService, decorationsService: IDecorationsService, _fileService: IFileService, lifecycleService: ILifecycleService, storageService: IStorageService, logService: ILogService, extensionService: IExtensionService, productService: IProductService);
|
|
49
33
|
dispose(): void;
|
|
50
|
-
|
|
34
|
+
startOrContinueGlobalEditingSession(chatSessionId: string): Promise<IChatEditingSession>;
|
|
51
35
|
private _lookupEntry;
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
getEditingSession(chatSessionId: string): IChatEditingSession | undefined;
|
|
37
|
+
createEditingSession(chatSessionId: string, global?: boolean): Promise<IChatEditingSession>;
|
|
54
38
|
private installAutoApplyObserver;
|
|
55
|
-
private
|
|
39
|
+
private observerEditsInResponse;
|
|
56
40
|
hasRelatedFilesProviders(): boolean;
|
|
57
41
|
registerRelatedFilesProvider(handle: number, provider: IChatRelatedFilesProvider): IDisposable;
|
|
58
|
-
getRelatedFiles(chatSessionId: string, prompt: string, token: CancellationToken): Promise<{
|
|
42
|
+
getRelatedFiles(chatSessionId: string, prompt: string, files: URI[], token: CancellationToken): Promise<{
|
|
59
43
|
group: string;
|
|
60
44
|
files: IChatRelatedFile[];
|
|
61
45
|
}[] | undefined>;
|
|
62
46
|
}
|
|
63
47
|
export declare class ChatEditingMultiDiffSourceResolver implements IMultiDiffSourceResolver {
|
|
64
|
-
private readonly
|
|
48
|
+
private readonly _editingSessionsObs;
|
|
65
49
|
private readonly _instantiationService;
|
|
66
|
-
constructor(
|
|
50
|
+
constructor(_editingSessionsObs: IObservable<readonly IChatEditingSession[]>, _instantiationService: IInstantiationService);
|
|
67
51
|
canHandleUri(uri: URI): boolean;
|
|
68
52
|
resolveDiffSource(uri: URI): Promise<IResolvedMultiDiffSource>;
|
|
69
53
|
}
|