@codingame/monaco-vscode-chat-service-override 10.1.3 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/chat.js +6 -3
  2. package/package.json +6 -2
  3. package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +8 -0
  4. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +84 -38
  5. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +265 -20
  6. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +20 -39
  7. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +373 -216
  8. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -5
  9. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +1 -1
  10. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -5
  11. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +54 -0
  12. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -7
  13. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +12 -11
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +14 -42
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +82 -50
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +326 -0
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +448 -0
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +507 -0
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +76 -0
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -4
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +109 -0
  22. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +284 -0
  23. package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipantContributions.js +116 -77
  24. package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +100 -9
  25. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +3 -3
  26. package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +1 -1
  27. package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +7 -9
  28. package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +61 -42
  29. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +5 -5
  30. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +3 -3
  31. package/vscode/src/vs/workbench/contrib/chat/{common → browser}/languageModelToolsService.js +28 -31
  32. package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeContributions.js +75 -0
  33. package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +120 -1
  34. package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +10 -8
  35. package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +33 -18
  36. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +21 -0
  38. package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +2 -2
  39. package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +6 -6
  40. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +68 -47
  41. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +250 -0
  42. package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +2 -2
  43. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -8
  44. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +3 -3
  47. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -2
  48. package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +65 -128
  49. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +0 -170
  50. package/vscode/src/vs/workbench/contrib/chat/browser/chatGettingStarted.js +0 -131
@@ -1,18 +1,17 @@
1
1
  import { localize2 } from 'vscode/vscode/vs/nls';
2
2
  import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
3
  import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
4
- import { stringifyItem } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
4
+ import { CHAT_CATEGORY, stringifyItem } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
5
5
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
6
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
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
7
+ import { isRequestVM, isResponseVM } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatViewModel';
9
8
 
