@opensumi/ide-ai-native 3.7.1-next-1739252693.0 → 3.7.1-next-1739424847.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 (58) hide show
  1. package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.d.ts +1 -0
  2. package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.d.ts.map +1 -1
  3. package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js +26 -4
  4. package/lib/browser/contrib/intelligent-completions/intelligent-completions.contribution.js.map +1 -1
  5. package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.d.ts +3 -1
  6. package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.d.ts.map +1 -1
  7. package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js +9 -1
  8. package/lib/browser/contrib/intelligent-completions/intelligent-completions.controller.js.map +1 -1
  9. package/lib/browser/contrib/terminal/component/terminal-command-suggest-controller.js +2 -2
  10. package/lib/browser/contrib/terminal/component/terminal-command-suggest-controller.js.map +1 -1
  11. package/lib/browser/layout/ai-layout.d.ts.map +1 -1
  12. package/lib/browser/layout/ai-layout.js +2 -2
  13. package/lib/browser/layout/ai-layout.js.map +1 -1
  14. package/lib/browser/model/enhanceDecorationsCollection.d.ts +14 -10
  15. package/lib/browser/model/enhanceDecorationsCollection.d.ts.map +1 -1
  16. package/lib/browser/model/enhanceDecorationsCollection.js +42 -53
  17. package/lib/browser/model/enhanceDecorationsCollection.js.map +1 -1
  18. package/lib/browser/widget/inline-chat/inline-chat-editor.controller.d.ts.map +1 -1
  19. package/lib/browser/widget/inline-chat/inline-chat-editor.controller.js +1 -2
  20. package/lib/browser/widget/inline-chat/inline-chat-editor.controller.js.map +1 -1
  21. package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts +21 -5
  22. package/lib/browser/widget/inline-diff/inline-diff-previewer.d.ts.map +1 -1
  23. package/lib/browser/widget/inline-diff/inline-diff-previewer.js +40 -29
  24. package/lib/browser/widget/inline-diff/inline-diff-previewer.js.map +1 -1
  25. package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts +8 -12
  26. package/lib/browser/widget/inline-diff/inline-diff.controller.d.ts.map +1 -1
  27. package/lib/browser/widget/inline-diff/inline-diff.controller.js +68 -96
  28. package/lib/browser/widget/inline-diff/inline-diff.controller.js.map +1 -1
  29. package/lib/browser/widget/inline-input/inline-input.controller.d.ts.map +1 -1
  30. package/lib/browser/widget/inline-input/inline-input.controller.js +2 -22
  31. package/lib/browser/widget/inline-input/inline-input.controller.js.map +1 -1
  32. package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts +8 -19
  33. package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.d.ts.map +1 -1
  34. package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js +45 -40
  35. package/lib/browser/widget/inline-stream-diff/inline-stream-diff.handler.js.map +1 -1
  36. package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts +17 -4
  37. package/lib/browser/widget/inline-stream-diff/live-preview.component.d.ts.map +1 -1
  38. package/lib/browser/widget/inline-stream-diff/live-preview.component.js +37 -5
  39. package/lib/browser/widget/inline-stream-diff/live-preview.component.js.map +1 -1
  40. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts +6 -10
  41. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.d.ts.map +1 -1
  42. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js +31 -76
  43. package/lib/browser/widget/inline-stream-diff/live-preview.decoration.js.map +1 -1
  44. package/package.json +21 -21
  45. package/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts +29 -8
  46. package/src/browser/contrib/intelligent-completions/intelligent-completions.controller.ts +13 -1
  47. package/src/browser/contrib/terminal/component/terminal-command-suggest-controller.tsx +1 -1
  48. package/src/browser/layout/ai-layout.tsx +5 -2
  49. package/src/browser/model/enhanceDecorationsCollection.ts +62 -77
  50. package/src/browser/widget/inline-chat/inline-chat-editor.controller.ts +1 -2
  51. package/src/browser/widget/inline-diff/inline-diff-previewer.ts +50 -33
  52. package/src/browser/widget/inline-diff/inline-diff.controller.ts +90 -114
  53. package/src/browser/widget/inline-input/inline-input.controller.ts +3 -27
  54. package/src/browser/widget/inline-stream-diff/inline-stream-diff.handler.tsx +55 -68
  55. package/src/browser/widget/inline-stream-diff/live-preview.component.tsx +45 -6
  56. package/src/browser/widget/inline-stream-diff/live-preview.decoration.tsx +38 -111
  57. package/lib/browser/model/styles.module.less +0 -7
  58. package/src/browser/model/styles.module.less +0 -7
