@codingame/monaco-vscode-chat-service-override 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/chat.d.ts +5 -0
  2. package/chat.js +39 -0
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  4. package/external/tslib/tslib.es6.js +11 -0
  5. package/index.d.ts +1 -0
  6. package/index.js +1 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +24 -0
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +17 -0
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +115 -0
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +509 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +88 -0
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +83 -0
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +110 -0
  15. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +223 -0
  16. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +283 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +283 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +61 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +179 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +88 -0
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +271 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +91 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +165 -0
  24. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +26 -0
  25. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +626 -0
  26. package/vscode/src/vs/workbench/contrib/chat/browser/media/chatEditor.css.js +6 -0
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +31 -0
  28. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +564 -0
  29. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +41 -0
  30. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +41 -0
  31. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +748 -0
  32. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDecorations.js +250 -0
  33. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +62 -0
  34. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +35 -0
@@ -0,0 +1,250 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
3
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
4
+ import { GlyphMarginLane } from 'monaco-editor/esm/vs/editor/common/model.js';
5
+ import { ModelDecorationOptions } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
6
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
7
+ import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
8
+ import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
9
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
10
+ import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
11
+ import { GutterActionsRegistry } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/editorLineNumberMenu';
12
+ import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
13
+ import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
14
+ import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
15
+ import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
16
+ import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
17
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession';
18
+ import { MarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
19
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
20
+ import { LOCALIZED_START_INLINE_CHAT_STRING } from './inlineChatActions.js';
21
+ import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
22
+ import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
23
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
24
+
25
+ var InlineChatDecorationsContribution_1;
26
+ const GUTTER_INLINE_CHAT_OPAQUE_ICON = registerIcon('inline-chat-opaque', Codicon.sparkle, ( localizeWithPath(
27
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatDecorations',
28
+ 'startInlineChatOpaqueIcon',
29
+ 'Icon which spawns the inline chat from the gutter. It is half opaque by default and becomes completely opaque on hover.'
30
+ )));
31
+ const GUTTER_INLINE_CHAT_TRANSPARENT_ICON = registerIcon('inline-chat-transparent', Codicon.sparkle, ( localizeWithPath(
32
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatDecorations',
33
+ 'startInlineChatTransparentIcon',
34
+ 'Icon which spawns the inline chat from the gutter. It is transparent by default and becomes opaque on hover.'
35
+ )));
36
+ let InlineChatDecorationsContribution = class InlineChatDecorationsContribution extends Disposable {
37
+ static { InlineChatDecorationsContribution_1 = this; }
38
+ static { this.TOOLBAR_SETTING_ID = 'inlineChat.showToolbarIcon'; }
39
+ static { this.GUTTER_SETTING_ID = 'inlineChat.showGutterIcon'; }
40
+ static { this.GUTTER_ICON_OPAQUE_CLASSNAME = 'codicon-inline-chat-opaque'; }
41
+ static { this.GUTTER_ICON_TRANSPARENT_CLASSNAME = 'codicon-inline-chat-transparent'; }
42
+ constructor(_editor, _contextKeyService, _inlineChatService, _inlineChatSessionService, _configurationService, _keybindingService, _debugService) {
43
+ super();
44
+ this._editor = _editor;
45
+ this._inlineChatService = _inlineChatService;
46
+ this._inlineChatSessionService = _inlineChatSessionService;
47
+ this._configurationService = _configurationService;
48
+ this._keybindingService = _keybindingService;
49
+ this._debugService = _debugService;
50
+ this._currentBreakpoints = [];
51
+ this._hasInlineChatSession = false;
52
+ this._hasActiveDebugSession = false;
53
+ this._debugSessions = ( new Set());
54
+ this._localToDispose = ( new DisposableStore());
55
+ this._gutterDecorationTransparent = this._registerGutterDecoration(true);
56
+ this._gutterDecorationOpaque = this._registerGutterDecoration(false);
57
+ this._register(this._configurationService.onDidChangeConfiguration((e) => {
58
+ if (!e.affectsConfiguration(InlineChatDecorationsContribution_1.GUTTER_SETTING_ID)) {
59
+ return;
60
+ }
61
+ this._onEnablementOrModelChanged();
62
+ }));
63
+ this._register(this._inlineChatSessionService.onWillStartSession((e) => {
64
+ if (e === this._editor) {
65
+ this._hasInlineChatSession = true;
66
+ this._onEnablementOrModelChanged();
67
+ }
68
+ }));
69
+ this._register(this._inlineChatSessionService.onDidEndSession((e) => {
70
+ if (e === this._editor) {
71
+ this._hasInlineChatSession = false;
72
+ this._onEnablementOrModelChanged();
73
+ }
74
+ }));
75
+ this._register(this._debugService.onWillNewSession((session) => {
76
+ this._debugSessions.add(session);
77
+ if (!this._hasActiveDebugSession) {
78
+ this._hasActiveDebugSession = true;
79
+ this._onEnablementOrModelChanged();
80
+ }
81
+ }));
82
+ this._register(this._debugService.onDidEndSession((session) => {
83
+ this._debugSessions.delete(session);
84
+ if (this._debugSessions.size === 0) {
85
+ this._hasActiveDebugSession = false;
86
+ this._onEnablementOrModelChanged();
87
+ }
88
+ }));
89
+ this._register(this._inlineChatService.onDidChangeProviders(() => this._onEnablementOrModelChanged()));
90
+ this._register(this._editor.onDidChangeModel(() => this._onEnablementOrModelChanged()));
91
+ this._register(this._keybindingService.onDidUpdateKeybindings(() => {
92
+ this._updateDecorationHover();
93
+ this._onEnablementOrModelChanged();
94
+ }));
95
+ this._updateDecorationHover();
96
+ this._onEnablementOrModelChanged();
97
+ }
98
+ _registerGutterDecoration(isTransparent) {
99
+ return ModelDecorationOptions.register({
100
+ description: 'inline-chat-decoration',
101
+ glyphMarginClassName: ThemeIcon.asClassName(isTransparent ? GUTTER_INLINE_CHAT_TRANSPARENT_ICON : GUTTER_INLINE_CHAT_OPAQUE_ICON),
102
+ glyphMargin: { position: GlyphMarginLane.Left },
103
+ stickiness: 1 ,
104
+ });
105
+ }
106
+ _updateDecorationHover() {
107
+ const keybinding = this._keybindingService.lookupKeybinding('inlineChat.start')?.getLabel() ?? undefined;
108
+ if (this._inlineChatKeybinding === keybinding) {
109
+ return;
110
+ }
111
+ this._inlineChatKeybinding = keybinding;
112
+ const hoverMessage = ( new MarkdownString(keybinding ? ( localizeWithPath(
113
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatDecorations',
114
+ 'runWithKeybinding',
115
+ 'Start Inline Chat ({0})',
116
+ keybinding
117
+ )) : LOCALIZED_START_INLINE_CHAT_STRING));
118
+ this._gutterDecorationTransparent.glyphMarginHoverMessage = hoverMessage;
119
+ this._gutterDecorationOpaque.glyphMarginHoverMessage = hoverMessage;
120
+ }
121
+ _updateCurrentBreakpoints(uri) {
122
+ this._currentBreakpoints = this._debugService.getModel().getBreakpoints({ uri });
123
+ }
124
+ _onEnablementOrModelChanged() {
125
+ this._localToDispose.clear();
126
+ if (!this._editor.hasModel() || this._hasActiveDebugSession || this._hasInlineChatSession || this._showGutterIconMode() === "never" || !this._hasProvider()) {
127
+ return;
128
+ }
129
+ const editor = this._editor;
130
+ const decorationUpdateScheduler = ( new RunOnceScheduler(() => this._onSelectionOrContentChanged(editor), 100));
131
+ this._localToDispose.add(decorationUpdateScheduler);
132
+ this._localToDispose.add(this._debugService.getModel().onDidChangeBreakpoints(() => {
133
+ this._updateCurrentBreakpoints(editor.getModel().uri);
134
+ decorationUpdateScheduler.schedule();
135
+ }));
136
+ this._localToDispose.add(this._editor.onDidChangeCursorSelection(() => decorationUpdateScheduler.schedule()));
137
+ this._localToDispose.add(this._editor.onDidChangeModelContent(() => decorationUpdateScheduler.schedule()));
138
+ this._localToDispose.add(this._editor.onMouseDown(async (e) => {
139
+ const showGutterIconMode = this._showGutterIconMode();
140
+ const gutterDecorationClassName = showGutterIconMode === "always" ?
141
+ InlineChatDecorationsContribution_1.GUTTER_ICON_OPAQUE_CLASSNAME :
142
+ (showGutterIconMode === "mouseover" ?
143
+ InlineChatDecorationsContribution_1.GUTTER_ICON_TRANSPARENT_CLASSNAME : undefined);
144
+ if (!gutterDecorationClassName || !e.target.element?.classList.contains(gutterDecorationClassName)) {
145
+ return;
146
+ }
147
+ InlineChatController.get(this._editor)?.run();
148
+ }));
149
+ this._localToDispose.add({
150
+ dispose: () => {
151
+ if (this._gutterDecorationID) {
152
+ this._removeGutterDecoration(this._gutterDecorationID);
153
+ }
154
+ }
155
+ });
156
+ this._updateCurrentBreakpoints(editor.getModel().uri);
157
+ decorationUpdateScheduler.schedule();
158
+ }
159
+ _onSelectionOrContentChanged(editor) {
160
+ const selection = editor.getSelection();
161
+ const startLineNumber = selection.startLineNumber;
162
+ const model = editor.getModel();
163
+ let isEnabled = false;
164
+ const hasBreakpoint = ( this._currentBreakpoints.some(bp => bp.lineNumber === startLineNumber));
165
+ if (!hasBreakpoint) {
166
+ const selectionIsEmpty = selection.isEmpty();
167
+ if (selectionIsEmpty) {
168
+ if (/^\s*$/g.test(model.getLineContent(startLineNumber))) {
169
+ isEnabled = true;
170
+ }
171
+ }
172
+ else {
173
+ const startPosition = selection.getStartPosition();
174
+ const endPosition = selection.getEndPosition();
175
+ const startWord = model.getWordAtPosition(startPosition);
176
+ const endWord = model.getWordAtPosition(endPosition);
177
+ const isFirstWordCoveredOrNull = !!startWord ? startPosition.column <= startWord.startColumn : true;
178
+ const isLastWordCoveredOrNull = !!endWord ? endPosition.column >= endWord.endColumn : true;
179
+ isEnabled = isFirstWordCoveredOrNull && isLastWordCoveredOrNull;
180
+ }
181
+ }
182
+ if (isEnabled) {
183
+ if (this._gutterDecorationID === undefined) {
184
+ this._addGutterDecoration(startLineNumber);
185
+ }
186
+ else {
187
+ const decorationRange = model.getDecorationRange(this._gutterDecorationID);
188
+ if (decorationRange?.startLineNumber !== startLineNumber) {
189
+ this._updateGutterDecoration(this._gutterDecorationID, startLineNumber);
190
+ }
191
+ }
192
+ }
193
+ else if (this._gutterDecorationID) {
194
+ this._removeGutterDecoration(this._gutterDecorationID);
195
+ }
196
+ }
197
+ _showGutterIconMode() {
198
+ return this._configurationService.getValue(InlineChatDecorationsContribution_1.GUTTER_SETTING_ID);
199
+ }
200
+ _hasProvider() {
201
+ return !Iterable.isEmpty(this._inlineChatService.getAllProvider());
202
+ }
203
+ _addGutterDecoration(lineNumber) {
204
+ this._editor.changeDecorations((accessor) => {
205
+ const showGutterIconMode = this._showGutterIconMode();
206
+ if (showGutterIconMode === "never" ) {
207
+ return;
208
+ }
209
+ this._gutterDecorationID = accessor.addDecoration(( new Range(lineNumber, 0, lineNumber, 0)), showGutterIconMode === "always" ? this._gutterDecorationOpaque : this._gutterDecorationTransparent);
210
+ });
211
+ }
212
+ _removeGutterDecoration(decorationId) {
213
+ this._editor.changeDecorations((accessor) => {
214
+ accessor.removeDecoration(decorationId);
215
+ });
216
+ this._gutterDecorationID = undefined;
217
+ }
218
+ _updateGutterDecoration(decorationId, lineNumber) {
219
+ this._editor.changeDecorations((accessor) => {
220
+ accessor.changeDecoration(decorationId, ( new Range(lineNumber, 0, lineNumber, 0)));
221
+ });
222
+ }
223
+ dispose() {
224
+ super.dispose();
225
+ this._localToDispose.dispose();
226
+ }
227
+ };
228
+ InlineChatDecorationsContribution = InlineChatDecorationsContribution_1 = ( __decorate([
229
+ ( __param(1, IContextKeyService)),
230
+ ( __param(2, IInlineChatService)),
231
+ ( __param(3, IInlineChatSessionService)),
232
+ ( __param(4, IConfigurationService)),
233
+ ( __param(5, IKeybindingService)),
234
+ ( __param(6, IDebugService))
235
+ ], InlineChatDecorationsContribution));
236
+ GutterActionsRegistry.registerGutterActionsGenerator(({ lineNumber, editor, accessor }, result) => {
237
+ const inlineChatService = accessor.get(IInlineChatService);
238
+ const noProviders = Iterable.isEmpty(inlineChatService.getAllProvider());
239
+ if (noProviders) {
240
+ return;
241
+ }
242
+ const preferencesService = accessor.get(IPreferencesService);
243
+ result.push(( new Action('inlineChat.configureShowGutterIcon', ( localizeWithPath(
244
+ 'vs/workbench/contrib/inlineChat/browser/inlineChatDecorations',
245
+ 'configureShowGutterIcon',
246
+ "Configure Inline Chat Icon"
247
+ )), undefined, true, () => { preferencesService.openUserSettings({ query: 'inlineChat.showGutterIcon' }); })));
248
+ });
249
+
250
+ export { InlineChatDecorationsContribution };
@@ -0,0 +1,62 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { illegalState } from 'monaco-editor/esm/vs/base/common/errors.js';
3
+ import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
5
+ import { isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
6
+ import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
7
+ import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSession';
8
+ import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
9
+ import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
10
+
11
+ let InlineChatNotebookContribution = class InlineChatNotebookContribution {
12
+ constructor(sessionService, notebookEditorService) {
13
+ this._store = ( new DisposableStore());
14
+ this._store.add(sessionService.registerSessionKeyComputer(Schemas.vscodeNotebookCell, {
15
+ getComparisonKey: (_editor, uri) => {
16
+ const data = CellUri.parse(uri);
17
+ if (!data) {
18
+ throw illegalState('Expected notebook');
19
+ }
20
+ for (const editor of notebookEditorService.listNotebookEditors()) {
21
+ if (isEqual(editor.textModel?.uri, data.notebook)) {
22
+ return `<notebook>${editor.getId()}#${uri}`;
23
+ }
24
+ }
25
+ throw illegalState('Expected notebook');
26
+ }
27
+ }));
28
+ this._store.add(sessionService.onWillStartSession(newSessionEditor => {
29
+ const candidate = CellUri.parse(newSessionEditor.getModel().uri);
30
+ if (!candidate) {
31
+ return;
32
+ }
33
+ for (const notebookEditor of notebookEditorService.listNotebookEditors()) {
34
+ if (isEqual(notebookEditor.textModel?.uri, candidate.notebook)) {
35
+ let found = false;
36
+ const editors = [];
37
+ for (const [, codeEditor] of notebookEditor.codeEditors) {
38
+ editors.push(codeEditor);
39
+ found = codeEditor === newSessionEditor || found;
40
+ }
41
+ if (found) {
42
+ for (const editor of editors) {
43
+ if (editor !== newSessionEditor) {
44
+ InlineChatController.get(editor)?.finishExistingSession();
45
+ }
46
+ }
47
+ break;
48
+ }
49
+ }
50
+ }
51
+ }));
52
+ }
53
+ dispose() {
54
+ this._store.dispose();
55
+ }
56
+ };
57
+ InlineChatNotebookContribution = ( __decorate([
58
+ ( __param(0, IInlineChatSessionService)),
59
+ ( __param(1, INotebookEditorService))
60
+ ], InlineChatNotebookContribution));
61
+
62
+ export { InlineChatNotebookContribution };
@@ -0,0 +1,35 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
4
+ import { LinkedList } from 'monaco-editor/esm/vs/base/common/linkedList.js';
5
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
6
+ import { CTX_INLINE_CHAT_HAS_PROVIDER } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
7
+
8
+ let InlineChatServiceImpl = class InlineChatServiceImpl {
9
+ get onDidChangeProviders() {
10
+ return this._onDidChangeProviders.event;
11
+ }
12
+ constructor(contextKeyService) {
13
+ this._entries = ( new LinkedList());
14
+ this._onDidChangeProviders = ( new Emitter());
15
+ this._ctxHasProvider = CTX_INLINE_CHAT_HAS_PROVIDER.bindTo(contextKeyService);
16
+ }
17
+ addProvider(provider) {
18
+ const rm = this._entries.push(provider);
19
+ this._ctxHasProvider.set(true);
20
+ this._onDidChangeProviders.fire();
21
+ return toDisposable(() => {
22
+ rm();
23
+ this._ctxHasProvider.set(this._entries.size > 0);
24
+ this._onDidChangeProviders.fire();
25
+ });
26
+ }
27
+ getAllProvider() {
28
+ return [...this._entries].reverse();
29
+ }
30
+ };
31
+ InlineChatServiceImpl = ( __decorate([
32
+ ( __param(0, IContextKeyService))
33
+ ], InlineChatServiceImpl));
34
+
35
+ export { InlineChatServiceImpl };