Should be able to select and copy deleted code
When viewing a diff, it is often useful to be able to select and copy portions of recently deleted code. This is allowed in split view and I'm hoping it being disabled in inline view is a simple bug. If it was intended, then we should have an option to enable it.
monaco-editor version: 0.14.3 Browser: Any OS: Any Example: https://microsoft.github.io/monaco-editor/playground.html#creating-the-diffeditor-inline-diff-example
+1
I am also here to say that this feature would be of great help to have.
Any news regarding this?
It's the second most liked "feature-request" (without it being labeled as it)
It is really anoying to not to have this feature. +1
I also came here after finding this: https://developercommunity.visualstudio.com/content/problem/416355/removed-text-is-not-selectable-in-inline-diff-mode.html
I really hope this would be fixed, as it is a huge annoyance.
Thank you @alexdima 🎉
Also hoping to see this fixed/implemented soon. I've never seen a text editor that doesn't let you select certain text. Really threw me for a loop.
Never knew how much I was taking being able to copy to paste for granted...
It looks like there are two issues with this. The editor intentionally skips over selecting view zones, which is what the original text is inside. Even if you bypass the skipping of view zones, it looks like the diff editor only takes into account the line numbers from the modified model.
- Go to the playground inline diff
- Add this line at the end of the existing javascript
setTimeout(() => diffEditor.setPosition({lineNumber: 3, column: 4}), 2500); - Click Run
- As soon as the editor loads and before the timeout expires, click anywhere in the created diffEditor
- Once the timeout expires, you will see the position move to line 3 of the
originalmodel.
I found this issue in the vscode repo, which is the same problem. Vscode added buttons that allowed copying the text, example. While I don't like this as a final solution, I think the monaco editor can at least be on the same page as vscode.
@alexdima I would be willing to give this a try. It looks like the issue starts with the StandaloneDiffEditor being constructed without a clipboard service.
I recently requested this feature in GitKraken. They pointed me to this request as they use this editor within GitKraken.
Please consider implementing it!
+1 from GitKraken.
+1 from GitKraken
I've complained about this in ADO which also uses Monaco and they referred me here. Adding yet another voice to this request!
I would also like to have this feature in GitKraken. Thanks for considering it!
+1 from GitKraken
Looks like it's getting closer guys.
- Head over to the demo page: https://microsoft.github.io/monaco-editor/index.html
- Scroll down to
Diff Editorand check the boxInline diff.
- Then scroll down to where there is line changes, and right click, you're now able to copy single lines at least.
- And if you scroll even further down, to the pure deletion section, you get the option to copy the entire section or the current line.
Not sure if this is connected to the @nrayburn-tech change adding a clipboardservice (https://github.com/microsoft/vscode/pull/90846), but looks like it. 🥳
Hopefully we can get the "copy section" where there is line changes as well soon :)
How does line changes act compared to pure deletion? Can't be that different? 🤞
+1
Five years later, this is still an issue. Is this behaviour intended ? If not, can we expect it to change in the future ? Thanks
I think, you are free to creare PR ;)