@@ -13,10 +13,13 @@ import {
13
13
  import { Emitter, ICodeEditor, ICursorPositionChangedEvent, IRange, ITextModel, Range } from '@opensumi/ide-monaco';
14
14
  import {
15
15
  IObservable,
16
+ IObservableSignal,
16
17
  ISettableObservable,
18
+ ITransaction,
17
19
  autorun,
18
20
  autorunWithStoreHandleChanges,
19
21
  derived,
22
+ observableSignal,
20
23
  observableValue,
21
24
  transaction,
22
25
  } from '@opensumi/ide-monaco/lib/common/observable';
@@ -85,11 +88,13 @@ export class IntelligentCompletionsController extends BaseAIMonacoEditorControll
85
88
  private aiNativeContextKey: AINativeContextKey;
86
89
  private rewriteWidget: RewriteWidget | null;
87
90
  private whenMultiLineEditsVisibleDisposable: Disposable;
91
+ private codeEditsTriggerSignal: IObservableSignal<void>;
88
92
 
89
93
  public mount(): IDisposable {
90
94
  this.handlerAlwaysVisiblePreference();
91
95
 
92
96
  this.codeEditsResult = observableValue<CodeEditsResultValue | undefined>(this, undefined);
97
+ this.codeEditsTriggerSignal = observableSignal(this);
93
98
 
94
99
  this.whenMultiLineEditsVisibleDisposable = new Disposable();
95
100
  this.multiLineDecorationModel = new MultiLineDecorationModel(this.monacoEditor);
@@ -393,6 +398,10 @@ export class IntelligentCompletionsController extends BaseAIMonacoEditorControll
393
398
  this.hide();
394
399
  });
395
400
 
