@codingame/monaco-vscode-chat-service-override 3.2.3 → 4.1.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 (32) hide show
  1. package/chat.js +16 -14
  2. package/package.json +2 -2
  3. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js +16 -0
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/external/vscode-marked/lib/marked.esm.js +0 -2200
  6. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +0 -17
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +0 -115
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +0 -501
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +0 -82
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +0 -77
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +0 -110
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +0 -171
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +0 -271
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +0 -299
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +0 -60
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.js +0 -179
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +0 -87
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +0 -271
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +0 -74
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +0 -174
  22. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatHistoryVariables.js +0 -26
  23. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +0 -580
  24. package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +0 -36
  25. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +0 -601
  26. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +0 -43
  27. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +0 -41
  28. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +0 -814
  29. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +0 -72
  30. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +0 -236
  31. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +0 -223
  32. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl.js +0 -33
@@ -1,82 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
4
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
5
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
6
- import { CONTEXT_RESPONSE_FILTERED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
7
- import { isRequestVM, isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
8
-
9
- function registerChatCopyActions() {
10
- registerAction2(class CopyAllAction extends Action2 {
11
- constructor() {
12
- super({
13
- id: 'workbench.action.chat.copyAll',
14
- title: ( localize2WithPath(
15
- 'vs/workbench/contrib/chat/browser/actions/chatCopyActions',
16
- 'interactive.copyAll.label',
17
- "Copy All"
18
- )),
19
- f1: false,
20
- category: CHAT_CATEGORY,
21
- menu: {
22
- id: MenuId.ChatContext,
23
- when: ( CONTEXT_RESPONSE_FILTERED.toNegated()),
24
- group: 'copy',
25
- }
26
- });
27
- }
28
- run(accessor, ...args) {
29
- const clipboardService = accessor.get(IClipboardService);
30
- const chatWidgetService = accessor.get(IChatWidgetService);
31
- const widget = chatWidgetService.lastFocusedWidget;
32
- if (widget) {
33
- const viewModel = widget.viewModel;
34
- const sessionAsText = viewModel?.getItems()
35
- .filter((item) => isRequestVM(item) || (isResponseVM(item) && !item.errorDetails?.responseIsFiltered))
36
- .map(item => stringifyItem(item))
37
- .join('\n\n');
38
- if (sessionAsText) {
39
- clipboardService.writeText(sessionAsText);
40
- }
41
- }
42
- }
43
- });
44
- registerAction2(class CopyItemAction extends Action2 {
45
- constructor() {
46
- super({
47
- id: 'workbench.action.chat.copyItem',
48
- title: ( localize2WithPath(
49
- 'vs/workbench/contrib/chat/browser/actions/chatCopyActions',
50
- 'interactive.copyItem.label',
51
- "Copy"
52
- )),
53
- f1: false,
54
- category: CHAT_CATEGORY,
55
- menu: {
56
- id: MenuId.ChatContext,
57
- when: ( CONTEXT_RESPONSE_FILTERED.toNegated()),
58
- group: 'copy',
59
- }
60
- });
61
- }
62
- run(accessor, ...args) {
63
- const item = args[0];
64
- if (!isRequestVM(item) && !isResponseVM(item)) {
65
- return;
66
- }
67
- const clipboardService = accessor.get(IClipboardService);
68
- const text = stringifyItem(item, false);
69
- clipboardService.writeText(text);
70
- }
71
- });
72
- }
73
- function stringifyItem(item, includeName = true) {
74
- if (isRequestVM(item)) {
75
- return (includeName ? `${item.username}: ` : '') + item.messageText;
76
- }
77
- else {
78
- return (includeName ? `${item.username}: ` : '') + item.response.asString();
79
- }
80
- }
81
-
82
- export { registerChatCopyActions };
@@ -1,77 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
4
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
5
- import { CONTEXT_IN_CHAT_SESSION, CONTEXT_PROVIDER_EXISTS } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
6
- import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
7
-
8
- function registerChatFileTreeActions() {
9
- registerAction2(class NextFileTreeAction extends Action2 {
10
- constructor() {
11
- super({
12
- id: 'workbench.action.chat.nextFileTree',
13
- title: ( localize2WithPath(
14
- 'vs/workbench/contrib/chat/browser/actions/chatFileTreeActions',
15
- 'interactive.nextFileTree.label',
16
- "Next File Tree"
17
- )),
18
- keybinding: {
19
- primary: 2048 | 67 ,
20
- weight: 200 ,
21
- when: CONTEXT_IN_CHAT_SESSION,
22
- },
23
- precondition: CONTEXT_PROVIDER_EXISTS,
24
- f1: true,
25
- category: CHAT_CATEGORY,
26
- });
27
- }
28
- run(accessor, ...args) {
29
- navigateTrees(accessor, false);
30
- }
31
- });
32
- registerAction2(class PreviousFileTreeAction extends Action2 {
33
- constructor() {
34
- super({
35
- id: 'workbench.action.chat.previousFileTree',
36
- title: ( localize2WithPath(
37
- 'vs/workbench/contrib/chat/browser/actions/chatFileTreeActions',
38
- 'interactive.previousFileTree.label',
39
- "Previous File Tree"
40
- )),
41
- keybinding: {
42
- primary: 2048 | 1024 | 67 ,
43
- weight: 200 ,
44
- when: CONTEXT_IN_CHAT_SESSION,
45
- },
46
- precondition: CONTEXT_PROVIDER_EXISTS,
47
- f1: true,
48
- category: CHAT_CATEGORY,
49
- });
50
- }
51
- run(accessor, ...args) {
52
- navigateTrees(accessor, true);
53
- }
54
- });
55
- }
56
- function navigateTrees(accessor, reverse) {
57
- const chatWidgetService = accessor.get(IChatWidgetService);
58
- const widget = chatWidgetService.lastFocusedWidget;
59
- if (!widget) {
60
- return;
61
- }
62
- const focused = !widget.inputEditor.hasWidgetFocus() && widget.getFocus();
63
- const focusedResponse = isResponseVM(focused) ? focused : undefined;
64
- const currentResponse = focusedResponse ?? widget.viewModel?.getItems().reverse().find((item) => isResponseVM(item));
65
- if (!currentResponse) {
66
- return;
67
- }
68
- widget.reveal(currentResponse);
69
- const responseFileTrees = widget.getFileTreeInfosForResponse(currentResponse);
70
- const lastFocusedFileTree = widget.getLastFocusedFileTreeForResponse(currentResponse);
71
- const focusIdx = lastFocusedFileTree ?
72
- (lastFocusedFileTree.treeIndex + (reverse ? -1 : 1) + responseFileTrees.length) % responseFileTrees.length :
73
- reverse ? responseFileTrees.length - 1 : 0;
74
- responseFileTrees[focusIdx]?.focus();
75
- }
76
-
77
- export { registerChatFileTreeActions };
@@ -1,110 +0,0 @@
1
- import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
2
- import { joinPath } from 'vscode/vscode/vs/base/common/resources';
3
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
5
- import '../../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
6
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
7
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
8
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
9
- import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
10
- import { CONTEXT_PROVIDER_EXISTS } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
11
- import { isExportableSessionData } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
12
- import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
13
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
14
- import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
15
-
16
- const defaultFileName = 'chat.json';
17
- const filters = [{ name: ( localizeWithPath(
18
- 'vs/workbench/contrib/chat/browser/actions/chatImportExport',
19
- 'chat.file.label',
20
- "Chat Session"
21
- )), extensions: ['json'] }];
22
- function registerChatExportActions() {
23
- registerAction2(class ExportChatAction extends Action2 {
24
- constructor() {
25
- super({
26
- id: 'workbench.action.chat.export',
27
- category: CHAT_CATEGORY,
28
- title: {
29
- value: ( localizeWithPath(
30
- 'vs/workbench/contrib/chat/browser/actions/chatImportExport',
31
- 'chat.export.label',
32
- "Export Session"
33
- )) + '...',
34
- original: 'Export Session...'
35
- },
36
- precondition: CONTEXT_PROVIDER_EXISTS,
37
- f1: true,
38
- });
39
- }
40
- async run(accessor, ...args) {
41
- const widgetService = accessor.get(IChatWidgetService);
42
- const fileDialogService = accessor.get(IFileDialogService);
43
- const fileService = accessor.get(IFileService);
44
- const chatService = accessor.get(IChatService);
45
- const widget = widgetService.lastFocusedWidget;
46
- if (!widget || !widget.viewModel) {
47
- return;
48
- }
49
- const defaultUri = joinPath(await fileDialogService.defaultFilePath(), defaultFileName);
50
- const result = await fileDialogService.showSaveDialog({
51
- defaultUri,
52
- filters
53
- });
54
- if (!result) {
55
- return;
56
- }
57
- const model = chatService.getSession(widget.viewModel.sessionId);
58
- if (!model) {
59
- return;
60
- }
61
- const content = VSBuffer.fromString(JSON.stringify(model.toExport(), undefined, 2));
62
- await fileService.writeFile(result, content);
63
- }
64
- });
65
- registerAction2(class ImportChatAction extends Action2 {
66
- constructor() {
67
- super({
68
- id: 'workbench.action.chat.import',
69
- title: {
70
- value: ( localizeWithPath(
71
- 'vs/workbench/contrib/chat/browser/actions/chatImportExport',
72
- 'chat.import.label',
73
- "Import Session"
74
- )) + '...',
75
- original: 'Import Session...'
76
- },
77
- category: CHAT_CATEGORY,
78
- precondition: CONTEXT_PROVIDER_EXISTS,
79
- f1: true,
80
- });
81
- }
82
- async run(accessor, ...args) {
83
- const fileDialogService = accessor.get(IFileDialogService);
84
- const fileService = accessor.get(IFileService);
85
- const editorService = accessor.get(IEditorService);
86
- const defaultUri = joinPath(await fileDialogService.defaultFilePath(), defaultFileName);
87
- const result = await fileDialogService.showOpenDialog({
88
- defaultUri,
89
- canSelectFiles: true,
90
- filters
91
- });
92
- if (!result) {
93
- return;
94
- }
95
- const content = await fileService.readFile(result[0]);
96
- try {
97
- const data = JSON.parse(( content.value.toString()));
98
- if (!isExportableSessionData(data)) {
99
- throw new Error('Invalid chat session data');
100
- }
101
- await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { data }, pinned: true } });
102
- }
103
- catch (err) {
104
- throw err;
105
- }
106
- }
107
- });
108
- }
109
-
110
- export { registerChatExportActions };
@@ -1,171 +0,0 @@
1
- import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
4
- import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
5
- import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
6
- import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
7
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
8
- import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
9
- import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
10
- import { CONTEXT_PROVIDER_EXISTS } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
11
- import { IChatContributionService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContributionService';
12
- import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService';
13
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
14
- import { IEditorService, AUX_WINDOW_GROUP, ACTIVE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
15
-
16
- var MoveToNewLocation;
17
- ( (function(MoveToNewLocation) {
18
- MoveToNewLocation["Editor"] = "Editor";
19
- MoveToNewLocation["Window"] = "Window";
20
- })(MoveToNewLocation || (MoveToNewLocation = {})));
21
- const getMoveToChatActionDescriptorForViewTitle = (viewId, providerId, moveTo) => ({
22
- id: `workbench.action.chat.${providerId}.openIn${moveTo}`,
23
- title: {
24
- value: moveTo === MoveToNewLocation.Editor ? ( localizeWithPath(
25
- 'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
26
- 'chat.openInEditor.label',
27
- "Open Chat in Editor"
28
- )) : ( localizeWithPath(
29
- 'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
30
- 'chat.openInNewWindow.label',
31
- "Open Chat in New Window"
32
- )),
33
- original: moveTo === MoveToNewLocation.Editor ? 'Open Chat in Editor' : 'Open Chat in New Window',
34
- },
35
- category: CHAT_CATEGORY,
36
- precondition: CONTEXT_PROVIDER_EXISTS,
37
- f1: false,
38
- viewId,
39
- menu: {
40
- id: MenuId.ViewTitle,
41
- when: ( ContextKeyExpr.equals('view', viewId)),
42
- order: 0
43
- },
44
- });
45
- function getMoveToEditorAction(viewId, providerId) {
46
- return getMoveToAction(viewId, providerId, MoveToNewLocation.Editor);
47
- }
48
- function getMoveToNewWindowAction(viewId, providerId) {
49
- return getMoveToAction(viewId, providerId, MoveToNewLocation.Window);
50
- }
51
- function getMoveToAction(viewId, providerId, moveTo) {
52
- return class MoveToAction extends ViewAction {
53
- constructor() {
54
- super(getMoveToChatActionDescriptorForViewTitle(viewId, providerId, moveTo));
55
- }
56
- async runInView(accessor, view) {
57
- const viewModel = view.widget.viewModel;
58
- if (!viewModel) {
59
- return;
60
- }
61
- const editorService = accessor.get(IEditorService);
62
- const sessionId = viewModel.sessionId;
63
- const viewState = view.widget.getViewState();
64
- view.clear();
65
- await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId }, pinned: true, viewState: viewState } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
66
- }
67
- };
68
- }
69
- function registerMoveActions() {
70
- registerAction2(class GlobalMoveToEditorAction extends Action2 {
71
- constructor() {
72
- super({
73
- id: `workbench.action.chat.openInEditor`,
74
- title: ( localize2WithPath(
75
- 'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
76
- 'interactiveSession.openInEditor.label',
77
- "Open Chat in Editor"
78
- )),
79
- category: CHAT_CATEGORY,
80
- precondition: CONTEXT_PROVIDER_EXISTS,
81
- f1: true
82
- });
83
- }
84
- async run(accessor, ...args) {
85
- executeMoveToAction(accessor, MoveToNewLocation.Editor);
86
- }
87
- });
88
- registerAction2(class GlobalMoveToNewWindowAction extends Action2 {
89
- constructor() {
90
- super({
91
- id: `workbench.action.chat.openInNewWindow`,
92
- title: ( localize2WithPath(
93
- 'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
94
- 'interactiveSession.openInNewWindow.label',
95
- "Open Chat in New Window"
96
- )),
97
- category: CHAT_CATEGORY,
98
- precondition: CONTEXT_PROVIDER_EXISTS,
99
- f1: true
100
- });
101
- }
102
- async run(accessor, ...args) {
103
- executeMoveToAction(accessor, MoveToNewLocation.Window);
104
- }
105
- });
106
- registerAction2(class GlobalMoveToSidebarAction extends Action2 {
107
- constructor() {
108
- super({
109
- id: `workbench.action.chat.openInSidebar`,
110
- title: ( localize2WithPath(
111
- 'vs/workbench/contrib/chat/browser/actions/chatMoveActions',
112
- 'interactiveSession.openInSidebar.label',
113
- "Open Chat in Side Bar"
114
- )),
115
- category: CHAT_CATEGORY,
116
- precondition: CONTEXT_PROVIDER_EXISTS,
117
- f1: true,
118
- menu: [{
119
- id: MenuId.EditorTitle,
120
- order: 0,
121
- when: ( ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID)),
122
- }]
123
- });
124
- }
125
- async run(accessor, ...args) {
126
- return moveToSidebar(accessor);
127
- }
128
- });
129
- }
130
- async function executeMoveToAction(accessor, moveTo) {
131
- const widgetService = accessor.get(IChatWidgetService);
132
- const viewService = accessor.get(IViewsService);
133
- const chatService = accessor.get(IChatService);
134
- const editorService = accessor.get(IEditorService);
135
- const widget = widgetService.lastFocusedWidget;
136
- if (!widget || !('viewId' in widget.viewContext)) {
137
- const providerId = chatService.getProviderInfos()[0].id;
138
- await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { providerId }, pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
139
- return;
140
- }
141
- const viewModel = widget.viewModel;
142
- if (!viewModel) {
143
- return;
144
- }
145
- const sessionId = viewModel.sessionId;
146
- const view = await viewService.openView(widget.viewContext.viewId);
147
- const viewState = view.widget.getViewState();
148
- view.clear();
149
- await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId }, pinned: true, viewState: viewState } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
150
- }
151
- async function moveToSidebar(accessor) {
152
- const viewsService = accessor.get(IViewsService);
153
- const editorService = accessor.get(IEditorService);
154
- const chatContribService = accessor.get(IChatContributionService);
155
- const editorGroupService = accessor.get(IEditorGroupsService);
156
- const chatEditorInput = editorService.activeEditor;
157
- if (chatEditorInput instanceof ChatEditorInput && chatEditorInput.sessionId && chatEditorInput.providerId) {
158
- await editorService.closeEditor({ editor: chatEditorInput, groupId: editorGroupService.activeGroup.id });
159
- const viewId = chatContribService.getViewIdForProvider(chatEditorInput.providerId);
160
- const view = await viewsService.openView(viewId);
161
- view.loadSession(chatEditorInput.sessionId);
162
- }
163
- else {
164
- const chatService = accessor.get(IChatService);
165
- const providerId = chatService.getProviderInfos()[0].id;
166
- const viewId = chatContribService.getViewIdForProvider(providerId);
167
- await viewsService.openView(viewId);
168
- }
169
- }
170
-
171
- export { getMoveToAction, getMoveToEditorAction, getMoveToNewWindowAction, registerMoveActions };