[Bug] DiffEditor does not emit dispose event

Open
#4,714 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start with the Monaco Editor Playground reproduction using createDiffEditor, onDidDispose, and dispose. Verify the missing event behavior, then trace the DiffEditor disposal path and add coverage where appropriate; done means disposing the diff editor triggers the registered callback and the relevant tests pass.

Written by the indexing model from the issue text.

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.52.0#XQAAAAIlAwAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw29wKTDpJdoC9AiesbQKaEfiIBNXtJEMrCLqvz4ZnqbZ7bNj2z4ugoXXaOTfFl1U4Rwe4cwc13XoLs_pxsPZ7qIpPYclgT7KnzivizGlyJrh8guHyKCRoGmaDCrZbZNa7HSa0S7TpeAgm2YrQleKtqygckX-eVjyn_IUyIIgtkdVWoS6qApbaIM4KwPZ2uR4fRXf_CbzHcXhpftcpw9l-_GtJ46eCTMizGcH8N8nQvKW3ips2v9JkLM3oFc8Pyax_GcjTmeXXNL73LTfOd5_cYdBm6DnMjtPHq5cwVmQ3_KwlR3v5wqG5FKKKVZoocHfv3YeZynOY4-Xj_pcknolSKyAP4bU4Bh_0Ly-A7Ef24ZwmpKzwfNxVzKeO78xhwGYo4Tr7mskIumwefGxU1s-3ZgnQbWs79k3LBgLhBbFAsmPSpXz-jv5S-mlcDQ

Monaco Editor Playground Code
var originalModel = monaco.editor.createModel(
      `import { FileSystemProvider } from './test';
import { EditorLogger } from './test2';
`,
      "typescript"
    );
    var modifiedModel = monaco.editor.createModel(
      `import { FileSystemProvider } from './test2';
import { EditorLogger } from './test2';
console.log(112312)
`,
      "typescript"
    );
    const diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
      renderSideBySide: true,
      automaticLayout: true,
    })
    diffEditor.setModel({
      original: originalModel,
      modified: modifiedModel,
    });

	diffEditor.onDidDispose(() => {
		console.log('call dispose')
	})

	setTimeout(() => {
		diffEditor.dispose()
	}, 3000)
Reproduction Steps
  1. create a diffEditor
  2. add event listeners to dispose event
  3. dispose the diffEditor
  4. the event does not be triggered
Actual (Problematic) Behavior

No response

Expected Behavior

should console ths log call dispose

Additional Context

No response

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/monaco-editor

All issues in microsoft/monaco-editor

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.