@codingame/monaco-vscode-extensions-service-override 1.83.16 → 1.85.0-next.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/extensions.js +2 -2
- package/localExtensionHost.d.ts +1 -0
- package/package.json +4 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +4 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +9 -88
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +216 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +3 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +7 -6
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +8 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +4 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +6 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +16 -9
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +3 -75
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +102 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +6 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +16 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +25 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +36 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +34 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +4 -11
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +136 -28
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +2 -4
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +67 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +8 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +25 -10
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +8 -13
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +141 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +342 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +1197 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +117 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +543 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +292 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +169 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +111 -73
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +195 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +260 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +26 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +6 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +6 -5
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +8 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +6 -4
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +6 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +24 -10
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +113 -34
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +17 -8
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +5 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +18 -8
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +2 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +7 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +5 -5
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +2 -1
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +7 -4
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +17 -12
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +17 -148
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +2 -0
- package/vscode/src/vs/platform/files/common/watcher.js +0 -71
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +0 -52
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +0 -49
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +0 -25
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
3
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
+
import { toDisposable, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
6
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
7
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
8
|
+
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
9
|
+
import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
|
|
10
|
+
|
|
11
|
+
var ChatEditorInput_1;
|
|
12
|
+
let ChatEditorInput = class ChatEditorInput extends EditorInput {
|
|
13
|
+
static { ChatEditorInput_1 = this; }
|
|
14
|
+
static { this.countsInUse = ( new Set()); }
|
|
15
|
+
static { this.TypeID = 'workbench.input.chatSession'; }
|
|
16
|
+
static { this.EditorID = 'workbench.editor.chatSession'; }
|
|
17
|
+
static getNewEditorUri() {
|
|
18
|
+
const handle = Math.floor(Math.random() * 1e9);
|
|
19
|
+
return ChatUri.generate(handle);
|
|
20
|
+
}
|
|
21
|
+
static getNextCount() {
|
|
22
|
+
let count = 0;
|
|
23
|
+
while (( ChatEditorInput_1.countsInUse.has(count))) {
|
|
24
|
+
count++;
|
|
25
|
+
}
|
|
26
|
+
return count;
|
|
27
|
+
}
|
|
28
|
+
constructor(resource, options, chatService) {
|
|
29
|
+
super();
|
|
30
|
+
this.resource = resource;
|
|
31
|
+
this.options = options;
|
|
32
|
+
this.chatService = chatService;
|
|
33
|
+
const parsed = ChatUri.parse(resource);
|
|
34
|
+
if (typeof parsed?.handle !== 'number') {
|
|
35
|
+
throw new Error('Invalid chat URI');
|
|
36
|
+
}
|
|
37
|
+
this.sessionId = 'sessionId' in options.target ? options.target.sessionId : undefined;
|
|
38
|
+
this.providerId = 'providerId' in options.target ? options.target.providerId : undefined;
|
|
39
|
+
this.inputCount = ChatEditorInput_1.getNextCount();
|
|
40
|
+
ChatEditorInput_1.countsInUse.add(this.inputCount);
|
|
41
|
+
this._register(toDisposable(() => ChatEditorInput_1.countsInUse.delete(this.inputCount)));
|
|
42
|
+
}
|
|
43
|
+
get editorId() {
|
|
44
|
+
return ChatEditorInput_1.EditorID;
|
|
45
|
+
}
|
|
46
|
+
get capabilities() {
|
|
47
|
+
return super.capabilities | 8 ;
|
|
48
|
+
}
|
|
49
|
+
matches(otherInput) {
|
|
50
|
+
return otherInput instanceof ChatEditorInput_1 && ( otherInput.resource.toString()) === ( this.resource.toString());
|
|
51
|
+
}
|
|
52
|
+
get typeId() {
|
|
53
|
+
return ChatEditorInput_1.TypeID;
|
|
54
|
+
}
|
|
55
|
+
getName() {
|
|
56
|
+
return this.model?.title || ( nls.localizeWithPath(
|
|
57
|
+
'vs/workbench/contrib/chat/browser/chatEditorInput',
|
|
58
|
+
'chatEditorName',
|
|
59
|
+
"Chat"
|
|
60
|
+
)) + (this.inputCount > 0 ? ` ${this.inputCount + 1}` : '');
|
|
61
|
+
}
|
|
62
|
+
getLabelExtraClasses() {
|
|
63
|
+
return ['chat-editor-label'];
|
|
64
|
+
}
|
|
65
|
+
async resolve() {
|
|
66
|
+
if (typeof this.sessionId === 'string') {
|
|
67
|
+
this.model = this.chatService.getOrRestoreSession(this.sessionId);
|
|
68
|
+
}
|
|
69
|
+
else if (typeof this.providerId === 'string') {
|
|
70
|
+
this.model = this.chatService.startSession(this.providerId, CancellationToken.None);
|
|
71
|
+
}
|
|
72
|
+
else if ('data' in this.options.target) {
|
|
73
|
+
this.model = this.chatService.loadSessionFromContent(this.options.target.data);
|
|
74
|
+
}
|
|
75
|
+
if (!this.model) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
this.sessionId = this.model.sessionId;
|
|
79
|
+
this.providerId = this.model.providerId;
|
|
80
|
+
this._register(this.model.onDidChange(() => this._onDidChangeLabel.fire()));
|
|
81
|
+
return this._register(( new ChatEditorModel(this.model)));
|
|
82
|
+
}
|
|
83
|
+
dispose() {
|
|
84
|
+
super.dispose();
|
|
85
|
+
if (this.sessionId) {
|
|
86
|
+
this.chatService.clearSession(this.sessionId);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
ChatEditorInput = ChatEditorInput_1 = ( __decorate([
|
|
91
|
+
( __param(2, IChatService))
|
|
92
|
+
], ChatEditorInput));
|
|
93
|
+
class ChatEditorModel extends Disposable {
|
|
94
|
+
constructor(model) {
|
|
95
|
+
super();
|
|
96
|
+
this.model = model;
|
|
97
|
+
this._onWillDispose = this._register(( new Emitter()));
|
|
98
|
+
this.onWillDispose = this._onWillDispose.event;
|
|
99
|
+
this._isDisposed = false;
|
|
100
|
+
this._isResolved = false;
|
|
101
|
+
}
|
|
102
|
+
async resolve() {
|
|
103
|
+
this._isResolved = true;
|
|
104
|
+
}
|
|
105
|
+
isResolved() {
|
|
106
|
+
return this._isResolved;
|
|
107
|
+
}
|
|
108
|
+
isDisposed() {
|
|
109
|
+
return this._isDisposed;
|
|
110
|
+
}
|
|
111
|
+
dispose() {
|
|
112
|
+
super.dispose();
|
|
113
|
+
this._isDisposed = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var ChatUri;
|
|
117
|
+
( (function(ChatUri) {
|
|
118
|
+
ChatUri.scheme = Schemas.vscodeChatSesssion;
|
|
119
|
+
function generate(handle) {
|
|
120
|
+
return ( URI.from({ scheme: ChatUri.scheme, path: `chat-${handle}` }));
|
|
121
|
+
}
|
|
122
|
+
ChatUri.generate = generate;
|
|
123
|
+
function parse(resource) {
|
|
124
|
+
if (resource.scheme !== ChatUri.scheme) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const match = resource.path.match(/chat-(\d+)/);
|
|
128
|
+
const handleStr = match?.[1];
|
|
129
|
+
if (typeof handleStr !== 'string') {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const handle = parseInt(handleStr);
|
|
133
|
+
if (isNaN(handle)) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
return { handle };
|
|
137
|
+
}
|
|
138
|
+
ChatUri.parse = parse;
|
|
139
|
+
})(ChatUri || (ChatUri = {})));
|
|
140
|
+
|
|
141
|
+
export { ChatEditorInput, ChatEditorModel, ChatUri };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
+
import { Button } from 'monaco-editor/esm/vs/base/browser/ui/button/button.js';
|
|
3
|
+
import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
4
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
6
|
+
|
|
7
|
+
const $ = dom.$;
|
|
8
|
+
class ChatFollowups extends Disposable {
|
|
9
|
+
constructor(container, followups, options, clickHandler, contextService) {
|
|
10
|
+
super();
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.clickHandler = clickHandler;
|
|
13
|
+
this.contextService = contextService;
|
|
14
|
+
const followupsContainer = dom.append(container, $('.interactive-session-followups'));
|
|
15
|
+
followups.forEach(followup => this.renderFollowup(followupsContainer, followup));
|
|
16
|
+
}
|
|
17
|
+
renderFollowup(container, followup) {
|
|
18
|
+
if (followup.kind === 'command' && followup.when && !this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(followup.when))) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const tooltip = 'tooltip' in followup ? followup.tooltip : undefined;
|
|
22
|
+
const button = this._register(( new Button(container, { ...this.options, supportIcons: true, title: tooltip })));
|
|
23
|
+
if (followup.kind === 'reply') {
|
|
24
|
+
button.element.classList.add('interactive-followup-reply');
|
|
25
|
+
}
|
|
26
|
+
else if (followup.kind === 'command') {
|
|
27
|
+
button.element.classList.add('interactive-followup-command');
|
|
28
|
+
}
|
|
29
|
+
const label = followup.kind === 'reply' ?
|
|
30
|
+
'$(sparkle) ' + (followup.title || followup.message) :
|
|
31
|
+
followup.title;
|
|
32
|
+
button.label = ( new MarkdownString(label, { supportThemeIcons: true }));
|
|
33
|
+
this._register(button.onDidClick(() => this.clickHandler(followup)));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { ChatFollowups };
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { ActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js';
|
|
4
|
+
import * as aria from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
|
|
5
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
6
|
+
import { HistoryNavigator } from 'monaco-editor/esm/vs/base/common/history.js';
|
|
7
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
8
|
+
import { isMacintosh } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
9
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
10
|
+
import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
|
|
11
|
+
import { CodeEditorWidget } from 'monaco-editor/esm/vs/editor/browser/widget/codeEditorWidget.js';
|
|
12
|
+
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
13
|
+
import { ModesHoverController } from 'monaco-editor/esm/vs/editor/contrib/hover/browser/hover.js';
|
|
14
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
15
|
+
import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
|
|
16
|
+
import { MenuWorkbenchToolBar } from 'monaco-editor/esm/vs/platform/actions/browser/toolbar.js';
|
|
17
|
+
import { MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
18
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
19
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
20
|
+
import { registerAndCreateHistoryNavigationContext } from 'monaco-editor/esm/vs/platform/history/browser/contextScopedHistoryWidget.js';
|
|
21
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
22
|
+
import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
23
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
24
|
+
import { DEFAULT_FONT_FAMILY } from 'vscode/vscode/vs/workbench/browser/style';
|
|
25
|
+
import { SubmitAction } from './actions/chatExecuteActions.js';
|
|
26
|
+
import { ChatFollowups } from './chatFollowups.js';
|
|
27
|
+
import { IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
|
|
28
|
+
import { CONTEXT_CHAT_INPUT_HAS_TEXT, CONTEXT_IN_CHAT_INPUT } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
29
|
+
import { chatAgentLeader } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParserTypes';
|
|
30
|
+
import { IChatWidgetHistoryService } from '../common/chatWidgetHistoryService.js';
|
|
31
|
+
import { getSimpleEditorOptions, getSimpleCodeEditorWidgetOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
32
|
+
import { ChatSubmitEditorAction, ChatSubmitSecondaryAgentEditorAction } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
33
|
+
|
|
34
|
+
var ChatInputPart_1;
|
|
35
|
+
const $ = dom.$;
|
|
36
|
+
const INPUT_EDITOR_MAX_HEIGHT = 250;
|
|
37
|
+
let ChatInputPart = class ChatInputPart extends Disposable {
|
|
38
|
+
static { ChatInputPart_1 = this; }
|
|
39
|
+
static { this.INPUT_SCHEME = 'chatSessionInput'; }
|
|
40
|
+
static { this._counter = 0; }
|
|
41
|
+
get inputEditor() {
|
|
42
|
+
return this._inputEditor;
|
|
43
|
+
}
|
|
44
|
+
constructor(
|
|
45
|
+
options, historyService, modelService, instantiationService, contextKeyService, configurationService, keybindingService, accessibilityService) {
|
|
46
|
+
super();
|
|
47
|
+
this.options = options;
|
|
48
|
+
this.historyService = historyService;
|
|
49
|
+
this.modelService = modelService;
|
|
50
|
+
this.instantiationService = instantiationService;
|
|
51
|
+
this.contextKeyService = contextKeyService;
|
|
52
|
+
this.configurationService = configurationService;
|
|
53
|
+
this.keybindingService = keybindingService;
|
|
54
|
+
this.accessibilityService = accessibilityService;
|
|
55
|
+
this._onDidLoadInputState = this._register(( new Emitter()));
|
|
56
|
+
this.onDidLoadInputState = this._onDidLoadInputState.event;
|
|
57
|
+
this._onDidChangeHeight = this._register(( new Emitter()));
|
|
58
|
+
this.onDidChangeHeight = this._onDidChangeHeight.event;
|
|
59
|
+
this._onDidFocus = this._register(( new Emitter()));
|
|
60
|
+
this.onDidFocus = this._onDidFocus.event;
|
|
61
|
+
this._onDidBlur = this._register(( new Emitter()));
|
|
62
|
+
this.onDidBlur = this._onDidBlur.event;
|
|
63
|
+
this._onDidAcceptFollowup = this._register(( new Emitter()));
|
|
64
|
+
this.onDidAcceptFollowup = this._onDidAcceptFollowup.event;
|
|
65
|
+
this.inputEditorHeight = 0;
|
|
66
|
+
this.followupsDisposables = this._register(( new DisposableStore()));
|
|
67
|
+
this.historyStates = ( new Map());
|
|
68
|
+
this.inputUri = ( URI.parse(`${ChatInputPart_1.INPUT_SCHEME}:input-${ChatInputPart_1._counter++}`));
|
|
69
|
+
this.inputEditorHasText = CONTEXT_CHAT_INPUT_HAS_TEXT.bindTo(contextKeyService);
|
|
70
|
+
this.history = ( new HistoryNavigator([], 5));
|
|
71
|
+
this._register(this.historyService.onDidClearHistory(() => this.history.clear()));
|
|
72
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
73
|
+
if (e.affectsConfiguration("accessibility.verbosity.panelChat" )) {
|
|
74
|
+
this.inputEditor.updateOptions({ ariaLabel: this._getAriaLabel() });
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
_getAriaLabel() {
|
|
79
|
+
const verbose = this.configurationService.getValue("accessibility.verbosity.panelChat" );
|
|
80
|
+
if (verbose) {
|
|
81
|
+
const kbLabel = this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp" )?.getLabel();
|
|
82
|
+
return kbLabel ? ( localizeWithPath(
|
|
83
|
+
'vs/workbench/contrib/chat/browser/chatInputPart',
|
|
84
|
+
'actions.chat.accessibiltyHelp',
|
|
85
|
+
"Chat Input, Type to ask questions or type / for topics, press enter to send out the request. Use {0} for Chat Accessibility Help.",
|
|
86
|
+
kbLabel
|
|
87
|
+
)) : ( localizeWithPath(
|
|
88
|
+
'vs/workbench/contrib/chat/browser/chatInputPart',
|
|
89
|
+
'chatInput.accessibilityHelpNoKb',
|
|
90
|
+
"Chat Input, Type code here and press Enter to run. Use the Chat Accessibility Help command for more information."
|
|
91
|
+
));
|
|
92
|
+
}
|
|
93
|
+
return ( localizeWithPath(
|
|
94
|
+
'vs/workbench/contrib/chat/browser/chatInputPart',
|
|
95
|
+
'chatInput',
|
|
96
|
+
"Chat Input"
|
|
97
|
+
));
|
|
98
|
+
}
|
|
99
|
+
setState(providerId, inputValue) {
|
|
100
|
+
this.providerId = providerId;
|
|
101
|
+
const history = this.historyService.getHistory(providerId);
|
|
102
|
+
this.historyStates = ( new Map(( history.map(h => [h.text, h.state]))));
|
|
103
|
+
const historyTexts = [];
|
|
104
|
+
this.historyStates.forEach((_, str) => historyTexts.push(str));
|
|
105
|
+
this.history = ( new HistoryNavigator(historyTexts, 50));
|
|
106
|
+
if (typeof inputValue === 'string') {
|
|
107
|
+
this.setValue(inputValue);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
get element() {
|
|
111
|
+
return this.container;
|
|
112
|
+
}
|
|
113
|
+
showPreviousValue() {
|
|
114
|
+
this.navigateHistory(true);
|
|
115
|
+
}
|
|
116
|
+
showNextValue() {
|
|
117
|
+
this.navigateHistory(false);
|
|
118
|
+
}
|
|
119
|
+
navigateHistory(previous) {
|
|
120
|
+
const historyInput = (previous ?
|
|
121
|
+
(this.history.previous() ?? this.history.first()) : this.history.next())
|
|
122
|
+
?? '';
|
|
123
|
+
aria.status(historyInput);
|
|
124
|
+
this.setValue(historyInput);
|
|
125
|
+
this._onDidLoadInputState.fire(this.historyStates.get(historyInput));
|
|
126
|
+
if (previous) {
|
|
127
|
+
this._inputEditor.setPosition({ lineNumber: 1, column: 1 });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const model = this._inputEditor.getModel();
|
|
131
|
+
if (!model) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
this._inputEditor.setPosition(getLastPosition(model));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
setValue(value) {
|
|
138
|
+
this.inputEditor.setValue(value);
|
|
139
|
+
this.inputEditor.setPosition({ lineNumber: 1, column: value.length + 1 });
|
|
140
|
+
}
|
|
141
|
+
focus() {
|
|
142
|
+
this._inputEditor.focus();
|
|
143
|
+
}
|
|
144
|
+
hasFocus() {
|
|
145
|
+
return this._inputEditor.hasWidgetFocus();
|
|
146
|
+
}
|
|
147
|
+
async acceptInput(userQuery, inputState) {
|
|
148
|
+
if (userQuery) {
|
|
149
|
+
this.history.add(userQuery);
|
|
150
|
+
this.historyStates.set(userQuery, inputState);
|
|
151
|
+
}
|
|
152
|
+
if (this.accessibilityService.isScreenReaderOptimized() && isMacintosh) {
|
|
153
|
+
this._acceptInputForVoiceover();
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
this._inputEditor.focus();
|
|
157
|
+
this._inputEditor.setValue('');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
_acceptInputForVoiceover() {
|
|
161
|
+
const domNode = this._inputEditor.getDomNode();
|
|
162
|
+
if (!domNode) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this._inputEditorElement.removeChild(domNode);
|
|
166
|
+
this._inputEditor.setValue('');
|
|
167
|
+
this._inputEditorElement.appendChild(domNode);
|
|
168
|
+
this._inputEditor.focus();
|
|
169
|
+
}
|
|
170
|
+
render(container, initialValue, widget) {
|
|
171
|
+
this.container = dom.append(container, $('.interactive-input-part'));
|
|
172
|
+
this.followupsContainer = dom.append(this.container, $('.interactive-input-followups'));
|
|
173
|
+
const inputAndSideToolbar = dom.append(this.container, $('.interactive-input-and-side-toolbar'));
|
|
174
|
+
const inputContainer = dom.append(inputAndSideToolbar, $('.interactive-input-and-execute-toolbar'));
|
|
175
|
+
const inputScopedContextKeyService = this._register(this.contextKeyService.createScoped(inputContainer));
|
|
176
|
+
CONTEXT_IN_CHAT_INPUT.bindTo(inputScopedContextKeyService).set(true);
|
|
177
|
+
const scopedInstantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, inputScopedContextKeyService])));
|
|
178
|
+
const { historyNavigationBackwardsEnablement, historyNavigationForwardsEnablement } = this._register(registerAndCreateHistoryNavigationContext(inputScopedContextKeyService, this));
|
|
179
|
+
this.historyNavigationBackwardsEnablement = historyNavigationBackwardsEnablement;
|
|
180
|
+
this.historyNavigationForewardsEnablement = historyNavigationForwardsEnablement;
|
|
181
|
+
const options = getSimpleEditorOptions(this.configurationService);
|
|
182
|
+
options.readOnly = false;
|
|
183
|
+
options.ariaLabel = this._getAriaLabel();
|
|
184
|
+
options.fontFamily = DEFAULT_FONT_FAMILY;
|
|
185
|
+
options.fontSize = 13;
|
|
186
|
+
options.lineHeight = 20;
|
|
187
|
+
options.padding = this.options.renderStyle === 'compact' ? { top: 2, bottom: 2 } : { top: 8, bottom: 8 };
|
|
188
|
+
options.cursorWidth = 1;
|
|
189
|
+
options.wrappingStrategy = 'advanced';
|
|
190
|
+
options.bracketPairColorization = { enabled: false };
|
|
191
|
+
options.suggest = { showIcons: false };
|
|
192
|
+
options.scrollbar = { ...(options.scrollbar ?? {}), vertical: 'hidden' };
|
|
193
|
+
this._inputEditorElement = dom.append(inputContainer, $('.interactive-input-editor'));
|
|
194
|
+
const editorOptions = getSimpleCodeEditorWidgetOptions();
|
|
195
|
+
editorOptions.contributions?.push(...EditorExtensionsRegistry.getSomeEditorContributions([ModesHoverController.ID]));
|
|
196
|
+
this._inputEditor = this._register(scopedInstantiationService.createInstance(CodeEditorWidget, this._inputEditorElement, options, editorOptions));
|
|
197
|
+
this._register(this._inputEditor.onDidChangeModelContent(() => {
|
|
198
|
+
const currentHeight = Math.min(this._inputEditor.getContentHeight(), INPUT_EDITOR_MAX_HEIGHT);
|
|
199
|
+
if (currentHeight !== this.inputEditorHeight) {
|
|
200
|
+
this.inputEditorHeight = currentHeight;
|
|
201
|
+
this._onDidChangeHeight.fire();
|
|
202
|
+
}
|
|
203
|
+
const model = this._inputEditor.getModel();
|
|
204
|
+
const inputHasText = !!model && model.getValueLength() > 0;
|
|
205
|
+
this.inputEditorHasText.set(inputHasText);
|
|
206
|
+
}));
|
|
207
|
+
this._register(this._inputEditor.onDidFocusEditorText(() => {
|
|
208
|
+
this._onDidFocus.fire();
|
|
209
|
+
inputContainer.classList.toggle('focused', true);
|
|
210
|
+
}));
|
|
211
|
+
this._register(this._inputEditor.onDidBlurEditorText(() => {
|
|
212
|
+
inputContainer.classList.toggle('focused', false);
|
|
213
|
+
this._onDidBlur.fire();
|
|
214
|
+
}));
|
|
215
|
+
this._register(this._inputEditor.onDidChangeCursorPosition(e => {
|
|
216
|
+
const model = this._inputEditor.getModel();
|
|
217
|
+
if (!model) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
this.historyNavigationBackwardsEnablement.set(e.position.column === 1 && e.position.lineNumber === 1);
|
|
221
|
+
this.historyNavigationForewardsEnablement.set(e.position.equals(getLastPosition(model)));
|
|
222
|
+
}));
|
|
223
|
+
this.toolbar = this._register(this.instantiationService.createInstance(MenuWorkbenchToolBar, inputContainer, MenuId.ChatExecute, {
|
|
224
|
+
menuOptions: {
|
|
225
|
+
shouldForwardArgs: true
|
|
226
|
+
},
|
|
227
|
+
actionViewItemProvider: (action, options) => {
|
|
228
|
+
if (action.id === SubmitAction.ID) {
|
|
229
|
+
return this.instantiationService.createInstance(SubmitButtonActionViewItem, { widget }, action, options);
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
}));
|
|
234
|
+
this.toolbar.getElement().classList.add('interactive-execute-toolbar');
|
|
235
|
+
this.toolbar.context = { widget };
|
|
236
|
+
this._register(this.toolbar.onDidChangeMenuItems(() => {
|
|
237
|
+
if (this.cachedDimensions && typeof this.cachedToolbarWidth === 'number' && this.cachedToolbarWidth !== this.toolbar.getItemsWidth()) {
|
|
238
|
+
this.layout(this.cachedDimensions.height, this.cachedDimensions.width);
|
|
239
|
+
}
|
|
240
|
+
}));
|
|
241
|
+
if (this.options.renderStyle === 'compact') {
|
|
242
|
+
const toolbarSide = this._register(this.instantiationService.createInstance(MenuWorkbenchToolBar, inputAndSideToolbar, MenuId.ChatInputSide, {
|
|
243
|
+
menuOptions: {
|
|
244
|
+
shouldForwardArgs: true
|
|
245
|
+
}
|
|
246
|
+
}));
|
|
247
|
+
toolbarSide.getElement().classList.add('chat-side-toolbar');
|
|
248
|
+
toolbarSide.context = { widget };
|
|
249
|
+
}
|
|
250
|
+
this.inputModel = this.modelService.getModel(this.inputUri) || this.modelService.createModel('', null, this.inputUri, true);
|
|
251
|
+
this.inputModel.updateOptions({ bracketColorizationOptions: { enabled: false, independentColorPoolPerBracketType: false } });
|
|
252
|
+
this._inputEditor.setModel(this.inputModel);
|
|
253
|
+
if (initialValue) {
|
|
254
|
+
this.inputModel.setValue(initialValue);
|
|
255
|
+
const lineNumber = this.inputModel.getLineCount();
|
|
256
|
+
this._inputEditor.setPosition({ lineNumber, column: this.inputModel.getLineMaxColumn(lineNumber) });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async renderFollowups(items, response) {
|
|
260
|
+
if (!this.options.renderFollowups) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
this.followupsDisposables.clear();
|
|
264
|
+
dom.clearNode(this.followupsContainer);
|
|
265
|
+
if (items && items.length > 0) {
|
|
266
|
+
this.followupsDisposables.add(( new ChatFollowups(
|
|
267
|
+
this.followupsContainer,
|
|
268
|
+
items,
|
|
269
|
+
undefined,
|
|
270
|
+
followup => this._onDidAcceptFollowup.fire({ followup, response }),
|
|
271
|
+
this.contextKeyService
|
|
272
|
+
)));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
layout(height, width) {
|
|
276
|
+
this.cachedDimensions = new dom.Dimension(width, height);
|
|
277
|
+
return this._layout(height, width);
|
|
278
|
+
}
|
|
279
|
+
_layout(height, width, allowRecurse = true) {
|
|
280
|
+
const followupsHeight = this.followupsContainer.offsetHeight;
|
|
281
|
+
const inputPartBorder = 1;
|
|
282
|
+
const inputPartHorizontalPadding = 40;
|
|
283
|
+
const inputPartVerticalPadding = 24;
|
|
284
|
+
const inputEditorHeight = Math.min(this._inputEditor.getContentHeight(), height - followupsHeight - inputPartHorizontalPadding - inputPartBorder, INPUT_EDITOR_MAX_HEIGHT);
|
|
285
|
+
const inputEditorBorder = 2;
|
|
286
|
+
const inputPartHeight = followupsHeight + inputEditorHeight + inputPartVerticalPadding + inputPartBorder + inputEditorBorder;
|
|
287
|
+
const editorBorder = 2;
|
|
288
|
+
const editorPadding = 8;
|
|
289
|
+
const executeToolbarWidth = this.cachedToolbarWidth = this.toolbar.getItemsWidth();
|
|
290
|
+
const sideToolbarWidth = this.options.renderStyle === 'compact' ? 20 : 0;
|
|
291
|
+
const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
|
|
292
|
+
this._inputEditor.layout({ width: width - inputPartHorizontalPadding - editorBorder - editorPadding - executeToolbarWidth - sideToolbarWidth, height: inputEditorHeight });
|
|
293
|
+
if (allowRecurse && initialEditorScrollWidth < 10) {
|
|
294
|
+
return this._layout(height, width, false);
|
|
295
|
+
}
|
|
296
|
+
return inputPartHeight;
|
|
297
|
+
}
|
|
298
|
+
saveState() {
|
|
299
|
+
const inputHistory = this.history.getHistory();
|
|
300
|
+
const historyEntries = ( inputHistory.map(entry => ({ text: entry, state: this.historyStates.get(entry) })));
|
|
301
|
+
this.historyService.saveHistory(this.providerId, historyEntries);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
ChatInputPart = ChatInputPart_1 = ( __decorate([
|
|
305
|
+
( __param(1, IChatWidgetHistoryService)),
|
|
306
|
+
( __param(2, IModelService)),
|
|
307
|
+
( __param(3, IInstantiationService)),
|
|
308
|
+
( __param(4, IContextKeyService)),
|
|
309
|
+
( __param(5, IConfigurationService)),
|
|
310
|
+
( __param(6, IKeybindingService)),
|
|
311
|
+
( __param(7, IAccessibilityService))
|
|
312
|
+
], ChatInputPart));
|
|
313
|
+
let SubmitButtonActionViewItem = class SubmitButtonActionViewItem extends ActionViewItem {
|
|
314
|
+
constructor(context, action, options, keybindingService, chatAgentService) {
|
|
315
|
+
super(context, action, options);
|
|
316
|
+
const primaryKeybinding = keybindingService.lookupKeybinding(ChatSubmitEditorAction.ID)?.getLabel();
|
|
317
|
+
let tooltip = action.label;
|
|
318
|
+
if (primaryKeybinding) {
|
|
319
|
+
tooltip += ` (${primaryKeybinding})`;
|
|
320
|
+
}
|
|
321
|
+
const secondaryAgent = chatAgentService.getSecondaryAgent();
|
|
322
|
+
if (secondaryAgent) {
|
|
323
|
+
const secondaryKeybinding = keybindingService.lookupKeybinding(ChatSubmitSecondaryAgentEditorAction.ID)?.getLabel();
|
|
324
|
+
if (secondaryKeybinding) {
|
|
325
|
+
tooltip += `\n${chatAgentLeader}${secondaryAgent.id} (${secondaryKeybinding})`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
this._tooltip = tooltip;
|
|
329
|
+
}
|
|
330
|
+
getTooltip() {
|
|
331
|
+
return this._tooltip;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
SubmitButtonActionViewItem = ( __decorate([
|
|
335
|
+
( __param(3, IKeybindingService)),
|
|
336
|
+
( __param(4, IChatAgentService))
|
|
337
|
+
], SubmitButtonActionViewItem));
|
|
338
|
+
function getLastPosition(model) {
|
|
339
|
+
return { lineNumber: model.getLineCount(), column: model.getLineLength(model.getLineCount()) + 1 };
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export { ChatInputPart };
|