10
9
  function registerChatCopyActions() {
11
10
  registerAction2(class CopyAllAction extends Action2 {
12
11
  constructor() {
13
12
  super({
14
13
  id: 'workbench.action.chat.copyAll',
15
- title: ( localize2(7321, "Copy All")),
14
+ title: ( localize2(7547, "Copy All")),
16
15
  f1: false,
17
16
  category: CHAT_CATEGORY,
18
17
  menu: {
@@ -42,7 +41,7 @@ function registerChatCopyActions() {
42
41
  constructor() {
43
42
  super({
44
43
  id: 'workbench.action.chat.copyItem',
45
- title: ( localize2(7322, "Copy")),
44
+ title: ( localize2(7548, "Copy")),
46
45
  f1: false,
47
46
  category: CHAT_CATEGORY,
48
47
  menu: {
@@ -12,7 +12,7 @@ class LogChatInputHistoryAction extends Action2 {
12
12
  constructor() {
13
13
  super({
14
14
  id: LogChatInputHistoryAction.ID,
15
- title: ( localize2(7323, "Log Chat Input History")),
15
+ title: ( localize2(7549, "Log Chat Input History")),
16
16
  icon: Codicon.attach,
17
17
  category: Categories.Developer,
18
18
  f1: true
@@ -1,17 +1,16 @@
1
1
  import { localize2 } from 'vscode/vscode/vs/nls';
2
2
  import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
3
+ import { CHAT_CATEGORY } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
4
4
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
5
5
  import { CONTEXT_IN_CHAT_SESSION, CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
6
- import { isResponseVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
7
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
6
+ import { isResponseVM } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatViewModel';
8
7
 
9
8
  function registerChatFileTreeActions() {
10
9
  registerAction2(class NextFileTreeAction extends Action2 {
11
10
  constructor() {
12
11
  super({
13
12
  id: 'workbench.action.chat.nextFileTree',
14
- title: ( localize2(7329, "Next File Tree")),
13
+ title: ( localize2(7561, "Next File Tree")),
15
14
  keybinding: {
16
15
  primary: 2048 | 67 ,
17
16
  weight: 200 ,
@@ -30,7 +29,7 @@ function registerChatFileTreeActions() {
30
29
  constructor() {
31
30
  super({
32
31
  id: 'workbench.action.chat.previousFileTree',
33
- title: ( localize2(7330, "Previous File Tree")),
32
+ title: ( localize2(7562, "Previous File Tree")),
34
33
  keybinding: {
35
34
  primary: 2048 | 1024 | 67 ,
36
35
  weight: 200 ,
@@ -0,0 +1,54 @@
1
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
4
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
5
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
6
+ import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
7
+ import { CHAT_OPEN_ACTION_ID } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
8
+ import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
9
+
10
+ let ChatGettingStartedContribution = class ChatGettingStartedContribution extends Disposable {
11
+ static { this.ID = 'workbench.contrib.chatGettingStarted'; }
12
+ constructor(productService, extensionService, commandService, extensionManagementService) {
13
+ super();
14
+ this.productService = productService;
15
+ this.extensionService = extensionService;
16
+ this.commandService = commandService;
17
+ this.extensionManagementService = extensionManagementService;
18
+ this.recentlyInstalled = false;
19
+ if (!this.productService.gitHubEntitlement) {
20
+ return;
21
+ }
22
+ this.registerListeners();
23
+ }
24
+ registerListeners() {
25
+ this._register(this.extensionManagementService.onDidInstallExtensions(async (result) => {
26
+ for (const e of result) {
27
+ if (ExtensionIdentifier.equals(this.productService.gitHubEntitlement.extensionId, e.identifier.id) && e.operation === 2 ) {
28
+ this.recentlyInstalled = true;
29
+ return;
30
+ }
31
+ }
32
+ }));
33
+ this._register(this.extensionService.onDidChangeExtensionsStatus(async (event) => {
34
+ for (const ext of event) {
35
+ if (ExtensionIdentifier.equals(this.productService.gitHubEntitlement.extensionId, ext.value)) {
36
+ const extensionStatus = this.extensionService.getExtensionsStatus();
37
+ if (extensionStatus[ext.value].activationTimes && this.recentlyInstalled) {
38
+ await this.commandService.executeCommand(CHAT_OPEN_ACTION_ID);
39
+ this.recentlyInstalled = false;
40
+ return;
41
+ }
42
+ }
43
+ }
44
+ }));
45
+ }
46
+ };
47
+ ChatGettingStartedContribution = ( __decorate([
48
+ ( __param(0, IProductService)),
49
+ ( __param(1, IExtensionService)),
50
+ ( __param(2, ICommandService)),
51
+ ( __param(3, IExtensionManagementService))
52
+ ], ChatGettingStartedContribution));
53
+
54
+ export { ChatGettingStartedContribution };
@@ -4,24 +4,23 @@ import { localize, localize2 } from 'vscode/vscode/vs/nls';
4
4
  import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
5
5
  import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
6
6
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
7
- import 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
7
+ import { CHAT_CATEGORY } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
8
8
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
9
- import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
9
+ import { ChatEditorInput } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
10
10
  import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
11
- import { isExportableSessionData } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatModel';
11
+ import { isExportableSessionData } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatModel';
12
12
  import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
13
13
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
14
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
15
14
 
16
15
  const defaultFileName = 'chat.json';
17
- const filters = [{ name: ( localize(7331, "Chat Session")), extensions: ['json'] }];
16
+ const filters = [{ name: ( localize(7563, "Chat Session")), extensions: ['json'] }];
18
17
  function registerChatExportActions() {
19
18
  registerAction2(class ExportChatAction extends Action2 {
20
19
  constructor() {
21
20
  super({
22
21
  id: 'workbench.action.chat.export',
23
22
  category: CHAT_CATEGORY,
24
- title: ( localize2(7332, "Export Chat...")),
23
+ title: ( localize2(7564, "Export Chat...")),
25
24
  precondition: CONTEXT_CHAT_ENABLED,
26
25
  f1: true,
27
26
  });
@@ -55,7 +54,7 @@ function registerChatExportActions() {
55
54
  constructor() {
56
55
  super({
57
56
  id: 'workbench.action.chat.import',
58
- title: ( localize2(7333, "Import Chat...")),
57
+ title: ( localize2(7565, "Import Chat...")),
59
58
  category: CHAT_CATEGORY,
60
59
  precondition: CONTEXT_CHAT_ENABLED,
61
60
  f1: true,
@@ -2,17 +2,17 @@ import { localize2 } from 'vscode/vscode/vs/nls';
2
2
  import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
3
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
4
4
  import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
5
- import { isChatViewTitleActionContext } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
6
- import { CHAT_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
5
+ import { CHAT_CATEGORY } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
6
+ import { CHAT_VIEW_ID } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chat';
7
7
  import { IChatWidgetService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
8
8
  import { ChatEditor } from '../chatEditor.js';
9
- import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
9
+ import { ChatEditorInput } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
10
10
  import { CONTEXT_CHAT_ENABLED } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
11
11
  import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
12
12
  import { AUX_WINDOW_GROUP, ACTIVE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
13
13
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
14
14
  import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
15
- import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
15
+ import { isChatViewTitleActionContext } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatActions';
16
16
 
17
17
  var MoveToNewLocation;
18
18
  ( ((function(MoveToNewLocation) {
@@ -24,7 +24,7 @@ function registerMoveActions() {
24
24
  constructor() {
25
25
  super({
26
26
  id: `workbench.action.chat.openInEditor`,
27
- title: ( localize2(7334, "Open Chat in Editor")),
27
+ title: ( localize2(7566, "Open Chat in Editor")),
28
28
  category: CHAT_CATEGORY,
29
29
  precondition: CONTEXT_CHAT_ENABLED,
30
30
  f1: true,
@@ -37,14 +37,14 @@ function registerMoveActions() {
37
37
  }
38
38
  async run(accessor, ...args) {
39
39
  const context = args[0];
40
- executeMoveToAction(accessor, MoveToNewLocation.Editor, isChatViewTitleActionContext(context) ? context.chatView : undefined);
40
+ executeMoveToAction(accessor, MoveToNewLocation.Editor, isChatViewTitleActionContext(context) ? context.sessionId : undefined);
41
41
  }
42
42
  });
43
43
  registerAction2(class GlobalMoveToNewWindowAction extends Action2 {
44
44
  constructor() {
45
45
  super({
46
46
  id: `workbench.action.chat.openInNewWindow`,
47
- title: ( localize2(7335, "Open Chat in New Window")),
47
+ title: ( localize2(7567, "Open Chat in New Window")),
48
48
  category: CHAT_CATEGORY,
49
49
  precondition: CONTEXT_CHAT_ENABLED,
50
50
  f1: true,
@@ -57,14 +57,14 @@ function registerMoveActions() {
57
57
  }
58
58
  async run(accessor, ...args) {
59
59
  const context = args[0];
60
- executeMoveToAction(accessor, MoveToNewLocation.Window, isChatViewTitleActionContext(context) ? context.chatView : undefined);
60
+ executeMoveToAction(accessor, MoveToNewLocation.Window, isChatViewTitleActionContext(context) ? context.sessionId : undefined);
61
61
  }
62
62
  });
63
63
  registerAction2(class GlobalMoveToSidebarAction extends Action2 {
64
64
  constructor() {
65
65
  super({
66
66
  id: `workbench.action.chat.openInSidebar`,
67
- title: ( localize2(7336, "Open Chat in Side Bar")),
67
+ title: ( localize2(7568, "Open Chat in Side Bar")),
68
68
  category: CHAT_CATEGORY,
69
69
  precondition: CONTEXT_CHAT_ENABLED,
70
70
  f1: true,
@@ -80,10 +80,11 @@ function registerMoveActions() {
80
80
  }
81
81
  });
82
82
  }
83
- async function executeMoveToAction(accessor, moveTo, chatView) {
83
+ async function executeMoveToAction(accessor, moveTo, _sessionId) {
84
84
  const widgetService = accessor.get(IChatWidgetService);
85
85
  const editorService = accessor.get(IEditorService);
86
- const widget = chatView?.widget ?? widgetService.lastFocusedWidget;
86
+ const widget = (_sessionId ? widgetService.getWidgetBySessionId(_sessionId) : undefined)
87
+ ?? widgetService.lastFocusedWidget;
87
88
  if (!widget || !('viewId' in widget.viewContext)) {
88
89
  await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP);
89
90
  return;
@@ -4,15 +4,12 @@ import { AsyncIterableObject } from 'vscode/vscode/vs/base/common/async';
4
4
  import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
5
5
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
6
6
  import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
7
- import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
8
7
  import { isEqual } from 'vscode/vscode/vs/base/common/resources';
9
8
  import { splitLines } from 'vscode/vscode/vs/base/common/strings';
10
- import { URI } from 'vscode/vscode/vs/base/common/uri';
11
9
  import { isDiffEditor, isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
12
10
  import { ResourceTextEdit, IBulkEditService } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
13
11
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
14
12
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
15
- import { isLocation } from 'vscode/vscode/vs/editor/common/languages';
16
13
  import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
17
14
  import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
18
15
  import { localize } from 'vscode/vscode/vs/nls';
@@ -23,10 +20,11 @@ import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/prog
23
20
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
24
21
  import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
25
22
  import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
26
- import { insertCell } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
23
+ import { insertCell } from '@codingame/monaco-vscode-chat-interactive-notebook-search-common/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
27
24
  import { CellKind, NOTEBOOK_EDITOR_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
25
+ import { getReferencesAsDocumentContext } from '../../common/chatCodeMapperService.js';
28
26
  import { IChatService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatService.service';
29
- import { isResponseVM, isRequestVM } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatViewModel';
27
+ import { isResponseVM, isRequestVM } from '@codingame/monaco-vscode-chat-extensions-interactive-notebook-quickaccess-search-terminal-common/vscode/vs/workbench/contrib/chat/common/chatViewModel';
30
28
 
31
29
  let InsertCodeBlockOperation = class InsertCodeBlockOperation {
32
30
  constructor(editorService, textFileService, bulkEditService, codeEditorService, chatService, languageService, dialogService) {
@@ -50,7 +48,7 @@ let InsertCodeBlockOperation = class InsertCodeBlockOperation {
50
48
  }
51
49
  else {
52
50
  this.notify(( localize(
53
- 10733,
51
+ 10852,
54
52
  "To insert the code block, open a code editor or notebook editor and set the cursor at the location where to insert the code block."
55
53
  )));
56
54
  }
@@ -63,7 +61,7 @@ let InsertCodeBlockOperation = class InsertCodeBlockOperation {
63
61
  }
64
62
  async handleNotebookEditor(notebookEditor, codeBlockContext) {
65
63
  if (notebookEditor.isReadOnly) {
66
- this.notify(( localize(10734, "Cannot insert the code block to read-only notebook editor.")));
64
+ this.notify(( localize(10853, "Cannot insert the code block to read-only notebook editor.")));
67
65
  return false;
68
66
  }
69
67
  const focusRange = notebookEditor.getFocus();
@@ -74,7 +72,7 @@ let InsertCodeBlockOperation = class InsertCodeBlockOperation {
74
72
  async handleTextEditor(codeEditor, codeBlockContext) {
75
73
  const activeModel = codeEditor.getModel();
76
74
  if (isReadOnly(activeModel, this.textFileService)) {
77
- this.notify(( localize(10735, "Cannot insert the code block to read-only code editor.")));
75
+ this.notify(( localize(10854, "Cannot insert the code block to read-only code editor.")));
78
76
  return false;
79
77
  }
80
78
  const range = codeEditor.getSelection() ?? ( (new Range(activeModel.getLineCount(), 1, activeModel.getLineCount(), 1)));
@@ -114,7 +112,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
114
112
  async run(context) {
115
113
  if (this.inlineChatPreview && this.inlineChatPreview.isOpen()) {
116
114
  await this.dialogService.info(( localize(
117
- 10736,
115
+ 10855,
118
116
  "Another code change is being previewed. Please apply or discard the pending changes first."
119
117
  )));
120
118
  return;
@@ -145,7 +143,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
145
143
  result = await this.handleNotebookEditor(activeNotebookEditor, context);
146
144
  }
147
145
  else {
148
- this.notify(( localize(10737, "To apply this code block, open a code or notebook editor.")));
146
+ this.notify(( localize(10856, "To apply this code block, open a code or notebook editor.")));
149
147
  }
150
148
  }
151
149
  notifyUserAction(this.chatService, context, {
@@ -158,7 +156,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
158
156
  }
159
157
  async handleNotebookEditor(notebookEditor, codeBlockContext) {
160
158
  if (notebookEditor.isReadOnly) {
161
- this.notify(( localize(10738, "Cannot apply code block to read-only notebook editor.")));
159
+ this.notify(( localize(10857, "Cannot apply code block to read-only notebook editor.")));
162
160
  return undefined;
163
161
  }
164
162
  const focusRange = notebookEditor.getFocus();
@@ -168,7 +166,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
168
166
  }
169
167
  async handleTextEditor(codeEditor, codeBlockContext) {
170
168
  if (isReadOnly(codeEditor.getModel(), this.textFileService)) {
171
- this.notify(( localize(10739, "Cannot apply code block to read-only file.")));
169
+ this.notify(( localize(10858, "Cannot apply code block to read-only file.")));
172
170
  return undefined;
173
171
  }
174
172
  const result = await this.computeEdits(codeEditor, codeBlockContext);
@@ -195,7 +193,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
195
193
  const result = await this.progressService.withProgress({ location: 15 , delay: 500, sticky: true, cancellable: true }, async (progress) => {
196
194
  for (const provider of mappedEditsProviders) {
197
195
  codeMapper = provider.displayName;
198
- progress.report({ message: ( localize(10740, "Applying code block using {0}...", codeMapper)) });
196
+ progress.report({ message: ( localize(10859, "Applying code block using {0}...", codeMapper)) });
199
197
  const mappedEdits = await provider.provideMappedEdits(activeModel, [codeBlockActionContext.code], {
200
198
  documents: docRefs,
201
199
  conversation: getChatConversation(codeBlockActionContext),
@@ -212,7 +210,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
212
210
  }
213
211
  catch (e) {
214
212
  if (!isCancellationError(e)) {
215
- this.notify(( localize(10741, "Failed to apply code block: {0}", e.message)));
213
+ this.notify(( localize(10860, "Failed to apply code block: {0}", e.message)));
216
214
  }
217
215
  }
218
216
  finally {
@@ -242,7 +240,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
242
240
  let isOpen = true;
243
241
  const firstEdit = textEdits[0];
244
242
  editorToApply.revealLineInCenterIfOutsideViewport(firstEdit.range.startLineNumber);
245
- const promise = inlineChatController.reviewEdits(textEdits[0].range, AsyncIterableObject.fromArray(textEdits), tokenSource.token);
243
+ const promise = inlineChatController.reviewEdits(textEdits[0].range, AsyncIterableObject.fromArray([textEdits]), tokenSource.token);
246
244
  promise.finally(() => {
247
245
  isOpen = false;
248
246
  tokenSource.dispose();
@@ -350,7 +348,7 @@ function getChatConversation(context) {
350
348
  if (isResponseVM(context.element)) {
351
349
  return [{
352
350
  type: 'response',
353
- message: context.element.response.toMarkdown(),
351
+ message: context.element.response.getMarkdown(),
354
352
  references: getReferencesAsDocumentContext(context.element.contentReferences)
355
353
  }];
356
354
  }
@@ -364,32 +362,6 @@ function getChatConversation(context) {
364
362
  return [];
365
363
  }
366
364
  }
367
- function getReferencesAsDocumentContext(res) {
368
- const map = ( (new ResourceMap()));
369
- for (const r of res) {
370
- let uri;
371
- let range;
372
- if (URI.isUri(r.reference)) {
373
- uri = r.reference;
374
- }
375
- else if (isLocation(r.reference)) {
376
- uri = r.reference.uri;
377
- range = r.reference.range;
378
- }
379
- if (uri) {
380
- const item = map.get(uri);
381
- if (item) {
382
- if (range) {
383
- item.ranges.push(range);
384
- }
385
- }
386
- else {
387
- map.set(uri, { uri, version: -1, ranges: range ? [range] : [] });
388
- }
389
- }
390
- }
391
- return [...( (map.values()))];
392
- }
393
365
  function reindent(codeBlockContent, model, seletionStartLine) {
394
366
  const newContent = splitLines(codeBlockContent);
395
367
  if (newContent.length === 0) {