@innovatorved/code-lab 0.5.0 → 0.6.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 (67) hide show
  1. package/ARCHITECTURE.md +3 -3
  2. package/CHANGELOG.md +15 -0
  3. package/README.md +3 -3
  4. package/dist/code-lab-sql.esm.js +1 -1
  5. package/dist/code-lab-sql.umd.js +2 -2
  6. package/dist/code-lab.css +32 -7273
  7. package/dist/code-lab.d.ts +1 -1
  8. package/dist/code-lab.esm.js +4669 -74678
  9. package/dist/code-lab.js +4655 -74665
  10. package/dist/code-lab.umd.js +4655 -74665
  11. package/dist/extensions/cpp.d.ts +2 -2
  12. package/dist/extensions/cpp.esm.js +1788 -14707
  13. package/dist/extensions/cpp.js +1788 -14707
  14. package/dist/extensions/guided-lab.esm.js +2938 -16127
  15. package/dist/extensions/guided-lab.js +2938 -16127
  16. package/dist/extensions/python.d.ts +2 -2
  17. package/dist/extensions/python.esm.js +1769 -14701
  18. package/dist/extensions/python.js +1769 -14701
  19. package/dist/index.d.ts +1 -1
  20. package/dist/preview-sw.js +4 -188
  21. package/dist/runtime.esm.js +109 -10284
  22. package/dist/runtime.js +107 -10284
  23. package/dist/schemas.d.ts +2 -2
  24. package/dist/schemas.esm.js +2938 -16127
  25. package/dist/schemas.js +2941 -16130
  26. package/dist/scm.d.ts +221 -20
  27. package/dist/shell.esm.js +811 -10002
  28. package/dist/shell.js +811 -10002
  29. package/dist/storage.d.ts +9 -0
  30. package/dist/terminal.esm.js +20 -1347
  31. package/dist/terminal.js +20 -1347
  32. package/dist/workbench/command-palette.d.ts +16 -1
  33. package/dist/workbench/diff-editor.d.ts +27 -1
  34. package/dist/workbench/icons.d.ts +6 -2
  35. package/dist/workbench/index.d.ts +32 -0
  36. package/dist/workbench/intellisense.d.ts +194 -0
  37. package/dist/workbench/xterm-adapter.d.ts +122 -0
  38. package/package.json +7 -1
  39. package/packages/commands/package.json +1 -1
  40. package/packages/core/package.json +1 -1
  41. package/packages/editor/package.json +1 -1
  42. package/packages/fs/package.json +1 -1
  43. package/packages/preview/package.json +1 -1
  44. package/packages/runtime/package.json +1 -1
  45. package/packages/settings/package.json +1 -1
  46. package/packages/sql/package.json +1 -1
  47. package/packages/terminal/package.json +1 -1
  48. package/packages/ui/package.json +1 -1
  49. package/packages/ui/src/settings-dialog.ts +36 -24
  50. package/packages/ui/src/themes.ts +89 -23
  51. package/src/code-lab.css +1345 -481
  52. package/src/extensions/cpp.ts +304 -38
  53. package/src/extensions/python.ts +342 -43
  54. package/src/index.ts +1 -1
  55. package/src/runtime.ts +272 -43
  56. package/src/schemas.ts +2 -2
  57. package/src/scm.ts +1467 -92
  58. package/src/shell.ts +1075 -93
  59. package/src/storage.ts +66 -3
  60. package/src/terminal.ts +148 -12
  61. package/src/workbench/command-palette.ts +289 -48
  62. package/src/workbench/diff-editor.ts +240 -78
  63. package/src/workbench/icons.ts +250 -53
  64. package/src/workbench/index.ts +7 -1
  65. package/src/workbench/intellisense.ts +1859 -0
  66. package/src/workbench/xterm-adapter.ts +1566 -0
  67. package/src/workbench.ts +1605 -236
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { CL_ICONS } from './icons';
6
+ import { getMonacoLanguageForFile, getMonacoThemeName } from './intellisense';
6
7
 