401
+ public trigger(tx: ITransaction): void {
402
+ this.codeEditsTriggerSignal.trigger(tx);
403
+ }
404
+
396
405
  private registerFeature(monacoEditor: ICodeEditor): void {
397
406
  this.featureDisposable.addDispose(
398
407
  Event.any<any>(
@@ -432,16 +441,19 @@ export class IntelligentCompletionsController extends BaseAIMonacoEditorControll
432
441
  autorunWithStoreHandleChanges(
433
442
  {
434
443
  createEmptyChangeSummary: () => ({}),
435
- handleChange: (context, changeSummary) => {
444
+ handleChange: (context) => {
436
445
  if (context.didChange(this.codeEditsSourceCollection.codeEditsContextBean)) {
437
446
  // 如果上一次补全结果还在,则不重复请求
438
447
  const isVisible = this.aiNativeContextKey.multiLineEditsIsVisible.get();
439
448
  return !isVisible;
449
+ } else if (context.didChange(this.codeEditsTriggerSignal)) {
450
+ return true;
440
451
  }
441
452
  return false;
442
453
  },
443
454
  },
444
455
  async (reader, _, store) => {
456
+ this.codeEditsTriggerSignal.read(reader);
445
457
  const context = this.codeEditsSourceCollection.codeEditsContextBean.read(reader);
446
458
 
447
459
  const provider = this.intelligentCompletionsRegistry.getCodeEditsProvider();
@@ -1,4 +1,4 @@
1
- import { debounce } from 'lodash';
1
+ import debounce from 'lodash/debounce';
2
2
  import React, { useCallback, useEffect, useRef, useState } from 'react';
3
3
 
4
4
  import { Emitter, localize } from '@opensumi/ide-core-browser';
@@ -10,11 +10,14 @@ export const AILayout = () => {
10
10
  const { layout } = getStorageValue();
11
11
  const designLayoutConfig = useInjectable(DesignLayoutConfig);
12
12
 
13
- const defaultRightSize = useMemo(() => designLayoutConfig.useMergeRightWithLeftPanel ? 0 : 49, [designLayoutConfig.useMergeRightWithLeftPanel]);
13
+ const defaultRightSize = useMemo(
14
+ () => (designLayoutConfig.useMergeRightWithLeftPanel ? 0 : 49),
15
+ [designLayoutConfig.useMergeRightWithLeftPanel],
16
+ );
14
17
 
15
18
  return (
16
19
  <BoxPanel direction='top-to-bottom'>
17
- <SlotRenderer id='top' defaultSize={layout.top?.currentId ? layout.top?.size || 35 : 0} slot='top' />
20
+ <SlotRenderer id='top' defaultSize={layout.top?.currentId ? layout.top?.size || 32 : 32} slot='top' />
18
21
  <SplitPanel
19
22
  id='main-horizontal-ai'
20
23
  flex={1}
@@ -1,20 +1,15 @@
1
- import { Disposable, Emitter, Event, isDefined, isUndefined } from '@opensumi/ide-core-common';
1
+ import { Disposable, Emitter, Event, isDefined, isUndefined, uuid } from '@opensumi/ide-core-common';
2
2
  import {
3
3
  ICodeEditor,
4
4
  IContentSizeChangedEvent,
5
5
  IModelDecorationOptions,
6
- IModelDecorationsChangeAccessor,
7
6
  IModelDeltaDecoration,
8
7
  IPosition,
9
8
  IRange,
10
9
  ITextModel,
11
- Range,
12
10
  } from '@opensumi/ide-monaco';
13
- import { space } from '@opensumi/ide-utils/lib/strings';
14
11
  import { UndoRedoGroup } from '@opensumi/monaco-editor-core/esm/vs/platform/undoRedo/common/undoRedo';
15
12
 
16
- import styles from './styles.module.less';
17
-
18
13
  export interface IDecorationSerializableState {
19
14
  startPosition: IPosition;
20
15
  endPosition: IPosition;
@@ -28,8 +23,10 @@ interface IDeltaData extends IModelDeltaDecoration {
28
23
 
29
24
  export interface IEnhanceModelDeltaDecoration extends IDeltaData {
30
25
  id: string;
26
+ decorationId: string;
31
27
  isHidden: boolean;
32
28
  readonly editorDecoration: IModelDeltaDecoration;
29
+ show(): void;
33
30
  hide(): void;
34
31
  resume(): void;
35
32
  getRange(): IRange;
@@ -47,12 +44,13 @@ export interface IDeltaDecorationsOptions {
47
44
  group?: UndoRedoGroup;
48
45
  }
49
46
 
50
- class DeltaDecorations implements IEnhanceModelDeltaDecoration {
47
+ export class DeltaDecorations implements IEnhanceModelDeltaDecoration {
51
48
  length: number;
52
49
  range: IRange;
53
50
  options: IModelDecorationOptions;
54
51
 
55
52
  private resumeRange: IRange;
53
+ private _decorationId: string;
56
54
  private _group: UndoRedoGroup;
57
55
 
58
56
  private _hidden = false;
@@ -72,6 +70,10 @@ class DeltaDecorations implements IEnhanceModelDeltaDecoration {
72
70
  return this.metadata.id;
73
71
  }
74
72
 
73
+ get decorationId(): string {
74
+ return this._decorationId;
75
+ }
76
+
75
77
  get editorDecoration(): IModelDeltaDecoration {
76
78
  return this.metadata.editorDecoration;
77
79
  }
@@ -108,25 +110,6 @@ class DeltaDecorations implements IEnhanceModelDeltaDecoration {
108
110
  this._group = group;
109
111
  }
110
112
 
111
- private changeVisibility(newClassName: string, newRange: Range): void {
112
- if (!this.options.className) {
113
- return;
114
- }
115
-
116
- const classList = this.options.className
117
- .split(space)
118
- .filter((s) => s !== styles.hidden && s !== styles.visible)
119
- .filter(Boolean);
120
- classList.push(newClassName);
121
-
122
- this.options.className = classList.join(space);
123
-
124
- this.codeEditor.changeDecorations((accessor) => {
125
- accessor.changeDecorationOptions(this.id, this.options);
126
- accessor.changeDecoration(this.id, newRange);
127
- });
128
- }
129
-
130
113
  setRange(newRange: IRange): void {
131
114
  this.range = newRange;
132
115
  }
@@ -136,28 +119,45 @@ class DeltaDecorations implements IEnhanceModelDeltaDecoration {
136
119
  }
137
120
 
138
121
  dispose(): void {
122
+ this.hide();
139
123
  this.deltaData.dispose?.();
140
124
  }
141
125
 
126
+ show(): void {
127
+ this.codeEditor.changeDecorations((accessor) => {
128
+ this._decorationId = accessor.addDecoration(this.range, this.options);
129
+ });
130
+ }
131
+
142
132
  hide(): void {
143
133
  this.resumeRange = this.range;
144
134
  this._hidden = true;
145
- const startPosition = { lineNumber: this.range.startLineNumber, column: 1 };
146
- const newRange = Range.fromPositions(startPosition);
147
- this.changeVisibility(styles.hidden, newRange);
135
+ if (this._decorationId) {
136
+ this.codeEditor.changeDecorations((accessor) => {
137
+ accessor.removeDecoration(this._decorationId);
138
+ });
139
+ }
148
140
  }
149
141
 
150
142
  resume(): void {
143
+ if (!this._hidden) {
144
+ return;
145
+ }
146
+
151
147
  this._hidden = false;
152
- this.changeVisibility(styles.visible, Range.lift(this.resumeRange));
148
+ this.codeEditor.changeDecorations((accessor) => {
149
+ this._decorationId = accessor.addDecoration(this.resumeRange, this.options);
150
+ });
153
151
  }
154
152
  }
155
153
 
156
- export class EnhanceDecorationsCollection extends Disposable {
157
- private deltaDecorations: IEnhanceModelDeltaDecoration[] = [];
154
+ export class EnhanceDecorationsCollection<
155
+ T extends IEnhanceModelDeltaDecoration = IEnhanceModelDeltaDecoration,
156
+ > extends Disposable {
157
+ private deltaDecorations: T[] = [];
158
158
 
159
- protected readonly _onDidDecorationsChange = this.registerDispose(new Emitter<IEnhanceModelDeltaDecoration[]>());
160
- public readonly onDidDecorationsChange: Event<IEnhanceModelDeltaDecoration[]> = this._onDidDecorationsChange.event;
159
+ protected readonly _onDidDecorationsChange = this.registerDispose(new Emitter<T[]>());
160
+ public readonly onDidDecorationsChange: Event<T[]> = this._onDidDecorationsChange.event;
161
161
 
162
162
  private get model(): ITextModel {
163
163
  return this.codeEditor.getModel()!;
@@ -182,11 +182,11 @@ export class EnhanceDecorationsCollection extends Disposable {
182
182
  private flush(): void {
183
183
  this.deltaDecorations = this.deltaDecorations.map((d) => {
184
184
  const {
185
- id,
185
+ decorationId,
186
186
  editorDecoration: { range },
187
187
  } = d;
188
188
 
189
- const newRange = this.model.getDecorationRange(id);
189
+ const newRange = this.model.getDecorationRange(decorationId);
190
190
  d.setRange(newRange ?? range);
191
191
 
192
192
  return d;
@@ -196,66 +196,51 @@ export class EnhanceDecorationsCollection extends Disposable {
196
196
  }
197
197
 
198
198
  private delete(id: string): void {
199
- this.codeEditor.changeDecorations((accessor) => {
200
- accessor.removeDecoration(id);
201
-
202
- this.deltaDecorations = this.deltaDecorations.filter((d) => d.id !== id);
203
- });
199
+ this.deltaDecorations = this.deltaDecorations.filter((d) => d.id !== id);
204
200
  }
205
201
 
206
202
  protected createDecorations(metaData: IDeltaDecorationsOptions) {
207
- return new DeltaDecorations(metaData);
203
+ return new DeltaDecorations(metaData) as unknown as T;
208
204
  }
209
205
 
210
- set(
211
- decorations: (IModelDeltaDecoration &
212
- Partial<Pick<IEnhanceModelDeltaDecoration, 'length' | 'isHidden' | 'group'>>)[],
213
- ): void {
206
+ set(decorations: (IModelDeltaDecoration & Partial<Pick<T, 'length' | 'isHidden' | 'group'>>)[]): void {
214
207
  this.clear();
215
208
 
216
- this.codeEditor.changeDecorations((accessor: IModelDecorationsChangeAccessor) => {
217
- const newDecorations: IEnhanceModelDeltaDecoration[] = [];
218
-
219
- for (const decoration of decorations) {
220
- const id = accessor.addDecoration(decoration.range, decoration.options);
221
- newDecorations.push(
222
- this.createDecorations({
223
- id,
224
- editorDecoration: decoration,
225
- codeEditor: this.codeEditor,
226
- isHidden: decoration.isHidden,
227
- group: decoration.group,
228
- deltaData: {
229
- dispose: () => this.delete(id),
230
- length: decoration.length,
231
- },
232
- }),
233
- );
234
- }
235
-
236
- this.deltaDecorations = newDecorations;
209
+ this.deltaDecorations = decorations.map((decoration) => {
210
+ const id = uuid(6);
211
+
212
+ const dec = this.createDecorations({
213
+ id,
214
+ editorDecoration: decoration,
215
+ codeEditor: this.codeEditor,
216
+ isHidden: decoration.isHidden,
217
+ group: decoration.group,
218
+ deltaData: {
219
+ dispose: () => this.delete(id),
220
+ length: decoration.length,
221
+ },
222
+ });
223
+
224
+ dec.show();
225
+
226
+ return dec;
237
227
  });
238
228
  }
239
229
 
240
- getDecorations(): IEnhanceModelDeltaDecoration[] {
230
+ getDecorations(): T[] {
241
231
  return this.deltaDecorations;
242
232
  }
243
233
 
244
- getDecorationByGroup(group: UndoRedoGroup): IEnhanceModelDeltaDecoration | undefined {
234
+ getDecorationByGroup(group: UndoRedoGroup): T | undefined {
245
235
  return this.deltaDecorations.find((d) => d.group === group);
246
236
  }
247
237
 
248
- getDecorationByLineNumber(lineNumber: number): IEnhanceModelDeltaDecoration | undefined {
238
+ getDecorationByLineNumber(lineNumber: number): T | undefined {
249
239
  return this.deltaDecorations.find((d) => d.getRange().startLineNumber === lineNumber);
250
240
  }
251
241
 
252
242
  clear(): void {
253
- this.codeEditor.changeDecorations((accessor) => {
254
- for (const decoration of this.deltaDecorations) {
255
- accessor.removeDecoration(decoration.id);
256
- }
257
-
258
- this.deltaDecorations = [];
259
- });
243
+ this.deltaDecorations.map((d) => d.dispose());
244
+ this.deltaDecorations = [];
260
245
  }
261
246
  }
@@ -446,7 +446,7 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
446
446
  }
447
447
 
448
448
  const diffPreviewer = this.inlineDiffController.showPreviewerByStream(monacoEditor, options);
449
- diffPreviewer.mount(this.aiInlineContentWidget);
449
+ diffPreviewer.mountWidget(this.aiInlineContentWidget);
450
450
  }
451
451
 
452
452
  private ensureInlineChatVisible(monacoEditor: monaco.ICodeEditor, crossSelection: monaco.Selection) {
@@ -472,7 +472,6 @@ export class InlineChatEditorController extends BaseAIMonacoEditorController {
472
472
  const { monacoEditor, strategy, crossSelection, relationId, isRetry, actionType, actionSource } = params;
473
473
  const model = monacoEditor.getModel();
474
474
 
475
- this.inlineDiffController.destroyPreviewer(model!.uri.toString());
476
475
  this.aiInlineChatOperationDisposable.dispose();
477
476
 
478
477
  this.ensureInlineChatVisible(monacoEditor, crossSelection);
@@ -44,10 +44,13 @@ export abstract class BaseInlineDiffPreviewer<N extends IInlineDiffPreviewerNode
44
44
  protected inlineContentWidget: AIInlineContentWidget | null = null;
45
45
  protected selection: Selection;
46
46
  protected model: ITextModel;
47
+ public modelId: string;
47
48
 
48
49
  constructor(protected readonly monacoEditor: ICodeEditor) {
49
50
  super();
50
51
  this.model = this.monacoEditor.getModel()!;
52
+ this.modelId = this.model.id;
53
+
51
54
  this.addDispose(
52
55
  Disposable.create(() => {
53
56
  if (this.inlineContentWidget) {
@@ -107,11 +110,7 @@ export abstract class BaseInlineDiffPreviewer<N extends IInlineDiffPreviewerNode
107
110
  return this.node;
108
111
  }
109
112
 
110
- public createNodeSnapshot(): N | undefined {
111
- return this.node;
112
- }
113
-
114
- public mount(contentWidget: AIInlineContentWidget): void {
113
+ public mountWidget(contentWidget: AIInlineContentWidget): void {
115
114
  this.inlineContentWidget = contentWidget;
116
115
  }
117
116
 
@@ -157,20 +156,25 @@ export abstract class BaseInlineDiffPreviewer<N extends IInlineDiffPreviewerNode
157
156
  setValue(content: string): void {
158
157
  // do nothing
159
158
  }
159
+
160
160
  getValue(): string {
161
161
  // do nothing
162
162
  return '';
163
163
  }
164
+
164
165
  getOriginValue(): string {
165
166
  // do nothing
166
167
  return '';
167
168
  }
169
+
168
170
  onError(error: ErrorResponse): void {
169
171
  // do nothing
170
172
  }
173
+
171
174
  onAbort(): void {
172
175
  // do nothing
173
176
  }
177
+
174
178
  onEnd(): void {
175
179
  // do nothing
176
180
  }
@@ -179,6 +183,30 @@ export abstract class BaseInlineDiffPreviewer<N extends IInlineDiffPreviewerNode
179
183
  // do nothing
180
184
  }
181
185
 
186
+ /**
187
+ * 会新建一个渲染层的实例
188
+ * 或重新赋值渲染层的数据
189
+ * 适用于首次渲染
190
+ */
191
+ render(): void {
192
+ // do nothing
193
+ }
194
+
195
+ /**
196
+ * 仅隐藏渲染层,而不销毁实例
197
+ */
198
+ hide(): void {
199
+ // do nothing
200
+ }
201
+
202
+ /**
203
+ * 恢复渲染层
204
+ * 适用于非首次渲染
205
+ */
206
+ resume(): void {
207
+ // do nothing
208
+ }
209
+
182
210
  isModel(uri: string): boolean {
183
211
  return this.model.uri.toString() === uri;
184
212
  }
@@ -201,8 +229,8 @@ export class SideBySideInlineDiffWidget extends BaseInlineDiffPreviewer<InlineDi
201
229
  return widget;
202
230
  }
203
231
 
204
- mount(contentWidget: AIInlineContentWidget): void {
205
- super.mount(contentWidget);
232
+ mountWidget(contentWidget: AIInlineContentWidget): void {
233
+ super.mountWidget(contentWidget);
206
234
  contentWidget.addDispose(this);
207
235
  }
208
236
 
@@ -310,32 +338,6 @@ export class LiveInlineDiffPreviewer extends BaseInlineDiffPreviewer<InlineStrea
310
338
  return node;
311
339
  }
312
340
 
313
- attachNode(node: InlineStreamDiffHandler): void {
314
- this.node?.dispose();
315
- this.node = node;
316
-
317
- if (node) {
318
- const snapshot = node.currentSnapshotStore;
319
- if (snapshot) {
320
- this.node.restoreDecorationSnapshot(snapshot.decorationSnapshotData);
321
- this.listenNode(node);
322
- }
323
- }
324
- }
325
-
326
- createNodeSnapshot(): InlineStreamDiffHandler | undefined {
327
- if (!this.node) {
328
- return this.createNode();
329
- }
330
-
331
- // 拿前一个 node 的快照信息
332
- const snapshot = this.node.createSnapshot();
333
- // 创建新的实例
334
- const node = this.injector.get(InlineStreamDiffHandler, [this.monacoEditor]);
335
- node.restoreSnapshot(snapshot);
336
- return node;
337
- }
338
-
339
341
  getPosition(): IPosition {
340
342
  const zone = this.node?.getZone();
341
343
  if (zone) {
@@ -395,6 +397,21 @@ export class LiveInlineDiffPreviewer extends BaseInlineDiffPreviewer<InlineStrea
395
397
  }
396
398
  }
397
399
 
400
+ render(): void {
401
+ this.inlineContentWidget?.show();
402
+ this.node?.rateRenderEditController();
403
+ }
404
+
405
+ hide(): void {
406
+ this.inlineContentWidget?.hide();
407
+ this.node?.hide();
408
+ }
409
+
410
+ resume(): void {
411
+ this.inlineContentWidget?.show();
412
+ this.node?.resume();
413
+ }
414
+
398
415
  onData(data: ReplyResponse): void {
399
416
  const { message } = data;
400
417
  this.node?.addLinesToDiff(this.formatIndentation(message));