@codingame/monaco-vscode-chat-service-override 4.5.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chat.js +6 -6
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +36 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +78 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +5 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +6 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +10 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +39 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.js +102 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +57 -70
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +3 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatContributionServiceImpl.js → chatParticipantContributions.js} +63 -202
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +35 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +49 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +71 -74
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +142 -185
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +131 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +11 -2
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChat.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +1 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -34
|
@@ -17,7 +17,7 @@ let ChatSlashCommandService = class ChatSlashCommandService extends Disposable {
|
|
|
17
17
|
}
|
|
18
18
|
registerSlashCommand(data, command) {
|
|
19
19
|
if (( this._commands.has(data.command))) {
|
|
20
|
-
throw new Error(`Already registered a command with id ${data.command}}`);
|
|
20
|
+
throw ( new Error(`Already registered a command with id ${data.command}}`));
|
|
21
21
|
}
|
|
22
22
|
this._commands.set(data.command, { data, command });
|
|
23
23
|
this._onDidChangeCommands.fire();
|
|
@@ -36,13 +36,13 @@ let ChatSlashCommandService = class ChatSlashCommandService extends Disposable {
|
|
|
36
36
|
async executeCommand(id, prompt, progress, history, token) {
|
|
37
37
|
const data = this._commands.get(id);
|
|
38
38
|
if (!data) {
|
|
39
|
-
throw new Error('No command with id ${id} NOT registered');
|
|
39
|
+
throw ( new Error('No command with id ${id} NOT registered'));
|
|
40
40
|
}
|
|
41
41
|
if (!data.command) {
|
|
42
42
|
await this._extensionService.activateByEvent(`onSlash:${id}`);
|
|
43
43
|
}
|
|
44
44
|
if (!data.command) {
|
|
45
|
-
throw new Error(`No command with id ${id} NOT resolved`);
|
|
45
|
+
throw ( new Error(`No command with id ${id} NOT resolved`));
|
|
46
46
|
}
|
|
47
47
|
return await data.command(prompt, progress, history, token);
|
|
48
48
|
}
|
|
@@ -2,6 +2,7 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
3
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
4
4
|
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
5
|
+
import { CHAT_PROVIDER_ID } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatParticipantContribTypes';
|
|
5
6
|
|
|
6
7
|
let ChatWidgetHistoryService = class ChatWidgetHistoryService {
|
|
7
8
|
constructor(storageService) {
|
|
@@ -14,14 +15,14 @@ let ChatWidgetHistoryService = class ChatWidgetHistoryService {
|
|
|
14
15
|
}
|
|
15
16
|
this.viewState = loadedState;
|
|
16
17
|
}
|
|
17
|
-
getHistory(
|
|
18
|
-
return this.viewState.history?.[
|
|
18
|
+
getHistory() {
|
|
19
|
+
return this.viewState.history?.[CHAT_PROVIDER_ID] ?? [];
|
|
19
20
|
}
|
|
20
|
-
saveHistory(
|
|
21
|
+
saveHistory(history) {
|
|
21
22
|
if (!this.viewState.history) {
|
|
22
23
|
this.viewState.history = {};
|
|
23
24
|
}
|
|
24
|
-
this.viewState.history[
|
|
25
|
+
this.viewState.history[CHAT_PROVIDER_ID] = history;
|
|
25
26
|
this.memento.saveMemento();
|
|
26
27
|
}
|
|
27
28
|
clearHistory() {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
5
|
+
import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
6
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
|
|
7
|
+
import { IExtensionFeaturesManagementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures.service';
|
|
8
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
9
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
10
|
+
|
|
11
|
+
var LanguageModelStatsService_1;
|
|
12
|
+
const _moduleId = "vs/workbench/contrib/chat/common/languageModelStats";
|
|
13
|
+
let LanguageModelStatsService = class LanguageModelStatsService extends Disposable {
|
|
14
|
+
static { LanguageModelStatsService_1 = this; }
|
|
15
|
+
static { this.MODEL_STATS_STORAGE_KEY_PREFIX = 'languageModelStats.'; }
|
|
16
|
+
static { this.MODEL_ACCESS_STORAGE_KEY_PREFIX = 'languageModelAccess.'; }
|
|
17
|
+
constructor(extensionFeaturesManagementService, _storageService) {
|
|
18
|
+
super();
|
|
19
|
+
this.extensionFeaturesManagementService = extensionFeaturesManagementService;
|
|
20
|
+
this._storageService = _storageService;
|
|
21
|
+
this._onDidChangeStats = this._register(( (new Emitter())));
|
|
22
|
+
this.onDidChangeLanguageMoelStats = this._onDidChangeStats.event;
|
|
23
|
+
this.sessionStats = ( (new Map()));
|
|
24
|
+
this._register(_storageService.onDidChangeValue(-1 , undefined, this._store)(e => {
|
|
25
|
+
const model = this.getModel(e.key);
|
|
26
|
+
if (model) {
|
|
27
|
+
this._onDidChangeStats.fire(model);
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
hasAccessedModel(extensionId, model) {
|
|
32
|
+
return this.getAccessExtensions(model).includes(extensionId.toLowerCase());
|
|
33
|
+
}
|
|
34
|
+
async update(model, extensionId, agent, tokenCount) {
|
|
35
|
+
await this.extensionFeaturesManagementService.getAccess(extensionId, 'languageModels');
|
|
36
|
+
this.addAccess(model, extensionId.value);
|
|
37
|
+
let sessionStats = this.sessionStats.get(model);
|
|
38
|
+
if (!sessionStats) {
|
|
39
|
+
sessionStats = { extensions: [] };
|
|
40
|
+
this.sessionStats.set(model, sessionStats);
|
|
41
|
+
}
|
|
42
|
+
this.add(sessionStats, extensionId.value, agent, tokenCount);
|
|
43
|
+
this.write(model, extensionId.value, agent, tokenCount);
|
|
44
|
+
this._onDidChangeStats.fire(model);
|
|
45
|
+
}
|
|
46
|
+
addAccess(model, extensionId) {
|
|
47
|
+
extensionId = extensionId.toLowerCase();
|
|
48
|
+
const extensions = this.getAccessExtensions(model);
|
|
49
|
+
if (!extensions.includes(extensionId)) {
|
|
50
|
+
extensions.push(extensionId);
|
|
51
|
+
this._storageService.store(this.getAccessKey(model), JSON.stringify(extensions), -1 , 0 );
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
getAccessExtensions(model) {
|
|
55
|
+
const key = this.getAccessKey(model);
|
|
56
|
+
const data = this._storageService.get(key, -1 );
|
|
57
|
+
try {
|
|
58
|
+
if (data) {
|
|
59
|
+
const parsed = JSON.parse(data);
|
|
60
|
+
if (Array.isArray(parsed)) {
|
|
61
|
+
return parsed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
async write(model, extensionId, participant, tokenCount) {
|
|
70
|
+
const modelStats = await this.read(model);
|
|
71
|
+
this.add(modelStats, extensionId, participant, tokenCount);
|
|
72
|
+
this._storageService.store(this.getKey(model), JSON.stringify(modelStats), -1 , 0 );
|
|
73
|
+
}
|
|
74
|
+
add(modelStats, extensionId, participant, tokenCount) {
|
|
75
|
+
let extensionStats = modelStats.extensions.find(e => ExtensionIdentifier.equals(e.extensionId, extensionId));
|
|
76
|
+
if (!extensionStats) {
|
|
77
|
+
extensionStats = { extensionId, requestCount: 0, tokenCount: 0, participants: [] };
|
|
78
|
+
modelStats.extensions.push(extensionStats);
|
|
79
|
+
}
|
|
80
|
+
if (participant) {
|
|
81
|
+
let participantStats = extensionStats.participants.find(p => p.id === participant);
|
|
82
|
+
if (!participantStats) {
|
|
83
|
+
participantStats = { id: participant, requestCount: 0, tokenCount: 0 };
|
|
84
|
+
extensionStats.participants.push(participantStats);
|
|
85
|
+
}
|
|
86
|
+
participantStats.requestCount++;
|
|
87
|
+
participantStats.tokenCount += tokenCount ?? 0;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
extensionStats.requestCount++;
|
|
91
|
+
extensionStats.tokenCount += tokenCount ?? 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async read(model) {
|
|
95
|
+
try {
|
|
96
|
+
const value = this._storageService.get(this.getKey(model), -1 );
|
|
97
|
+
if (value) {
|
|
98
|
+
return JSON.parse(value);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
}
|
|
103
|
+
return { extensions: [] };
|
|
104
|
+
}
|
|
105
|
+
getModel(key) {
|
|
106
|
+
if (key.startsWith(LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX)) {
|
|
107
|
+
return key.substring(LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX.length);
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
getKey(model) {
|
|
112
|
+
return `${LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX}${model}`;
|
|
113
|
+
}
|
|
114
|
+
getAccessKey(model) {
|
|
115
|
+
return `${LanguageModelStatsService_1.MODEL_ACCESS_STORAGE_KEY_PREFIX}${model}`;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
LanguageModelStatsService = LanguageModelStatsService_1 = ( (__decorate([
|
|
119
|
+
( (__param(0, IExtensionFeaturesManagementService))),
|
|
120
|
+
( (__param(1, IStorageService)))
|
|
121
|
+
], LanguageModelStatsService)));
|
|
122
|
+
( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
|
|
123
|
+
id: 'languageModels',
|
|
124
|
+
label: ( localizeWithPath(_moduleId, 0, "Language Models")),
|
|
125
|
+
description: ( localizeWithPath(_moduleId, 1, "Language models usage statistics of this extension.")),
|
|
126
|
+
access: {
|
|
127
|
+
canToggle: false
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export { LanguageModelStatsService };
|
|
@@ -19,7 +19,9 @@ class LanguageModelsService {
|
|
|
19
19
|
}
|
|
20
20
|
registerLanguageModelChat(identifier, provider) {
|
|
21
21
|
if (( this._providers.has(identifier))) {
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw ( new Error(
|
|
23
|
+
`Chat response provider with identifier ${identifier} is already registered.`
|
|
24
|
+
));
|
|
23
25
|
}
|
|
24
26
|
this._providers.set(identifier, provider);
|
|
25
27
|
this._onDidChangeProviders.fire({ added: [provider.metadata] });
|
|
@@ -32,10 +34,17 @@ class LanguageModelsService {
|
|
|
32
34
|
makeLanguageModelChatRequest(identifier, from, messages, options, progress, token) {
|
|
33
35
|
const provider = this._providers.get(identifier);
|
|
34
36
|
if (!provider) {
|
|
35
|
-
throw new Error(`Chat response provider with identifier ${identifier} is not registered.`);
|
|
37
|
+
throw ( new Error(`Chat response provider with identifier ${identifier} is not registered.`));
|
|
36
38
|
}
|
|
37
39
|
return provider.provideChatResponse(messages, from, options, progress, token);
|
|
38
40
|
}
|
|
41
|
+
computeTokenLength(identifier, message, token) {
|
|
42
|
+
const provider = this._providers.get(identifier);
|
|
43
|
+
if (!provider) {
|
|
44
|
+
throw ( new Error(`Chat response provider with identifier ${identifier} is not registered.`));
|
|
45
|
+
}
|
|
46
|
+
return provider.provideTokenCount(message, token);
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
export { LanguageModelsService };
|
|
@@ -35,13 +35,13 @@ let VoiceChatService = class VoiceChatService extends Disposable {
|
|
|
35
35
|
createPhrases(model) {
|
|
36
36
|
const phrases = ( new Map());
|
|
37
37
|
for (const agent of this.chatAgentService.getActivatedAgents()) {
|
|
38
|
-
const agentPhrase = `${VoiceChatService_1.PHRASES_LOWER[VoiceChatService_1.AGENT_PREFIX]} ${VoiceChatService_1.CHAT_AGENT_ALIAS.get(agent.
|
|
39
|
-
phrases.set(agentPhrase, { agent: agent.
|
|
38
|
+
const agentPhrase = `${VoiceChatService_1.PHRASES_LOWER[VoiceChatService_1.AGENT_PREFIX]} ${VoiceChatService_1.CHAT_AGENT_ALIAS.get(agent.name) ?? agent.name}`.toLowerCase();
|
|
39
|
+
phrases.set(agentPhrase, { agent: agent.name });
|
|
40
40
|
for (const slashCommand of agent.slashCommands) {
|
|
41
41
|
const slashCommandPhrase = `${VoiceChatService_1.PHRASES_LOWER[VoiceChatService_1.COMMAND_PREFIX]} ${slashCommand.name}`.toLowerCase();
|
|
42
|
-
phrases.set(slashCommandPhrase, { agent: agent.
|
|
42
|
+
phrases.set(slashCommandPhrase, { agent: agent.name, command: slashCommand.name });
|
|
43
43
|
const agentSlashCommandPhrase = `${agentPhrase} ${slashCommandPhrase}`.toLowerCase();
|
|
44
|
-
phrases.set(agentSlashCommandPhrase, { agent: agent.
|
|
44
|
+
phrases.set(agentSlashCommandPhrase, { agent: agent.name, command: slashCommand.name });
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return phrases;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
2
2
|
import { registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
4
|
-
import { InlineAccessibilityHelpContribution, StartSessionAction, CloseAction, ConfigureInlineChatAction, UnstashSessionAction,
|
|
4
|
+
import { InlineAccessibilityHelpContribution, StartSessionAction, CloseAction, ConfigureInlineChatAction, UnstashSessionAction, DiscardHunkAction, DiscardAction, DiscardToClipboardAction, DiscardUndoToNewFileAction, CancelSessionAction, MoveToNextHunk, MoveToPreviousHunk, ArrowOutUpAction, ArrowOutDownAction, FocusInlineChat, ViewInChatAction, ToggleDiffForChange, AcceptChanges, CopyRecordings } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatActions';
|
|
5
5
|
import { INLINE_CHAT_ID, INTERACTIVE_EDITOR_ACCESSIBILITY_HELP_ID } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
6
6
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
7
|
import '../common/inlineChatServiceImpl.js';
|
|
@@ -18,8 +18,6 @@ registerAction2(StartSessionAction);
|
|
|
18
18
|
registerAction2(CloseAction);
|
|
19
19
|
registerAction2(ConfigureInlineChatAction);
|
|
20
20
|
registerAction2(UnstashSessionAction);
|
|
21
|
-
registerAction2(ReRunRequestAction);
|
|
22
|
-
registerAction2(ReRunRequestWithIntentDetectionAction);
|
|
23
21
|
registerAction2(DiscardHunkAction);
|
|
24
22
|
registerAction2(DiscardAction);
|
|
25
23
|
registerAction2(DiscardToClipboardAction);
|
|
@@ -32,7 +30,6 @@ registerAction2(ArrowOutDownAction);
|
|
|
32
30
|
registerAction2(FocusInlineChat);
|
|
33
31
|
registerAction2(ViewInChatAction);
|
|
34
32
|
registerAction2(ToggleDiffForChange);
|
|
35
|
-
registerAction2(ReportIssueForBugCommand);
|
|
36
33
|
registerAction2(AcceptChanges);
|
|
37
34
|
registerAction2(CopyRecordings);
|
|
38
35
|
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
@@ -19,6 +19,7 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
|
19
19
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
20
20
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
21
21
|
|
|
22
|
+
const _moduleId = "vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl";
|
|
22
23
|
let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
23
24
|
constructor(_fileConfigService, _editorGroupService, _textFileService, _editorService, _inlineChatSessionService, _configService, _workingCopyFileService, _logService) {
|
|
24
25
|
this._fileConfigService = _fileConfigService;
|
|
@@ -29,19 +30,19 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
29
30
|
this._configService = _configService;
|
|
30
31
|
this._workingCopyFileService = _workingCopyFileService;
|
|
31
32
|
this._logService = _logService;
|
|
32
|
-
this._store = ( new DisposableStore());
|
|
33
|
-
this._saveParticipant = this._store.add(( new MutableDisposable()));
|
|
34
|
-
this._sessionData = ( new Map());
|
|
33
|
+
this._store = ( (new DisposableStore()));
|
|
34
|
+
this._saveParticipant = this._store.add(( (new MutableDisposable())));
|
|
35
|
+
this._sessionData = ( (new Map()));
|
|
35
36
|
this._store.add(Event.any(_inlineChatSessionService.onDidEndSession, _inlineChatSessionService.onDidStashSession)(e => {
|
|
36
37
|
this._sessionData.get(e.session)?.dispose();
|
|
37
38
|
}));
|
|
38
39
|
}
|
|
39
40
|
dispose() {
|
|
40
41
|
this._store.dispose();
|
|
41
|
-
dispose(( this._sessionData.values()));
|
|
42
|
+
dispose(( (this._sessionData.values())));
|
|
42
43
|
}
|
|
43
44
|
markChanged(session) {
|
|
44
|
-
if (!( this._sessionData.has(session))) {
|
|
45
|
+
if (!( (this._sessionData.has(session)))) {
|
|
45
46
|
let uri = session.targetUri;
|
|
46
47
|
if (uri.scheme === Schemas.vscodeNotebookCell) {
|
|
47
48
|
const data = CellUri.parse(uri);
|
|
@@ -69,7 +70,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
_installSaveParticpant() {
|
|
72
|
-
const queue = ( new Queue());
|
|
73
|
+
const queue = ( (new Queue()));
|
|
73
74
|
const d1 = this._textFileService.files.addSaveParticipant({
|
|
74
75
|
participate: (model, ctx, progress, token) => {
|
|
75
76
|
return queue.queue(() => this._participate(ctx.savedFrom ?? model.textEditorModel?.uri, ctx.reason, progress, token));
|
|
@@ -89,9 +90,9 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
89
90
|
if (!this._configService.getValue("inlineChat.acceptedOrDiscardBeforeSave" )) {
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
|
-
const sessions = ( new Map());
|
|
93
|
+
const sessions = ( (new Map()));
|
|
93
94
|
for (const [session, data] of this._sessionData) {
|
|
94
|
-
if (uri?.toString() === ( data.resourceUri.toString())) {
|
|
95
|
+
if (uri?.toString() === ( (data.resourceUri.toString()))) {
|
|
95
96
|
sessions.set(session, data);
|
|
96
97
|
}
|
|
97
98
|
}
|
|
@@ -101,29 +102,29 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
101
102
|
progress.report({
|
|
102
103
|
message: sessions.size === 1
|
|
103
104
|
? ( localizeWithPath(
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
_moduleId,
|
|
106
|
+
0,
|
|
106
107
|
"Waiting for Inline Chat changes to be Accepted or Discarded..."
|
|
107
108
|
))
|
|
108
109
|
: ( localizeWithPath(
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
_moduleId,
|
|
111
|
+
1,
|
|
111
112
|
"Waiting for Inline Chat changes in {0} editors to be Accepted or Discarded...",
|
|
112
113
|
sessions.size
|
|
113
114
|
))
|
|
114
115
|
});
|
|
115
|
-
const { groups, orphans } = this._getGroupsAndOrphans(( sessions.values()));
|
|
116
|
+
const { groups, orphans } = this._getGroupsAndOrphans(( (sessions.values())));
|
|
116
117
|
const editorsOpenedAndSessionsEnded = this._openAndWait(groups, token).then(() => {
|
|
117
118
|
if (token.isCancellationRequested) {
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
|
-
return this._openAndWait(( Iterable.map(orphans, s => [this._editorGroupService.activeGroup, s])), token);
|
|
121
|
+
return this._openAndWait(( (Iterable.map(orphans, s => [this._editorGroupService.activeGroup, s]))), token);
|
|
121
122
|
});
|
|
122
|
-
const allSessionsEnded = this._whenSessionsEnded(Iterable.concat(( groups.map(tuple => tuple[1])), orphans), token);
|
|
123
|
+
const allSessionsEnded = this._whenSessionsEnded(Iterable.concat(( (groups.map(tuple => tuple[1]))), orphans), token);
|
|
123
124
|
await Promise.race([allSessionsEnded, editorsOpenedAndSessionsEnded]);
|
|
124
125
|
}
|
|
125
126
|
_getGroupsAndOrphans(sessions) {
|
|
126
|
-
const groupByEditor = ( new Map());
|
|
127
|
+
const groupByEditor = ( (new Map()));
|
|
127
128
|
for (const group of this._editorGroupService.getGroups(1 )) {
|
|
128
129
|
const candidate = group.activeEditorPane?.getControl();
|
|
129
130
|
if (isCodeEditor(candidate)) {
|
|
@@ -131,7 +132,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
const groups = [];
|
|
134
|
-
const orphans = ( new Set());
|
|
135
|
+
const orphans = ( (new Set()));
|
|
135
136
|
for (const data of sessions) {
|
|
136
137
|
const editor = this._inlineChatSessionService.getCodeEditor(data.session);
|
|
137
138
|
const group = groupByEditor.get(editor);
|
|
@@ -148,7 +149,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
148
149
|
return { groups, orphans };
|
|
149
150
|
}
|
|
150
151
|
async _openAndWait(groups, token) {
|
|
151
|
-
const dataByGroup = ( new Map());
|
|
152
|
+
const dataByGroup = ( (new Map()));
|
|
152
153
|
for (const [group, data] of groups) {
|
|
153
154
|
let array = dataByGroup.get(group);
|
|
154
155
|
if (!array) {
|
|
@@ -161,7 +162,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
161
162
|
if (token.isCancellationRequested) {
|
|
162
163
|
break;
|
|
163
164
|
}
|
|
164
|
-
array.sort((a, b) => compare(( a.session.targetUri.toString()), ( b.session.targetUri.toString())));
|
|
165
|
+
array.sort((a, b) => compare(( (a.session.targetUri.toString())), ( (b.session.targetUri.toString()))));
|
|
165
166
|
for (const data of array) {
|
|
166
167
|
const input = { resource: data.resourceUri };
|
|
167
168
|
const pane = await this._editorService.openEditor(input, group);
|
|
@@ -174,7 +175,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
174
175
|
if (cell) {
|
|
175
176
|
await notebookEditor.revealRangeInCenterIfOutsideViewportAsync(cell, data.session.wholeRange.value);
|
|
176
177
|
}
|
|
177
|
-
const tuple = notebookEditor.codeEditors.find(tuple => tuple[1].getModel()?.uri.toString() === ( data.session.targetUri.toString()));
|
|
178
|
+
const tuple = notebookEditor.codeEditors.find(tuple => tuple[1].getModel()?.uri.toString() === ( (data.session.targetUri.toString())));
|
|
178
179
|
editor = tuple?.[1];
|
|
179
180
|
}
|
|
180
181
|
}
|
|
@@ -188,13 +189,13 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
188
189
|
}
|
|
189
190
|
this._inlineChatSessionService.moveSession(data.session, editor);
|
|
190
191
|
InlineChatController.get(editor)?.showSaveHint();
|
|
191
|
-
this._logService.info('WAIT for session to end', editor.getId(), ( data.session.targetUri.toString()));
|
|
192
|
+
this._logService.info('WAIT for session to end', editor.getId(), ( (data.session.targetUri.toString())));
|
|
192
193
|
await this._whenSessionsEnded(Iterable.single(data), token);
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
async _whenSessionsEnded(iterable, token) {
|
|
197
|
-
const sessions = ( new Map());
|
|
198
|
+
const sessions = ( (new Map()));
|
|
198
199
|
for (const item of iterable) {
|
|
199
200
|
sessions.set(item.session, item);
|
|
200
201
|
}
|
|
@@ -202,7 +203,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
202
203
|
return;
|
|
203
204
|
}
|
|
204
205
|
let listener;
|
|
205
|
-
const whenEnded = ( new Promise(resolve => {
|
|
206
|
+
const whenEnded = ( (new Promise(resolve => {
|
|
206
207
|
listener = Event.any(this._inlineChatSessionService.onDidEndSession, this._inlineChatSessionService.onDidStashSession)(e => {
|
|
207
208
|
const data = sessions.get(e.session);
|
|
208
209
|
if (data) {
|
|
@@ -213,7 +214,7 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
});
|
|
216
|
-
}));
|
|
217
|
+
})));
|
|
217
218
|
try {
|
|
218
219
|
await raceCancellation(whenEnded, token);
|
|
219
220
|
}
|
|
@@ -222,15 +223,15 @@ let InlineChatSavingServiceImpl = class InlineChatSavingServiceImpl {
|
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
};
|
|
225
|
-
InlineChatSavingServiceImpl = ( __decorate([
|
|
226
|
-
( __param(0, IFilesConfigurationService)),
|
|
227
|
-
( __param(1, IEditorGroupsService)),
|
|
228
|
-
( __param(2, ITextFileService)),
|
|
229
|
-
( __param(3, IEditorService)),
|
|
230
|
-
( __param(4, IInlineChatSessionService)),
|
|
231
|
-
( __param(5, IConfigurationService)),
|
|
232
|
-
( __param(6, IWorkingCopyFileService)),
|
|
233
|
-
( __param(7, ILogService))
|
|
234
|
-
], InlineChatSavingServiceImpl));
|
|
226
|
+
InlineChatSavingServiceImpl = ( (__decorate([
|
|
227
|
+
( (__param(0, IFilesConfigurationService))),
|
|
228
|
+
( (__param(1, IEditorGroupsService))),
|
|
229
|
+
( (__param(2, ITextFileService))),
|
|
230
|
+
( (__param(3, IEditorService))),
|
|
231
|
+
( (__param(4, IInlineChatSessionService))),
|
|
232
|
+
( (__param(5, IConfigurationService))),
|
|
233
|
+
( (__param(6, IWorkingCopyFileService))),
|
|
234
|
+
( (__param(7, ILogService)))
|
|
235
|
+
], InlineChatSavingServiceImpl)));
|
|
235
236
|
|
|
236
237
|
export { InlineChatSavingServiceImpl };
|