7
8
  function escapeHtml(str: unknown): string {
8
9
  return String(str ?? '')
@@ -19,6 +20,16 @@ export interface DiffComputeResult {
19
20
  removed: number;
20
21
  }
21
22
 
23
+ export interface GitDiffOpenOptions {
24
+ staged?: boolean;
25
+ originalText: string;
26
+ modifiedText: string;
27
+ label?: string;
28
+ onStage?: () => void | Promise<void>;
29
+ onUnstage?: () => void | Promise<void>;
30
+ onDiscard?: () => void | Promise<void>;
31
+ }
32
+
22
33
  export function computeSimpleDiff(oldText: string, newText: string): DiffComputeResult {
23
34
  const oldLines = String(oldText || '').split('\n');
24
35
  const newLines = String(newText || '').split('\n');
@@ -70,6 +81,26 @@ export function computeSimpleDiff(oldText: string, newText: string): DiffCompute
70
81
  return { hunks, added, removed };
71
82
  }
72
83
 
84
+ function renderFallbackUnifiedDiffHtml(oldText: string, newText: string): string {
85
+ const diff = computeSimpleDiff(oldText, newText);
86
+ if (diff.added === 0 && diff.removed === 0) {
87
+ return `<div class="codelab-diff-empty">No textual changes between versions.</div>`;
88
+ }
89
+ const rows = diff.hunks.map((h) => {
90
+ const cls = h.type === 'add' ? 'is-add' : h.type === 'del' ? 'is-del' : 'is-ctx';
91
+ const prefix = h.type === 'add' ? '+' : h.type === 'del' ? '-' : ' ';
92
+ const oldNum = h.oldLine !== null ? String(h.oldLine) : '';
93
+ const newNum = h.newLine !== null ? String(h.newLine) : '';
94
+ return `<div class="codelab-diff-fallback-row ${cls}">` +
95
+ `<span class="codelab-diff-ln">${oldNum}</span>` +
96
+ `<span class="codelab-diff-ln">${newNum}</span>` +
97
+ `<span class="codelab-diff-sign">${prefix}</span>` +
98
+ `<span class="codelab-diff-code">${escapeHtml(h.text)}</span>` +
99
+ `</div>`;
100
+ }).join('');
101
+ return `<div class="codelab-diff-fallback" role="region" aria-label="Unified diff view">${rows}</div>`;
102
+ }
103
+
73
104
  export class CodeLabDiffEditorManager {
74
105
  private workbench: any;
75
106
  private diffEditor: any = null;
@@ -77,12 +108,198 @@ export class CodeLabDiffEditorManager {
77
108
  private modifiedModel: any = null;
78
109
  public isActive = false;
79
110
  public activeFile = '';
80
- public currentTarget: 'starter' | 'solution' = 'solution';
111
+ public currentTarget: 'starter' | 'solution' | 'git' = 'solution';
81
112
 
82
113
  constructor(workbench: any) {
83
114
  this.workbench = workbench;
84
115
  }
85
116
 
117
+ private _ensureDiffContainer(): { diffContainer: any; editorHost: any; fallbackTextarea: any } | null {
118
+ const editorHost = this.workbench.container?.querySelector('#cl-editor-host')
119
+ || this.workbench.container?.querySelector('#cl-monaco-host');
120
+ const fallbackTextarea = this.workbench.container?.querySelector('#cl-fallback-editor');
121
+ if (!editorHost) return null;
122
+
123
+ let diffContainer = this.workbench.container.querySelector('#cl-inline-diff-container');
124
+ if (!diffContainer) {
125
+ diffContainer = document.createElement('div');
126
+ diffContainer.id = 'cl-inline-diff-container';
127
+ diffContainer.className = 'codelab-diff-container';
128
+ editorHost.parentElement.appendChild(diffContainer);
129
+ }
130
+
131
+ const welcomeHost = this.workbench.container?.querySelector('#cl-welcome-host');
132
+ if (welcomeHost) welcomeHost.style.display = 'none';
133
+
134
+ diffContainer.style.display = 'flex';
135
+ editorHost.style.display = 'none';
136
+ if (fallbackTextarea) fallbackTextarea.style.display = 'none';
137
+
138
+ this._disposeEditorModels();
139
+ return { diffContainer, editorHost, fallbackTextarea };
140
+ }
141
+
142
+ private _disposeEditorModels(): void {
143
+ if (this.diffEditor) {
144
+ try { this.diffEditor.dispose(); } catch (_err) { void _err; }
145
+ this.diffEditor = null;
146
+ }
147
+ if (this.originalModel) {
148
+ try { this.originalModel.dispose(); } catch (_err) { void _err; }
149
+ this.originalModel = null;
150
+ }
151
+ if (this.modifiedModel) {
152
+ try { this.modifiedModel.dispose(); } catch (_err) { void _err; }
153
+ this.modifiedModel = null;
154
+ }
155
+ }
156
+
157
+ /**
158
+ * Opens a VS Code Source Control side-by-side diff (`Working Tree` or `Index` vs `HEAD`).
159
+ */
160
+ public openGitDiff(file: string, opts: GitDiffOpenOptions): boolean {
161
+ const monaco = typeof window !== 'undefined' ? (window as any).monaco : null;
162
+ const hosts = this._ensureDiffContainer();
163
+ if (!hosts) return false;
164
+
165
+ const { diffContainer } = hosts;
166
+ this.isActive = true;
167
+ this.activeFile = file;
168
+ this.currentTarget = 'git';
169
+
170
+ const staged = Boolean(opts.staged);
171
+ const titleLabel = opts.label || (staged ? `${file} (Index ↔ HEAD)` : `${file} (Working Tree)`);
172
+ const safeTitle = escapeHtml(titleLabel);
173
+
174
+ diffContainer.innerHTML = `
175
+ <div class="codelab-diff-toolbar">
176
+ <span class="codelab-diff-toolbar__title">
177
+ ${CL_ICONS.diff}
178
+ <span>${safeTitle}</span>
179
+ </span>
180
+ <div class="codelab-diff-toolbar__actions">
181
+ ${staged
182
+ ? (opts.onUnstage ? `<button type="button" class="codelab-btn codelab-btn--sm" id="cl-git-diff-unstage-btn" title="Unstage Changes">${CL_ICONS.minus || '−'} Unstage</button>` : '')
183
+ : `${opts.onDiscard ? `<button type="button" class="codelab-btn codelab-btn--sm" id="cl-git-diff-discard-btn" title="Discard Changes">${CL_ICONS.discard || CL_ICONS.refresh} Discard</button>` : ''}
184
+ ${opts.onStage ? `<button type="button" class="codelab-btn codelab-btn--sm codelab-btn--primary" id="cl-git-diff-stage-btn" title="Stage Changes">${CL_ICONS.plus || '+'} Stage</button>` : ''}`
185
+ }
186
+ <button type="button" class="codelab-btn codelab-btn--sm" id="cl-git-diff-open-file-btn" title="Open File">Open File</button>
187
+ <button type="button" class="codelab-btn codelab-btn--sm" id="cl-diff-close-btn" title="Close Diff (Esc)">${CL_ICONS.x}</button>
188
+ </div>
189
+ </div>
190
+ <div class="codelab-diff-host" id="cl-diff-editor-slot"></div>
191
+ `;
192
+
193
+ const slot = diffContainer.querySelector('#cl-diff-editor-slot');
194
+ if (monaco?.editor && typeof monaco.editor.createDiffEditor === 'function' && slot) {
195
+ const resolvedTheme = typeof this.workbench._resolvedTheme === 'function'
196
+ ? this.workbench._resolvedTheme()
197
+ : this.workbench.theme;
198
+ const monacoTheme = getMonacoThemeName(resolvedTheme, monaco);
199
+ const lang = getMonacoLanguageForFile(file, this.workbench.lang);
200
+
201
+ this.diffEditor = monaco.editor.createDiffEditor(slot, {
202
+ readOnly: staged,
203
+ originalEditable: false,
204
+ theme: monacoTheme,
205
+ renderSideBySide: true,
206
+ automaticLayout: true,
207
+ minimap: { enabled: false },
208
+ scrollBeyondLastLine: false,
209
+ fontSize: Number(this.workbench._editorFontSize) || 13
210
+ });
211
+
212
+ this.originalModel = monaco.editor.createModel(String(opts.originalText ?? ''), lang);
213
+ this.modifiedModel = monaco.editor.createModel(String(opts.modifiedText ?? ''), lang);
214
+ this.diffEditor.setModel({
215
+ original: this.originalModel,
216
+ modified: this.modifiedModel
217
+ });
218
+
219
+ if (!staged) {
220
+ this.modifiedModel.onDidChangeContent(() => {
221
+ this.syncFileToWorkbench(file, this.modifiedModel.getValue());
222
+ });
223
+ }
224
+ } else if (slot) {
225
+ slot.innerHTML = renderFallbackUnifiedDiffHtml(opts.originalText, opts.modifiedText);
226
+ }
227
+
228
+ diffContainer.querySelector('#cl-git-diff-stage-btn')?.addEventListener('click', async () => {
229
+ await opts.onStage?.();
230
+ this.closeInlineDiff();
231
+ });
232
+ diffContainer.querySelector('#cl-git-diff-unstage-btn')?.addEventListener('click', async () => {
233
+ await opts.onUnstage?.();
234
+ this.closeInlineDiff();
235
+ });
236
+ diffContainer.querySelector('#cl-git-diff-discard-btn')?.addEventListener('click', async () => {
237
+ await opts.onDiscard?.();
238
+ this.closeInlineDiff();
239
+ });
240
+ diffContainer.querySelector('#cl-git-diff-open-file-btn')?.addEventListener('click', () => {
241
+ this.closeInlineDiff();
242
+ if (typeof this.workbench.openFile === 'function') {
243
+ this.workbench.openFile(file);
244
+ }
245
+ });
246
+ diffContainer.querySelector('#cl-diff-close-btn')?.addEventListener('click', () => {
247
+ this.closeInlineDiff();
248
+ });
249
+
250
+ return true;
251
+ }
252
+
253
+ /**
254
+ * Mounts a side-by-side (or inline) Monaco DiffEditor directly into an existing slot element
255
+ * without overwriting the surrounding `.codelab-scm-diff-header` toolbar.
256
+ */
257
+ public mountMonacoDiffIntoSlot(
258
+ slotEl: HTMLElement,
259
+ opts: {
260
+ relPath: string;
261
+ originalContent: string;
262
+ modifiedContent: string;
263
+ sideBySide?: boolean;
264
+ readOnly?: boolean;
265
+ }
266
+ ): boolean {
267
+ const monaco = this.workbench?.monaco || (typeof window !== 'undefined' ? (window as any).monaco : null);
268
+ if (!slotEl || !monaco?.editor || typeof monaco.editor.createDiffEditor !== 'function') {
269
+ return false;
270
+ }
271
+ this._disposeEditorModels();
272
+ this.isActive = true;
273
+ this.activeFile = opts.relPath;
274
+ this.currentTarget = 'git';
275
+
276
+ const resolvedTheme = typeof this.workbench?._resolvedTheme === 'function'
277
+ ? this.workbench._resolvedTheme()
278
+ : (this.workbench?.theme || 'dark');
279
+ const monacoTheme = getMonacoThemeName(resolvedTheme, monaco);
280
+ const lang = getMonacoLanguageForFile(opts.relPath, this.workbench?.lang);
281
+
282
+ slotEl.innerHTML = '';
283
+ this.diffEditor = monaco.editor.createDiffEditor(slotEl, {
284
+ readOnly: opts.readOnly !== false,
285
+ originalEditable: false,
286
+ theme: monacoTheme,
287
+ renderSideBySide: opts.sideBySide !== false,
288
+ automaticLayout: true,
289
+ minimap: { enabled: false },
290
+ scrollBeyondLastLine: false,
291
+ fontSize: Number(this.workbench?._editorFontSize) || 13
292
+ });
293
+
294
+ this.originalModel = monaco.editor.createModel(String(opts.originalContent ?? ''), lang);
295
+ this.modifiedModel = monaco.editor.createModel(String(opts.modifiedContent ?? ''), lang);
296
+ this.diffEditor.setModel({
297
+ original: this.originalModel,
298
+ modified: this.modifiedModel
299
+ });
300
+ return true;
301
+ }
302
+
86
303
  public openInlineDiff(file: string, target: 'starter' | 'solution' = 'solution'): boolean {
87
304
  const monaco = typeof window !== 'undefined' ? (window as any).monaco : null;
88
305
  this.activeFile = file;
@@ -92,7 +309,6 @@ export class CodeLabDiffEditorManager {
92
309
  const fallbackTextarea = this.workbench.container?.querySelector('#cl-fallback-editor');
93
310
  if (!editorHost) return false;
94
311
 
95
- // Get reference code
96
312
  const isStarter = target === 'starter';
97
313
  const baseFiles = this.workbench._getBaseFilesForModeAndLang
98
314
  ? this.workbench._getBaseFilesForModeAndLang(isStarter ? 'guided' : 'sandbox', this.workbench.lang)
@@ -102,53 +318,29 @@ export class CodeLabDiffEditorManager {
102
318
  const currentCode = this.workbench.files[file] !== undefined ? this.workbench.files[file] : '';
103
319
 
104
320
  if (!monaco || !monaco.editor || typeof monaco.editor.createDiffEditor !== 'function') {
105
- // Fall back to modal diff if Monaco or createDiffEditor is not available
106
321
  if (typeof this.workbench.showDiffModalFallback === 'function') {
107
322
  this.workbench.showDiffModalFallback(file, target);
108
323
  }
109
324
  return false;
110
325
  }
111
326
 
327
+ const hosts = this._ensureDiffContainer();
328
+ if (!hosts) return false;
329
+ const { diffContainer } = hosts;
112
330
  this.isActive = true;
113
331
 
114
- // Create or reuse diff container
115
- let diffContainer = this.workbench.container.querySelector('#cl-inline-diff-container');
116
- if (!diffContainer) {
117
- diffContainer = document.createElement('div');
118
- diffContainer.id = 'cl-inline-diff-container';
119
- diffContainer.className = 'codelab-diff-container';
120
- editorHost.parentElement.appendChild(diffContainer);
121
- }
122
-
123
- diffContainer.style.display = 'flex';
124
- if (editorHost) editorHost.style.display = 'none';
125
- if (fallbackTextarea) fallbackTextarea.style.display = 'none';
126
-
127
- if (this.diffEditor) {
128
- this.diffEditor.dispose();
129
- this.diffEditor = null;
130
- }
131
- if (this.originalModel) {
132
- this.originalModel.dispose();
133
- this.originalModel = null;
134
- }
135
- if (this.modifiedModel) {
136
- this.modifiedModel.dispose();
137
- this.modifiedModel = null;
138
- }
139
-
140
332
  const safeFile = escapeHtml(file);
141
333
  diffContainer.innerHTML = `
142
334
  <div class="codelab-diff-toolbar">
143
- <span style="font-weight:600;display:inline-flex;align-items:center;gap:6px;">
335
+ <span class="codelab-diff-toolbar__title">
144
336
  ${CL_ICONS.diff}
145
337
  <span>Diff: <code>${safeFile}</code> (${isStarter ? 'Current vs Starter' : 'Current vs Solution'})</span>
146
338
  </span>
147
- <div class="codelab-segmented" style="margin-left:16px;">
339
+ <div class="codelab-segmented" style="margin-left:12px;">
148
340
  <button type="button" class="codelab-segmented__btn ${target === 'starter' ? 'active' : ''}" id="cl-diff-toggle-starter">Starter</button>
149
341
  <button type="button" class="codelab-segmented__btn ${target === 'solution' ? 'active' : ''}" id="cl-diff-toggle-solution">Solution</button>
150
342
  </div>
151
- <div style="margin-left:auto;display:inline-flex;align-items:center;gap:6px;">
343
+ <div class="codelab-diff-toolbar__actions">
152
344
  <button type="button" class="codelab-btn codelab-btn--sm" id="cl-diff-revert-btn">${CL_ICONS.refresh} Revert File</button>
153
345
  <button type="button" class="codelab-btn codelab-btn--sm codelab-btn--primary" id="cl-diff-apply-btn">${CL_ICONS.check} Apply Solution</button>
154
346
  <button type="button" class="codelab-btn codelab-btn--sm" id="cl-diff-close-btn">${CL_ICONS.x} Close Diff</button>
@@ -161,19 +353,18 @@ export class CodeLabDiffEditorManager {
161
353
  const resolvedTheme = typeof this.workbench._resolvedTheme === 'function'
162
354
  ? this.workbench._resolvedTheme()
163
355
  : this.workbench.theme;
164
- const monacoTheme = resolvedTheme === 'light'
165
- ? 'vs'
166
- : (resolvedTheme === 'high-contrast' ? 'hc-black' : 'vs-dark');
356
+ const monacoTheme = getMonacoThemeName(resolvedTheme, monaco);
167
357
  this.diffEditor = monaco.editor.createDiffEditor(slot, {
168
358
  readOnly: false,
169
359
  originalEditable: false,
170
360
  theme: monacoTheme,
171
361
  renderSideBySide: true,
172
362
  automaticLayout: true,
173
- minimap: { enabled: false }
363
+ minimap: { enabled: false },
364
+ scrollBeyondLastLine: false
174
365
  });
175
366
 
176
- const lang = file.endsWith('.ts') ? 'typescript' : file.endsWith('.cpp') ? 'cpp' : file.endsWith('.py') ? 'python' : 'javascript';
367
+ const lang = getMonacoLanguageForFile(file, this.workbench.lang);
177
368
  this.originalModel = monaco.editor.createModel(refCode, lang);
178
369
  this.modifiedModel = monaco.editor.createModel(currentCode, lang);
179
370
 
@@ -182,35 +373,10 @@ export class CodeLabDiffEditorManager {
182
373
  modified: this.modifiedModel
183
374
  });
184
375
 
185
- const syncFileToWorkbench = (val: string): void => {
186
- this.workbench.files[file] = val;
187
- const mainModel = this.workbench.models && typeof this.workbench.models.get === 'function'
188
- ? this.workbench.models.get(file)
189
- : null;
190
- if (mainModel && typeof mainModel.getValue === 'function' && mainModel.getValue() !== val) {
191
- mainModel.setValue(val);
192
- }
193
- if (this.workbench.activeFile === file && fallbackTextarea && fallbackTextarea.value !== val) {
194
- fallbackTextarea.value = val;
195
- }
196
- if (this.workbench.shell && this.workbench.shell.vfs && typeof this.workbench.shell.vfs.writeFileSync === 'function') {
197
- const vfsPath = file.startsWith('/') ? file : `/workspace/${file}`;
198
- this.workbench.shell.vfs.writeFileSync(vfsPath, val);
199
- }
200
- if (typeof this.workbench._saveState === 'function') {
201
- this.workbench._saveState();
202
- }
203
- if (typeof this.workbench._markDirty === 'function') {
204
- this.workbench._markDirty(file);
205
- }
206
- };
207
-
208
- // Wire modified model edits back to workbench, main Monaco model, VFS, and persistence
209
376
  this.modifiedModel.onDidChangeContent(() => {
210
- syncFileToWorkbench(this.modifiedModel.getValue());
377
+ this.syncFileToWorkbench(file, this.modifiedModel.getValue());
211
378
  });
212
379
 
213
- // Wire buttons
214
380
  diffContainer.querySelector('#cl-diff-toggle-starter')?.addEventListener('click', () => {
215
381
  this.openInlineDiff(file, 'starter');
216
382
  });
@@ -223,7 +389,7 @@ export class CodeLabDiffEditorManager {
223
389
  if (typeof this.workbench.setFile === 'function') {
224
390
  this.workbench.setFile(file, starterCode);
225
391
  } else {
226
- syncFileToWorkbench(starterCode);
392
+ this.syncFileToWorkbench(file, starterCode);
227
393
  }
228
394
  this.closeInlineDiff();
229
395
  this.workbench.openFile(file);
@@ -239,7 +405,7 @@ export class CodeLabDiffEditorManager {
239
405
  if (typeof this.workbench.setFile === 'function') {
240
406
  this.workbench.setFile(file, solutionCode);
241
407
  } else {
242
- syncFileToWorkbench(solutionCode);
408
+ this.syncFileToWorkbench(file, solutionCode);
243
409
  }
244
410
  this.closeInlineDiff();
245
411
  this.workbench.openFile(file);
@@ -276,6 +442,9 @@ export class CodeLabDiffEditorManager {
276
442
  if (typeof this.workbench._markDirty === 'function') {
277
443
  this.workbench._markDirty(file);
278
444
  }
445
+ if (typeof this.workbench._refreshGitDecorations === 'function') {
446
+ this.workbench._refreshGitDecorations();
447
+ }
279
448
  }
280
449
 
281
450
  public closeInlineDiff(): void {
@@ -284,21 +453,14 @@ export class CodeLabDiffEditorManager {
284
453
  if (diffContainer) {
285
454
  diffContainer.style.display = 'none';
286
455
  }
456
+ const isWelcomeActive = this.workbench.activeFile === '__welcome__';
457
+ const welcomeHost = this.workbench.container?.querySelector('#cl-welcome-host');
287
458
  const editorHost = this.workbench.container?.querySelector('#cl-editor-host') || this.workbench.container?.querySelector('#cl-monaco-host');
288
- if (editorHost) {
459
+ if (isWelcomeActive && welcomeHost) {
460
+ welcomeHost.style.display = 'flex';
461
+ } else if (editorHost) {
289
462
  editorHost.style.display = '';
290
463
  }
291
- if (this.diffEditor) {
292
- this.diffEditor.dispose();
293
- this.diffEditor = null;
294
- }
295
- if (this.originalModel) {
296
- this.originalModel.dispose();
297
- this.originalModel = null;
298
- }
299
- if (this.modifiedModel) {
300
- this.modifiedModel.dispose();
301
- this.modifiedModel = null;
302
- }
464
+ this._disposeEditorModels();
303
465
  }
304
466
  }