microsoft / microsoft/monaco-editor

Add possibility to add view zone inside deleted text zone in inline diff editor

Open
#2,131 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

first, create diffEditor
this.diffEditor = monaco.editor.createDiffEditor(dom, options);

second, get originalEditor
this.originalEditor = this.diffEditor.originalEditor;

third, addViewZone to originalEditor

this.originalEditor.changeViewZones((changeAccessor) => {
    const domNode = doucument.createElement('div');
    changeAccessor.addZone({afterLineNumber: 1, domNode});
})

in Chrom, it can work when i use side-by-side
image

but, when i switch to inline-diff, it can't work
image

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.

Research direction

Reproduce the issue by creating a diff editor, accessing originalEditor, and calling changeViewZones with a zone after line 1. Compare side-by-side and inline-diff modes, then trace the inline-diff handling for original-editor view zones. Done means the view zone is displayed inside deleted text in inline-diff mode as it is in side-by-side mode.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.