monaco-editor
monaco-editor copied to clipboard
Go to Next Difference doesn't work
**monaco-editor version: official playgournd 0.25.2 **Browser: chrome **OS: windows 10 Playground code that reproduces the issue:
Here is the sample, according to my understanding, Go to Next Difference(F7)"
should jump to the last line which has difference.
However, it behaves like Select Next Word
. Just jump to the next word which is the same as my cursor point to.
var originalModel = monaco.editor.createModel("1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\nheLLo world!", "text/plain");
var modifiedModel = monaco.editor.createModel("1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\nhello orlando!", "text/plain");
var diffEditor = monaco.editor.createDiffEditor(document.getElementById("container"));
diffEditor.setModel({
original: originalModel,
modified: modifiedModel
});
Is it a confirmed bug? or only i can reproduce it?
I can also confirm the bug.
I'll try to look into this next milestone, but you would help us a lot with a pull request if you can find the bug!
I'm also looking at it. But i'm new to javascript
The following code contains the reason to Go to Next difference (F7) bug and have corresponding comments The following code is in min/VS/Editor/editor.main.js
class N extends c.EditorAction {
constructor() {
super({
id: "editor.action.diffReview.next",
label: i.localize(10, null),
alias: "Go to Next Difference",
precondition: v.ContextKeyExpr.has("isInDiffEditor"),
kbOpts: {kbExpr: null, primary: 65, weight: 100}
})
}
run(e, t) {
const i = M(e);//Because M(e) return null, i = null
i && i.diffReviewNext()//Because i = null, i.diffreviewnext() will not be executed
}
}
function M(e) {
const t = e.get(h.ICodeEditorService), i = t.listDiffEditors(), n = t.getActiveCodeEditor();//n=null
if (!n) return null;//In JavaScript ! Null is true, so M(e) also return null
for (let e = 0, t = i.length; e < t; e++) {
const t = i[e]
;
if (t.getModifiedEditor().getId() === n.getId() || t.getOriginalEditor().getId() === n.getId()) return t
}
return null
}
class s extends o.CodeEditorServiceImpl {
getActiveCodeEditor() {
return null
}
...
}
You can find the unminified code here.
I guess the question is why t.getActiveCodeEditor
returns null.
I don't know exactly why t.getActiveCodeEditor returns null, but it seems that its setActiveCodeEditor has never been called