@codingame/monaco-vscode-katex-common 25.1.0 → 25.1.2
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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.d.ts +19 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.js +81 -15
- package/vscode/src/vs/workbench/contrib/markdown/browser/markedKatexSupport.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.service.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.service.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-katex-common",
|
|
3
|
-
"version": "25.1.
|
|
3
|
+
"version": "25.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - common package depending on katex",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "25.1.
|
|
18
|
+
"@codingame/monaco-vscode-api": "25.1.2",
|
|
19
19
|
"katex": "0.16.27",
|
|
20
20
|
"marked": "14.0.0"
|
|
21
21
|
},
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event";
|
|
2
|
-
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { Disposable, IDisposable, IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service";
|
|
4
|
+
import { IResolvedTextEditorModel } from "@codingame/monaco-vscode-model-service-override/vscode/vs/editor/common/services/resolverService";
|
|
5
|
+
import { ITextModelService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service";
|
|
3
6
|
import { IChatProgressRenderableResponseContent, IChatTextEditGroup } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel";
|
|
7
|
+
import { IChatService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service";
|
|
8
|
+
import { IChatResponseViewModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel";
|
|
4
9
|
import { IChatListItemRendererOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat";
|
|
5
10
|
import { DiffEditorPool } from "./chatContentCodePools.js";
|
|
6
11
|
import { IChatContentPart, IChatContentPartRenderContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatContentParts";
|
|
7
|
-
import { ICodeCompareModelService } from "
|
|
12
|
+
import { ICodeCompareModelService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.service";
|
|
8
13
|
export declare class ChatTextEditContentPart extends Disposable implements IChatContentPart {
|
|
9
14
|
private readonly codeCompareModelService;
|
|
10
15
|
readonly domNode: HTMLElement;
|
|
@@ -16,3 +21,15 @@ export declare class ChatTextEditContentPart extends Disposable implements IChat
|
|
|
16
21
|
hasSameContent(other: IChatProgressRenderableResponseContent): boolean;
|
|
17
22
|
addDisposable(disposable: IDisposable): void;
|
|
18
23
|
}
|
|
24
|
+
export declare class CodeCompareModelService implements ICodeCompareModelService {
|
|
25
|
+
private readonly textModelService;
|
|
26
|
+
private readonly modelService;
|
|
27
|
+
private readonly chatService;
|
|
28
|
+
readonly _serviceBrand: undefined;
|
|
29
|
+
constructor(textModelService: ITextModelService, modelService: IModelService, chatService: IChatService);
|
|
30
|
+
createModel(element: IChatResponseViewModel, chatTextEdit: IChatTextEditGroup): Promise<IReference<{
|
|
31
|
+
originalSha1: string;
|
|
32
|
+
original: IResolvedTextEditorModel;
|
|
33
|
+
modified: IResolvedTextEditorModel;
|
|
34
|
+
}>>;
|
|
35
|
+
}
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
3
|
import { $ as $$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
4
|
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
-
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
8
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
5
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { Disposable, toDisposable, RefCountedDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
8
|
+
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
9
9
|
import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
10
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/
|
|
11
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/
|
|
12
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
13
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
14
|
-
import '@codingame/monaco-vscode-api/vscode/vs/
|
|
15
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/common/
|
|
16
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/common/
|
|
17
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
18
|
-
import '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/modelService';
|
|
10
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
12
|
+
import { TextEdit } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
13
|
+
import { createTextBufferFactoryFromSnapshot } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model/textModel';
|
|
14
|
+
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
15
|
+
import { DefaultModelSHA1Computer } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/modelService';
|
|
16
|
+
import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/resolverService.service';
|
|
19
17
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
20
18
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
19
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
21
20
|
import { isResponseVM } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
|
|
22
|
-
import { ICodeCompareModelService } from '
|
|
21
|
+
import { ICodeCompareModelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatTextEditContentPart.service';
|
|
23
22
|
|
|
24
23
|
const $ = $$1;
|
|
25
24
|
let ChatTextEditContentPart = class ChatTextEditContentPart extends Disposable {
|
|
@@ -87,5 +86,72 @@ let ChatTextEditContentPart = class ChatTextEditContentPart extends Disposable {
|
|
|
87
86
|
ChatTextEditContentPart = ( __decorate([
|
|
88
87
|
( __param(5, ICodeCompareModelService))
|
|
89
88
|
], ChatTextEditContentPart));
|
|
89
|
+
let CodeCompareModelService = class CodeCompareModelService {
|
|
90
|
+
constructor(textModelService, modelService, chatService) {
|
|
91
|
+
this.textModelService = textModelService;
|
|
92
|
+
this.modelService = modelService;
|
|
93
|
+
this.chatService = chatService;
|
|
94
|
+
}
|
|
95
|
+
async createModel(element, chatTextEdit) {
|
|
96
|
+
const original = await this.textModelService.createModelReference(chatTextEdit.uri);
|
|
97
|
+
const modified = await this.textModelService.createModelReference((this.modelService.createModel(createTextBufferFactoryFromSnapshot(original.object.textEditorModel.createSnapshot()), { languageId: original.object.textEditorModel.getLanguageId(), onDidChange: Event.None }, ( URI.from(
|
|
98
|
+
{ scheme: Schemas.vscodeChatCodeBlock, path: chatTextEdit.uri.path, query: generateUuid() }
|
|
99
|
+
)), false)).uri);
|
|
100
|
+
const d = ( new RefCountedDisposable(toDisposable(() => {
|
|
101
|
+
original.dispose();
|
|
102
|
+
modified.dispose();
|
|
103
|
+
})));
|
|
104
|
+
let originalSha1 = '';
|
|
105
|
+
if (chatTextEdit.state) {
|
|
106
|
+
originalSha1 = chatTextEdit.state.sha1;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const sha1 = ( new DefaultModelSHA1Computer());
|
|
110
|
+
if (sha1.canComputeSHA1(original.object.textEditorModel)) {
|
|
111
|
+
originalSha1 = sha1.computeSHA1(original.object.textEditorModel);
|
|
112
|
+
chatTextEdit.state = { sha1: originalSha1, applied: 0 };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const chatModel = this.chatService.getSession(element.sessionResource);
|
|
116
|
+
const editGroups = [];
|
|
117
|
+
for (const request of chatModel.getRequests()) {
|
|
118
|
+
if (!request.response) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
for (const item of request.response.response.value) {
|
|
122
|
+
if (item.kind !== 'textEditGroup' || item.state?.applied || !isEqual(item.uri, chatTextEdit.uri)) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
for (const group of item.edits) {
|
|
126
|
+
const edits = ( group.map(TextEdit.asEditOperation));
|
|
127
|
+
editGroups.push(edits);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (request.response === element.model) {
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
for (const edits of editGroups) {
|
|
135
|
+
modified.object.textEditorModel.pushEditOperations(null, edits, () => null);
|
|
136
|
+
}
|
|
137
|
+
d.acquire();
|
|
138
|
+
setTimeout(() => d.release(), 5000);
|
|
139
|
+
return {
|
|
140
|
+
object: {
|
|
141
|
+
originalSha1,
|
|
142
|
+
original: original.object,
|
|
143
|
+
modified: modified.object
|
|
144
|
+
},
|
|
145
|
+
dispose() {
|
|
146
|
+
d.release();
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
CodeCompareModelService = ( __decorate([
|
|
152
|
+
( __param(0, ITextModelService)),
|
|
153
|
+
( __param(1, IModelService)),
|
|
154
|
+
( __param(2, IChatService))
|
|
155
|
+
], CodeCompareModelService));
|
|
90
156
|
|
|
91
|
-
export { ChatTextEditContentPart };
|
|
157
|
+
export { ChatTextEditContentPart, CodeCompareModelService };
|
|
@@ -100,7 +100,7 @@ class MarkedKatexSupport {
|
|
|
100
100
|
return this.sanitizeStyles(styleString, allowedProperties);
|
|
101
101
|
}
|
|
102
102
|
static { this._katexPromise = ( new Lazy(async () => {
|
|
103
|
-
this._katex = (await import('katex')
|
|
103
|
+
this._katex = (await import('katex')).default;
|
|
104
104
|
return this._katex;
|
|
105
105
|
})); }
|
|
106
106
|
static getExtension(window, options = {}) {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IReference } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
-
import { IResolvedTextEditorModel } from "@codingame/monaco-vscode-model-service-override/vscode/vs/editor/common/services/resolverService";
|
|
3
|
-
import { IChatTextEditGroup } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel";
|
|
4
|
-
import { IChatResponseViewModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel";
|
|
5
|
-
export declare const ICodeCompareModelService: import("@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation").ServiceIdentifier<ICodeCompareModelService>;
|
|
6
|
-
export interface ICodeCompareModelService {
|
|
7
|
-
_serviceBrand: undefined;
|
|
8
|
-
createModel(response: IChatResponseViewModel, chatTextEdit: IChatTextEditGroup): Promise<IReference<{
|
|
9
|
-
originalSha1: string;
|
|
10
|
-
original: IResolvedTextEditorModel;
|
|
11
|
-
modified: IResolvedTextEditorModel;
|
|
12
|
-
}>>;
|
|
13
|
-
}
|