@opensumi/ide-ai-native 3.7.1-next-1739448958.0 → 3.7.1-next-1739756477.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/lib/browser/components/utils.d.ts +2 -2
- package/lib/browser/contrib/intelligent-completions/index.d.ts +8 -12
- package/lib/browser/contrib/intelligent-completions/index.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/index.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/base.d.ts +8 -1
- package/lib/browser/contrib/intelligent-completions/source/base.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/base.js +21 -3
- package/lib/browser/contrib/intelligent-completions/source/base.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/line-change.source.d.ts +0 -2
- package/lib/browser/contrib/intelligent-completions/source/line-change.source.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/line-change.source.js +5 -37
- package/lib/browser/contrib/intelligent-completions/source/line-change.source.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/lint-error.source.d.ts +1 -3
- package/lib/browser/contrib/intelligent-completions/source/lint-error.source.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/lint-error.source.js +13 -20
- package/lib/browser/contrib/intelligent-completions/source/lint-error.source.js.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/typing.source.d.ts +2 -2
- package/lib/browser/contrib/intelligent-completions/source/typing.source.d.ts.map +1 -1
- package/lib/browser/contrib/intelligent-completions/source/typing.source.js +6 -8
- package/lib/browser/contrib/intelligent-completions/source/typing.source.js.map +1 -1
- package/lib/browser/contrib/terminal/component/terminal-command-suggest-controller.js +2 -2
- package/lib/browser/contrib/terminal/component/terminal-command-suggest-controller.js.map +1 -1
- package/lib/browser/types.d.ts +5 -1
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/types.js.map +1 -1
- package/lib/browser/widget/inline-chat/inline-chat-editor.controller.js +7 -7
- package/lib/browser/widget/inline-chat/inline-chat-editor.controller.js.map +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.js +1 -1
- package/lib/browser/widget/inline-diff/inline-diff.controller.js.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts.map +1 -1
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js +5 -7
- package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js.map +1 -1
- package/lib/common/utils.js +2 -2
- package/lib/common/utils.js.map +1 -1
- package/package.json +21 -21
- package/src/browser/contrib/intelligent-completions/index.ts +9 -4
- package/src/browser/contrib/intelligent-completions/source/base.ts +28 -5
- package/src/browser/contrib/intelligent-completions/source/line-change.source.ts +7 -57
- package/src/browser/contrib/intelligent-completions/source/lint-error.source.ts +19 -31
- package/src/browser/contrib/intelligent-completions/source/typing.source.ts +7 -9
- package/src/browser/contrib/terminal/component/terminal-command-suggest-controller.tsx +1 -1
- package/src/browser/types.ts +3 -1
- package/src/browser/widget/inline-chat/inline-chat-editor.controller.ts +8 -8
- package/src/browser/widget/inline-diff/inline-diff.controller.ts +1 -1
- package/src/browser/widget/inline-stream-diff/inline-stream-diff.handler.tsx +5 -7
- package/src/common/utils.ts +2 -2
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import { Injectable } from '@opensumi/di';
|
|
2
2
|
import { AINativeSettingSectionsId, ECodeEditsSourceTyping, IDisposable } from '@opensumi/ide-core-common';
|
|
3
|
-
import { IModelContentChangedEvent
|
|
3
|
+
import { IModelContentChangedEvent } from '@opensumi/ide-monaco';
|
|
4
4
|
|
|
5
5
|
import { BaseCodeEditsSource } from './base';
|
|
6
6
|
|
|
7
7
|
@Injectable({ multiple: true })
|
|
8
8
|
export class TypingCodeEditsSource extends BaseCodeEditsSource {
|
|
9
|
-
public priority =
|
|
9
|
+
public priority = 2;
|
|
10
10
|
|
|
11
11
|
public mount(): IDisposable {
|
|
12
12
|
this.addDispose(
|
|
13
13
|
this.monacoEditor.onDidChangeModelContent((event: IModelContentChangedEvent) => {
|
|
14
|
-
|
|
15
|
-
if (position) {
|
|
16
|
-
this.doTrigger(position, event);
|
|
17
|
-
}
|
|
14
|
+
this.doTrigger(event);
|
|
18
15
|
}),
|
|
19
16
|
);
|
|
20
17
|
return this;
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
protected async doTrigger(
|
|
20
|
+
protected async doTrigger(data: IModelContentChangedEvent) {
|
|
24
21
|
const isTypingEnabled = this.preferenceService.getValid(AINativeSettingSectionsId.CodeEditsTyping, false);
|
|
25
22
|
|
|
26
23
|
if (!isTypingEnabled || !this.model) {
|
|
@@ -29,8 +26,9 @@ export class TypingCodeEditsSource extends BaseCodeEditsSource {
|
|
|
29
26
|
|
|
30
27
|
this.setBean({
|
|
31
28
|
typing: ECodeEditsSourceTyping.Typing,
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
data: {
|
|
30
|
+
[ECodeEditsSourceTyping.Typing]: data,
|
|
31
|
+
},
|
|
34
32
|
});
|
|
35
33
|
}
|
|
36
34
|
}
|
package/src/browser/types.ts
CHANGED
|
@@ -42,7 +42,9 @@ interface IBaseInlineChatHandler<T extends any[]> {
|
|
|
42
42
|
providerDiffPreviewStrategy?: (...args: T) => MaybePromise<ChatResponse | InlineChatController>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export type IEditorInlineChatHandler = IBaseInlineChatHandler<
|
|
45
|
+
export type IEditorInlineChatHandler = IBaseInlineChatHandler<
|
|
46
|
+
[editor: ICodeEditor, selection: ISelection, token: CancellationToken]
|
|
47
|
+
>;
|
|
46
48
|
export type IInteractiveInputHandler = IBaseInlineChatHandler<
|
|
47
49
|
[editor: ICodeEditor, selection: ISelection, value: string, token: CancellationToken]
|
|
48
50
|
>;
|
|
@@ -280,7 +280,7 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
|
|
|
280
280
|
return undefined;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
-
return strategy.bind(this, monacoEditor, this.token);
|
|
283
|
+
return strategy.bind(this, monacoEditor, crossSelection, this.token);
|
|
284
284
|
};
|
|
285
285
|
|
|
286
286
|
this.runAction({
|
|
@@ -297,7 +297,7 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
|
|
|
297
297
|
});
|
|
298
298
|
return relationId;
|
|
299
299
|
},
|
|
300
|
-
execute: handler.execute ? handler.execute!.bind(this, monacoEditor, this.token) : undefined,
|
|
300
|
+
execute: handler.execute ? handler.execute!.bind(this, monacoEditor, crossSelection, this.token) : undefined,
|
|
301
301
|
providerPreview: previewer(),
|
|
302
302
|
extraData: {
|
|
303
303
|
actionSource: source === 'codeAction' ? ActionSourceEnum.CodeAction : ActionSourceEnum.InlineChat,
|
|
@@ -508,12 +508,6 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
|
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
this.visibleDiffWidget({
|
|
512
|
-
monacoEditor,
|
|
513
|
-
options: { crossSelection, chatResponse: response },
|
|
514
|
-
reportInfo: { relationId, startTime, isRetry, actionType, actionSource },
|
|
515
|
-
});
|
|
516
|
-
|
|
517
511
|
this.aiInlineChatOperationDisposable.addDispose([
|
|
518
512
|
this.aiInlineContentWidget.onResultClick((kind: EResultKind) => {
|
|
519
513
|
const modifyContent = this.inlineDiffController.getModifyContent();
|
|
@@ -579,6 +573,12 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
|
|
|
579
573
|
});
|
|
580
574
|
}),
|
|
581
575
|
]);
|
|
576
|
+
|
|
577
|
+
this.visibleDiffWidget({
|
|
578
|
+
monacoEditor,
|
|
579
|
+
options: { crossSelection, chatResponse: response },
|
|
580
|
+
reportInfo: { relationId, startTime, isRetry, actionType, actionSource },
|
|
581
|
+
});
|
|
582
582
|
}
|
|
583
583
|
|
|
584
584
|
public async runAction(params: {
|
|
@@ -74,7 +74,7 @@ export class InlineDiffController extends BaseAIMonacoEditorController {
|
|
|
74
74
|
* 保留 previewer 的实例,仅卸载 previewer 的渲染层
|
|
75
75
|
*/
|
|
76
76
|
const id = model.id;
|
|
77
|
-
const previewer = this.currentPreviewer.
|
|
77
|
+
const previewer = this.currentPreviewer.get();
|
|
78
78
|
if (previewer && previewer.modelId !== id && !previewer.disposed) {
|
|
79
79
|
previewer.hide();
|
|
80
80
|
}
|
|
@@ -467,17 +467,15 @@ export class InlineStreamDiffHandler extends Disposable implements IInlineDiffPr
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
public pushRateFinallyDiffStack(diffModel: IComputeDiffData): void {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.finallyRender(diffModel);
|
|
475
|
-
}
|
|
476
|
-
});
|
|
470
|
+
// 可能存在 rate editor controller 处理完之后接口层流式才结束
|
|
471
|
+
if (this.isEditing === false) {
|
|
472
|
+
this.finallyRender(diffModel);
|
|
473
|
+
}
|
|
477
474
|
}
|
|
478
475
|
|
|
479
476
|
public finallyRender(diffModel: IComputeDiffData): void {
|
|
480
477
|
transaction((tx) => {
|
|
478
|
+
this.finallyDiffModel.set(diffModel, tx);
|
|
481
479
|
this.diffModel.set(diffModel, tx);
|
|
482
480
|
});
|
|
483
481
|
|
package/src/common/utils.ts
CHANGED
|
@@ -32,10 +32,10 @@ export const extractCodeBlocks = (content: string): string => {
|
|
|
32
32
|
let startLine = 0;
|
|
33
33
|
|
|
34
34
|
lines.forEach((line, i) => {
|
|
35
|
-
if (!inBlock && line.startsWith(BACK_QUOTE_3_SYMBOL)) {
|
|
35
|
+
if (!inBlock && line.trim().startsWith(BACK_QUOTE_3_SYMBOL)) {
|
|
36
36
|
inBlock = true;
|
|
37
37
|
startLine = i + 1;
|
|
38
|
-
} else if (inBlock && line.startsWith(BACK_QUOTE_3_SYMBOL)) {
|
|
38
|
+
} else if (inBlock && line.trim().startsWith(BACK_QUOTE_3_SYMBOL)) {
|
|
39
39
|
inBlock = false;
|
|
40
40
|
const endLine = i;
|
|
41
41
|
newContents = lines.slice(startLine, endLine);
|