browser-ext-github-monaco icon indicating copy to clipboard operation
browser-ext-github-monaco copied to clipboard

Support monaco diff editor for changes view?

Open bpasero opened this issue 3 years ago • 4 comments

Not sure if this is in the cards, but I would love to see the monaco diff editor be used when looking at changes on GitHub 👍

https://microsoft.github.io/monaco-editor/playground.html#creating-the-diffeditor-hello-diff-world

bpasero avatar Dec 16 '20 13:12 bpasero

Interesting idea! But what would monaco do better than GitHubs diff view? Since it would be a readonly view, all the advanced editing capabilities don't come into play.

Also, replacing the diff view is much more difficult than replacing the issue text area due to the inline comment feature.

hediet avatar Dec 16 '20 14:12 hediet

@hediet oh, the monaco diff editor has a much improved compare view miles ahead of what GH provides. Take this example how it renders on GH:

image

vs VSCode where you can easily spot a block of code that was just moved:

image

bpasero avatar Dec 16 '20 15:12 bpasero

Nice. I was not aware of monacos advanced diff capabilities.

However, after reviewing the HTML structure of GitHubs diff viewer, I think this feature is close to impossible for a browser extension to implement while maintaining feature parity.

GitHubs HTML structure is a little bit weird. They use very general selectors to manipulate the DOM and their code is obfuscated and very hard to debug. The inline discussion editor is a child of a code line. If the entire code view is replaced by monaco, the editor is gone and there is no way to render it inside, lets say, a monaco widget.

I think it might be way easier if github would just use monacos diff algorithm ;)

hediet avatar Dec 16 '20 15:12 hediet

Yeah no worries :)

bpasero avatar Dec 16 '20 15:12 bpasero