microsoft / microsoft/vscode

`createMultiFileDiffEditor` is exported in monaco-editor but the returned widget has no methods

Open
#333,335 0 comments 0 reactions 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### Summary

Monaco users want to embed the multi-file diff editor (the same UI as VS Code's "View Changes"), and `monaco.editor.createMultiFileDiffEditor(domElement)` is exported for that. But in every published monaco-editor build the returned `MultiDiffEditorWidget` is unusable:

```js
const widget = monaco.editor.createMultiFileDiffEditor(container);
widget.createViewModel(model); // TypeError: not a function
```

`createViewModel`, `setViewModel`, `layout` — none of the methods exist. Reported downstream as microsoft/monaco-editor#4584 (open since 2024).

### Why

The editor build tree-shakes class members. `createMultiFileDiffEditor` is typed `any`, so the generated API usages contain no references to `MultiDiffEditorWidget`'s members, and `build/monaco/monaco.usage.recipe` has no multi-diff entries. Everything except the constructor gets stripped.

Additionally, the factory never calls `themeService.registerEditorContainer()` (unlike `create()`/`createDiffEditor()`), so the widget renders without theme styles even when the methods are restored.

### Fix

- Add `MultiDiffEditorWidget` / `MultiDiffEditorViewModel` members to `monaco.usage.recipe`.
- Register the theme container in `createMultiFileDiffEditor`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.