Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] customized Diff-Algorithm, needed for diff-editor #4764

Open
1 of 2 tasks
Hideer opened this issue Nov 26, 2024 · 0 comments
Open
1 of 2 tasks

[Bug] customized Diff-Algorithm, needed for diff-editor #4764

Hideer opened this issue Nov 26, 2024 · 0 comments

Comments

@Hideer
Copy link

Hideer commented Nov 26, 2024

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

demo

Cannot be used in the latest version, how to solve it

Monaco Editor Playground Code

const WorkerBasedDocumentDiffProvider = require('vs/editor/browser/widget/diffEditor/workerBasedDocumentDiffProvider').WorkerBasedDocumentDiffProvider;

class MyDiffProviderFactoryService {
	createDiffProvider(editor, options) {
		console.log('compute diff');
		const provider = standaloneServices.StandaloneServices.initialize().createInstance(WorkerBasedDocumentDiffProvider, {});

		return {
			onDidChange: () => {},
			async computeDiff(original, modified, options, token) {
				const d = await provider.computeDiff(original, modified, options, token);
				return {
					changes: d.changes.slice(1),
					moves: [],
					identical: false,
					quitEarly: false,
				};
			}
		}
	}
}

const standaloneServices = require("vs/editor/standalone/browser/standaloneServices");

standaloneServices.StandaloneServices.initialize({
	'diffProviderFactoryService': new MyDiffProviderFactoryService(),
});

const m1 = monaco.editor.createModel(`
1
2
3
4
5
6
7
8
9`);

const m2 = monaco.editor.createModel(`
1
2
x
4
5
6
8
9`);

const diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {});
console.log('1');
diffEditor.setModel({
	original: m1,
	modified: m2,
});

Reproduction Steps

  1. Use the above code or demo
  2. Update monaco version to 0.49

Actual (Problematic) Behavior

No response

Expected Behavior

No response

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant