@codingame/monaco-vscode-chat-service-override 11.1.2 → 12.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/index.d.ts +2 -1
- package/index.js +64 -1
- package/package.json +32 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +73 -60
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +73 -81
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +73 -112
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +253 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +16 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +30 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +22 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +23 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +50 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +124 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEdinputInputContentProvider.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.d.ts +69 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingService.js +203 -182
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +458 -165
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +14 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatParticipantContributions.js → chatParticipant.contribution.js} +101 -92
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +42 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +164 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +10 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +941 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +9 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +32 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +8 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +16 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputRelatedFilesContrib.js +108 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/editorHoverWrapper.js +3 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/media/editorHoverWrapper.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +70 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/{chatViewsWelcomeContributions.js → chatViewsWelcomeHandler.js} +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatCodeMapperService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +80 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +152 -104
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceTelemetry.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/ignoredFiles.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +23 -21
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +20 -19
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.service.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +30 -33
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +6 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +9 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +247 -83
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +5 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSavingServiceImpl.js +35 -35
- package/chat.js +0 -59
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.js +0 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +0 -326
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelContentProviders.js +0 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorActions.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorController.js +0 -287
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelStats.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +0 -172
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
2
|
-
import { localize2 } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
|
-
import { Action2, MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
-
import '@codingame/monaco-vscode-chat-extensions-interactive-notebook-search-terminal-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
6
|
-
import { ctxHasEditorModification, ChatEditorController } from './chatEditorController.js';
|
|
7
|
-
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
-
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
9
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
10
|
-
import { IChatEditingService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
11
|
-
import { CHAT_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatConstants';
|
|
12
|
-
|
|
13
|
-
class NavigateAction extends Action2 {
|
|
14
|
-
constructor(next) {
|
|
15
|
-
super({
|
|
16
|
-
id: next
|
|
17
|
-
? 'chatEditor.action.navigateNext'
|
|
18
|
-
: 'chatEditor.action.navigatePrevious',
|
|
19
|
-
title: next
|
|
20
|
-
? ( localize2(7624, 'Go to Next Chat Edit'))
|
|
21
|
-
: ( localize2(7625, 'Go to Previous Chat Edit')),
|
|
22
|
-
category: CHAT_CATEGORY,
|
|
23
|
-
icon: next ? Codicon.arrowDown : Codicon.arrowUp,
|
|
24
|
-
keybinding: {
|
|
25
|
-
primary: next
|
|
26
|
-
? 512 | 63
|
|
27
|
-
: 512 | 1024 | 63 ,
|
|
28
|
-
weight: 100 ,
|
|
29
|
-
when: ( (ContextKeyExpr.and(ctxHasEditorModification, EditorContextKeys.focus))),
|
|
30
|
-
},
|
|
31
|
-
f1: true,
|
|
32
|
-
menu: {
|
|
33
|
-
id: MenuId.EditorTitle,
|
|
34
|
-
group: 'navigation',
|
|
35
|
-
order: next ? -100 : -101,
|
|
36
|
-
when: ctxHasEditorModification
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
this.next = next;
|
|
40
|
-
}
|
|
41
|
-
run(accessor) {
|
|
42
|
-
const editor = accessor.get(IEditorService).activeTextEditorControl;
|
|
43
|
-
if (!isCodeEditor(editor)) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (this.next) {
|
|
47
|
-
ChatEditorController.get(editor)?.revealNext();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
ChatEditorController.get(editor)?.revealPrevious();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
class AcceptDiscardAction extends Action2 {
|
|
55
|
-
constructor(accept) {
|
|
56
|
-
super({
|
|
57
|
-
id: accept
|
|
58
|
-
? 'chatEditor.action.accept'
|
|
59
|
-
: 'chatEditor.action.reject',
|
|
60
|
-
title: accept
|
|
61
|
-
? ( localize2(7626, 'Accept Chat Edit'))
|
|
62
|
-
: ( localize2(7627, 'Reject Chat Edit')),
|
|
63
|
-
category: CHAT_CATEGORY,
|
|
64
|
-
icon: accept
|
|
65
|
-
? Codicon.check
|
|
66
|
-
: Codicon.discard,
|
|
67
|
-
menu: {
|
|
68
|
-
id: MenuId.EditorTitle,
|
|
69
|
-
group: 'navigation',
|
|
70
|
-
order: accept ? -103 : -102,
|
|
71
|
-
when: ctxHasEditorModification
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
this.accept = accept;
|
|
75
|
-
}
|
|
76
|
-
run(accessor) {
|
|
77
|
-
const chatEditingService = accessor.get(IChatEditingService);
|
|
78
|
-
const editorService = accessor.get(IEditorService);
|
|
79
|
-
const editor = editorService.activeTextEditorControl;
|
|
80
|
-
if (!isCodeEditor(editor) || !editor.hasModel()) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const session = chatEditingService.getEditingSession(editor.getModel().uri);
|
|
84
|
-
if (!session) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (this.accept) {
|
|
88
|
-
session.accept(editor.getModel().uri);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
session.reject(editor.getModel().uri);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function registerChatEditorActions() {
|
|
96
|
-
registerAction2(class NextAction extends NavigateAction {
|
|
97
|
-
constructor() { super(true); }
|
|
98
|
-
});
|
|
99
|
-
registerAction2(class PrevAction extends NavigateAction {
|
|
100
|
-
constructor() { super(false); }
|
|
101
|
-
});
|
|
102
|
-
registerAction2(class AcceptAction extends AcceptDiscardAction {
|
|
103
|
-
constructor() { super(true); }
|
|
104
|
-
});
|
|
105
|
-
registerAction2(class RejectAction extends AcceptDiscardAction {
|
|
106
|
-
constructor() { super(false); }
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export { registerChatEditorActions };
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { coalesceInPlace, binarySearch } from 'vscode/vscode/vs/base/common/arrays';
|
|
3
|
-
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import 'vscode/vscode/vs/base/common/event';
|
|
5
|
-
import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
6
|
-
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
7
|
-
import 'vscode/vscode/vs/base/common/cancellation';
|
|
8
|
-
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
9
|
-
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
10
|
-
import { themeColorFromId } from 'vscode/vscode/vs/base/common/themables';
|
|
11
|
-
import { RenderOptions, LineSource, renderLines } from 'vscode/vscode/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines';
|
|
12
|
-
import { diffAddDecoration, diffWholeLineAddDecoration, diffDeleteDecoration } from 'vscode/vscode/vs/editor/browser/widget/diffEditor/registrations.contribution';
|
|
13
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
14
|
-
import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
15
|
-
import { ModelDecorationOptions } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
16
|
-
import { InlineDecoration } from 'vscode/vscode/vs/editor/common/viewModel';
|
|
17
|
-
import { localize } from 'vscode/vscode/vs/nls';
|
|
18
|
-
import { RawContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
19
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
20
|
-
import { overviewRulerModifiedForeground, minimapGutterModifiedBackground, overviewRulerAddedForeground, minimapGutterAddedBackground, overviewRulerDeletedForeground, minimapGutterDeletedBackground } from 'vscode/vscode/vs/workbench/contrib/scm/browser/dirtydiffDecorator';
|
|
21
|
-
import { IChatEditingService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatEditingService.service';
|
|
22
|
-
|
|
23
|
-
var ChatEditorController_1;
|
|
24
|
-
const ctxHasEditorModification = ( (new RawContextKey('chat.hasEditorModifications', undefined, ( localize(7628, "The current editor contains chat modifications")))));
|
|
25
|
-
let ChatEditorController = class ChatEditorController extends Disposable {
|
|
26
|
-
static { ChatEditorController_1 = this; }
|
|
27
|
-
static { this.ID = 'editor.contrib.chatEditorController'; }
|
|
28
|
-
static get(editor) {
|
|
29
|
-
const controller = editor.getContribution(ChatEditorController_1.ID);
|
|
30
|
-
return controller;
|
|
31
|
-
}
|
|
32
|
-
constructor(_editor, _chatEditingService, contextKeyService) {
|
|
33
|
-
super();
|
|
34
|
-
this._editor = _editor;
|
|
35
|
-
this._chatEditingService = _chatEditingService;
|
|
36
|
-
this._sessionStore = this._register(( (new DisposableStore())));
|
|
37
|
-
this._decorations = this._editor.createDecorationsCollection();
|
|
38
|
-
this._viewZones = [];
|
|
39
|
-
this._register(this._editor.onDidChangeModel(() => this._update()));
|
|
40
|
-
this._register(this._chatEditingService.onDidChangeEditingSession(() => this._updateSessionDecorations()));
|
|
41
|
-
this._register(toDisposable(() => this._clearRendering()));
|
|
42
|
-
this._ctxHasEditorModification = ctxHasEditorModification.bindTo(contextKeyService);
|
|
43
|
-
this._register(autorun(r => {
|
|
44
|
-
if (this._editor.getOption(63 )) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const session = this._chatEditingService.currentEditingSessionObs.read(r);
|
|
48
|
-
const entry = session?.entries.read(r).find(e => isEqual(e.modifiedURI, this._editor.getModel()?.uri));
|
|
49
|
-
if (!entry || entry.state.read(r) !== 0 ) {
|
|
50
|
-
this._clearRendering();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const diff = entry?.diffInfo.read(r);
|
|
54
|
-
this._updateWithDiff(entry, diff);
|
|
55
|
-
}));
|
|
56
|
-
const shouldBeReadOnly = derived(this, r => {
|
|
57
|
-
const value = this._chatEditingService.currentEditingSessionObs.read(r);
|
|
58
|
-
if (!value || value.state.read(r) !== 1 ) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return (
|
|
62
|
-
(value.entries.read(r).some(e => isEqual(e.modifiedURI, this._editor.getModel()?.uri)))
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
let actualReadonly;
|
|
66
|
-
let actualDeco;
|
|
67
|
-
this._register(autorun(r => {
|
|
68
|
-
const value = shouldBeReadOnly.read(r);
|
|
69
|
-
if (value) {
|
|
70
|
-
actualReadonly ??= this._editor.getOption(94 );
|
|
71
|
-
actualDeco ??= this._editor.getOption(101 );
|
|
72
|
-
this._editor.updateOptions({
|
|
73
|
-
readOnly: true,
|
|
74
|
-
renderValidationDecorations: 'off'
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
if (actualReadonly !== undefined && actualDeco !== undefined) {
|
|
79
|
-
this._editor.updateOptions({
|
|
80
|
-
readOnly: actualReadonly,
|
|
81
|
-
renderValidationDecorations: actualDeco
|
|
82
|
-
});
|
|
83
|
-
actualReadonly = undefined;
|
|
84
|
-
actualDeco = undefined;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
dispose() {
|
|
90
|
-
this._clearRendering();
|
|
91
|
-
super.dispose();
|
|
92
|
-
}
|
|
93
|
-
_update() {
|
|
94
|
-
this._sessionStore.clear();
|
|
95
|
-
if (!this._editor.hasModel()) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (this._editor.getOption(63 )) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (this._editor.getOption(63 )) {
|
|
102
|
-
this._clearRendering();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
this._updateSessionDecorations();
|
|
106
|
-
}
|
|
107
|
-
_updateSessionDecorations() {
|
|
108
|
-
if (!this._editor.hasModel()) {
|
|
109
|
-
this._clearRendering();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const model = this._editor.getModel();
|
|
113
|
-
const editingSession = this._chatEditingService.getEditingSession(model.uri);
|
|
114
|
-
const entry = this._getEntry(editingSession, model);
|
|
115
|
-
if (!entry || entry.state.get() !== 0 ) {
|
|
116
|
-
this._clearRendering();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const diff = entry.diffInfo.get();
|
|
120
|
-
this._updateWithDiff(entry, diff);
|
|
121
|
-
}
|
|
122
|
-
_getEntry(editingSession, model) {
|
|
123
|
-
if (!editingSession) {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
return editingSession.entries.get().find(e => ( (e.modifiedURI.toString())) === ( (model.uri.toString()))) || null;
|
|
127
|
-
}
|
|
128
|
-
_clearRendering() {
|
|
129
|
-
this._editor.changeViewZones((viewZoneChangeAccessor) => {
|
|
130
|
-
for (const id of this._viewZones) {
|
|
131
|
-
viewZoneChangeAccessor.removeZone(id);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
this._viewZones = [];
|
|
135
|
-
this._decorations.clear();
|
|
136
|
-
this._ctxHasEditorModification.reset();
|
|
137
|
-
}
|
|
138
|
-
_updateWithDiff(entry, diff) {
|
|
139
|
-
if (!diff) {
|
|
140
|
-
this._clearRendering();
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
this._ctxHasEditorModification.set(true);
|
|
144
|
-
const originalModel = entry.originalModel;
|
|
145
|
-
const chatDiffAddDecoration = ModelDecorationOptions.createDynamic({
|
|
146
|
-
...diffAddDecoration,
|
|
147
|
-
stickiness: 1
|
|
148
|
-
});
|
|
149
|
-
const chatDiffWholeLineAddDecoration = ModelDecorationOptions.createDynamic({
|
|
150
|
-
...diffWholeLineAddDecoration,
|
|
151
|
-
stickiness: 1 ,
|
|
152
|
-
});
|
|
153
|
-
const createOverviewDecoration = (overviewRulerColor, minimapColor) => {
|
|
154
|
-
return ModelDecorationOptions.createDynamic({
|
|
155
|
-
description: 'chat-editing-decoration',
|
|
156
|
-
overviewRuler: { color: themeColorFromId(overviewRulerColor), position: OverviewRulerLane.Left },
|
|
157
|
-
minimap: { color: themeColorFromId(minimapColor), position: 2 },
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
const modifiedDecoration = createOverviewDecoration(overviewRulerModifiedForeground, minimapGutterModifiedBackground);
|
|
161
|
-
const addedDecoration = createOverviewDecoration(overviewRulerAddedForeground, minimapGutterAddedBackground);
|
|
162
|
-
const deletedDecoration = createOverviewDecoration(overviewRulerDeletedForeground, minimapGutterDeletedBackground);
|
|
163
|
-
this._editor.changeViewZones((viewZoneChangeAccessor) => {
|
|
164
|
-
for (const id of this._viewZones) {
|
|
165
|
-
viewZoneChangeAccessor.removeZone(id);
|
|
166
|
-
}
|
|
167
|
-
this._viewZones = [];
|
|
168
|
-
const modifiedDecorations = [];
|
|
169
|
-
const mightContainNonBasicASCII = originalModel.mightContainNonBasicASCII();
|
|
170
|
-
const mightContainRTL = originalModel.mightContainRTL();
|
|
171
|
-
const renderOptions = RenderOptions.fromEditor(this._editor);
|
|
172
|
-
for (const diffEntry of diff.changes) {
|
|
173
|
-
const originalRange = diffEntry.original;
|
|
174
|
-
originalModel.tokenization.forceTokenization(Math.max(1, originalRange.endLineNumberExclusive - 1));
|
|
175
|
-
const source = ( (new LineSource(
|
|
176
|
-
originalRange.mapToLineArray(l => originalModel.tokenization.getLineTokens(l)),
|
|
177
|
-
[],
|
|
178
|
-
mightContainNonBasicASCII,
|
|
179
|
-
mightContainRTL
|
|
180
|
-
)));
|
|
181
|
-
const decorations = [];
|
|
182
|
-
for (const i of diffEntry.innerChanges || []) {
|
|
183
|
-
decorations.push(( (new InlineDecoration(
|
|
184
|
-
i.originalRange.delta(-(diffEntry.original.startLineNumber - 1)),
|
|
185
|
-
diffDeleteDecoration.className,
|
|
186
|
-
0
|
|
187
|
-
))));
|
|
188
|
-
modifiedDecorations.push({
|
|
189
|
-
range: i.modifiedRange, options: chatDiffAddDecoration
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
if (!diffEntry.modified.isEmpty) {
|
|
193
|
-
modifiedDecorations.push({
|
|
194
|
-
range: diffEntry.modified.toInclusiveRange(), options: chatDiffWholeLineAddDecoration
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
if (diffEntry.original.isEmpty) {
|
|
198
|
-
modifiedDecorations.push({
|
|
199
|
-
range: diffEntry.modified.toInclusiveRange(),
|
|
200
|
-
options: addedDecoration
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
else if (diffEntry.modified.isEmpty) {
|
|
204
|
-
modifiedDecorations.push({
|
|
205
|
-
range: ( (new Range(
|
|
206
|
-
diffEntry.modified.startLineNumber,
|
|
207
|
-
1,
|
|
208
|
-
diffEntry.modified.startLineNumber,
|
|
209
|
-
1
|
|
210
|
-
))),
|
|
211
|
-
options: deletedDecoration
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
modifiedDecorations.push({
|
|
216
|
-
range: diffEntry.modified.toInclusiveRange(),
|
|
217
|
-
options: modifiedDecoration
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
const domNode = document.createElement('div');
|
|
221
|
-
domNode.className = 'chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text';
|
|
222
|
-
const result = renderLines(source, renderOptions, decorations, domNode);
|
|
223
|
-
const isCreatedContent = decorations.length === 1 && decorations[0].range.isEmpty() && decorations[0].range.startLineNumber === 1;
|
|
224
|
-
if (!isCreatedContent) {
|
|
225
|
-
const viewZoneData = {
|
|
226
|
-
afterLineNumber: diffEntry.modified.startLineNumber - 1,
|
|
227
|
-
heightInLines: result.heightInLines,
|
|
228
|
-
domNode,
|
|
229
|
-
ordinal: 50000 + 2
|
|
230
|
-
};
|
|
231
|
-
this._viewZones.push(viewZoneChangeAccessor.addZone(viewZoneData));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
this._decorations.set(modifiedDecorations);
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
revealNext() {
|
|
238
|
-
this._reveal(true);
|
|
239
|
-
}
|
|
240
|
-
revealPrevious() {
|
|
241
|
-
this._reveal(false);
|
|
242
|
-
}
|
|
243
|
-
_reveal(next) {
|
|
244
|
-
const position = this._editor.getPosition();
|
|
245
|
-
if (!position) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const decorations = this._decorations
|
|
249
|
-
.getRanges()
|
|
250
|
-
.sort((a, b) => Range.compareRangesUsingStarts(a, b));
|
|
251
|
-
for (let i = 0; i < decorations.length; i++) {
|
|
252
|
-
const decoration = decorations[i];
|
|
253
|
-
for (let j = 0; j < decorations.length; j++) {
|
|
254
|
-
if (i !== j && decoration && decorations[j]?.containsRange(decoration)) {
|
|
255
|
-
decorations[i] = undefined;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
coalesceInPlace(decorations);
|
|
261
|
-
if (decorations.length === 0) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
let idx = binarySearch(decorations, Range.fromPositions(position), Range.compareRangesUsingStarts);
|
|
265
|
-
if (idx < 0) {
|
|
266
|
-
idx = ~idx;
|
|
267
|
-
}
|
|
268
|
-
let target;
|
|
269
|
-
if (decorations[idx]?.containsPosition(position)) {
|
|
270
|
-
target = idx + (next ? 1 : -1);
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
target = next ? idx : idx - 1;
|
|
274
|
-
}
|
|
275
|
-
target = (target + decorations.length) % decorations.length;
|
|
276
|
-
const targetPosition = decorations[target].getStartPosition();
|
|
277
|
-
this._editor.setPosition(targetPosition);
|
|
278
|
-
this._editor.revealPositionInCenter(targetPosition, 0 );
|
|
279
|
-
this._editor.focus();
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
ChatEditorController = ChatEditorController_1 = ( (__decorate([
|
|
283
|
-
( (__param(1, IChatEditingService))),
|
|
284
|
-
( (__param(2, IContextKeyService)))
|
|
285
|
-
], ChatEditorController)));
|
|
286
|
-
|
|
287
|
-
export { ChatEditorController, ctxHasEditorModification };
|
|
@@ -1,130 +0,0 @@
|
|
|
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 { localize } from 'vscode/vscode/vs/nls';
|
|
10
|
-
|
|
11
|
-
var LanguageModelStatsService_1;
|
|
12
|
-
let LanguageModelStatsService = class LanguageModelStatsService extends Disposable {
|
|
13
|
-
static { LanguageModelStatsService_1 = this; }
|
|
14
|
-
static { this.MODEL_STATS_STORAGE_KEY_PREFIX = 'languageModelStats.'; }
|
|
15
|
-
static { this.MODEL_ACCESS_STORAGE_KEY_PREFIX = 'languageModelAccess.'; }
|
|
16
|
-
constructor(extensionFeaturesManagementService, _storageService) {
|
|
17
|
-
super();
|
|
18
|
-
this.extensionFeaturesManagementService = extensionFeaturesManagementService;
|
|
19
|
-
this._storageService = _storageService;
|
|
20
|
-
this._onDidChangeStats = this._register(( (new Emitter())));
|
|
21
|
-
this.onDidChangeLanguageMoelStats = this._onDidChangeStats.event;
|
|
22
|
-
this.sessionStats = ( (new Map()));
|
|
23
|
-
this._register(_storageService.onDidChangeValue(-1 , undefined, this._store)(e => {
|
|
24
|
-
const model = this.getModel(e.key);
|
|
25
|
-
if (model) {
|
|
26
|
-
this._onDidChangeStats.fire(model);
|
|
27
|
-
}
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
hasAccessedModel(extensionId, model) {
|
|
31
|
-
return this.getAccessExtensions(model).includes(extensionId.toLowerCase());
|
|
32
|
-
}
|
|
33
|
-
async update(model, extensionId, agent, tokenCount) {
|
|
34
|
-
await this.extensionFeaturesManagementService.getAccess(extensionId, 'languageModels');
|
|
35
|
-
this.addAccess(model, extensionId.value);
|
|
36
|
-
let sessionStats = this.sessionStats.get(model);
|
|
37
|
-
if (!sessionStats) {
|
|
38
|
-
sessionStats = { extensions: [] };
|
|
39
|
-
this.sessionStats.set(model, sessionStats);
|
|
40
|
-
}
|
|
41
|
-
this.add(sessionStats, extensionId.value, agent, tokenCount);
|
|
42
|
-
this.write(model, extensionId.value, agent, tokenCount);
|
|
43
|
-
this._onDidChangeStats.fire(model);
|
|
44
|
-
}
|
|
45
|
-
addAccess(model, extensionId) {
|
|
46
|
-
extensionId = extensionId.toLowerCase();
|
|
47
|
-
const extensions = this.getAccessExtensions(model);
|
|
48
|
-
if (!extensions.includes(extensionId)) {
|
|
49
|
-
extensions.push(extensionId);
|
|
50
|
-
this._storageService.store(this.getAccessKey(model), JSON.stringify(extensions), -1 , 0 );
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
getAccessExtensions(model) {
|
|
54
|
-
const key = this.getAccessKey(model);
|
|
55
|
-
const data = this._storageService.get(key, -1 );
|
|
56
|
-
try {
|
|
57
|
-
if (data) {
|
|
58
|
-
const parsed = JSON.parse(data);
|
|
59
|
-
if (Array.isArray(parsed)) {
|
|
60
|
-
return parsed;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
}
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
async write(model, extensionId, participant, tokenCount) {
|
|
69
|
-
const modelStats = await this.read(model);
|
|
70
|
-
this.add(modelStats, extensionId, participant, tokenCount);
|
|
71
|
-
this._storageService.store(this.getKey(model), JSON.stringify(modelStats), -1 , 0 );
|
|
72
|
-
}
|
|
73
|
-
add(modelStats, extensionId, participant, tokenCount) {
|
|
74
|
-
let extensionStats = modelStats.extensions.find(e => ExtensionIdentifier.equals(e.extensionId, extensionId));
|
|
75
|
-
if (!extensionStats) {
|
|
76
|
-
extensionStats = { extensionId, requestCount: 0, tokenCount: 0, participants: [] };
|
|
77
|
-
modelStats.extensions.push(extensionStats);
|
|
78
|
-
}
|
|
79
|
-
if (participant) {
|
|
80
|
-
let participantStats = extensionStats.participants.find(p => p.id === participant);
|
|
81
|
-
if (!participantStats) {
|
|
82
|
-
participantStats = { id: participant, requestCount: 0, tokenCount: 0 };
|
|
83
|
-
extensionStats.participants.push(participantStats);
|
|
84
|
-
}
|
|
85
|
-
participantStats.requestCount++;
|
|
86
|
-
participantStats.tokenCount += tokenCount ?? 0;
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
extensionStats.requestCount++;
|
|
90
|
-
extensionStats.tokenCount += tokenCount ?? 0;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async read(model) {
|
|
94
|
-
try {
|
|
95
|
-
const value = this._storageService.get(this.getKey(model), -1 );
|
|
96
|
-
if (value) {
|
|
97
|
-
return JSON.parse(value);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
}
|
|
102
|
-
return { extensions: [] };
|
|
103
|
-
}
|
|
104
|
-
getModel(key) {
|
|
105
|
-
if (key.startsWith(LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX)) {
|
|
106
|
-
return key.substring(LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX.length);
|
|
107
|
-
}
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
getKey(model) {
|
|
111
|
-
return `${LanguageModelStatsService_1.MODEL_STATS_STORAGE_KEY_PREFIX}${model}`;
|
|
112
|
-
}
|
|
113
|
-
getAccessKey(model) {
|
|
114
|
-
return `${LanguageModelStatsService_1.MODEL_ACCESS_STORAGE_KEY_PREFIX}${model}`;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
LanguageModelStatsService = LanguageModelStatsService_1 = ( (__decorate([
|
|
118
|
-
( (__param(0, IExtensionFeaturesManagementService))),
|
|
119
|
-
( (__param(1, IStorageService)))
|
|
120
|
-
], LanguageModelStatsService)));
|
|
121
|
-
( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
|
|
122
|
-
id: 'languageModels',
|
|
123
|
-
label: ( localize(3194, "Language Models")),
|
|
124
|
-
description: ( localize(3195, "Language models usage statistics of this extension.")),
|
|
125
|
-
access: {
|
|
126
|
-
canToggle: false
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
export { LanguageModelStatsService };
|