ryu1kn / vscode-partial-diff

Visual Studio Code Extension. Take a diff of 2 parts of text(s)
https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff
MIT License
184 stars 15 forks source link

Compare two open tabs with single command #33

Open lamyergeier opened 5 years ago

lamyergeier commented 5 years ago

I want to reopen Feature Request: Compare two open tabs with single command #11 as the I think that it would be beneficial to have diff when two tabs are open rather than when 2 editors are visible as, in laptops the screen space tends to be small, and I usually don't prefer to open 2 visible editors.#

So, requesting you for the consideration for the originally requested feature, rather than for two visible editors.

ryu1kn commented 5 years ago

Hi @anishmittal2020 , thanks for your suggestion.

What about introducing a command that let you pick a tab you want to compare against. Would that work?

https://github.com/ryu1kn/vscode-partial-diff/issues/11

lamyergeier commented 5 years ago

Actually I think that if the extension could do diff without asking the user if only two tabs are open. Otherwise it could ask the user if total number of open tabs are not equal to 2. I am proposing this because it will be super quick for those who would open 2 tabs just to compare.

ryu1kn commented 5 years ago

Makes sense. Thanks for the input 👍

ryu1kn commented 5 years ago

I've just got to know that currently there is no API to get the list of "Open Editors"...

https://github.com/Microsoft/vscode/issues/15178

ipatalas commented 5 years ago

What about vsc.window.visibleTextEditors? Maybe that helps.

I was thinking about opening a PR with that feature as I miss that as well. I also do see other ways of doing that. So far I've been using Notepad++ for that and there's a compare plugin which has pretty good UX. Either you use context menu of file tabs to select files to compare (also possible in VS Code) or you use toolbar icons to select first file to compare and then when the other is active you just click compare (toolbar or command). Both options would be good in your extension - whatever the user prefers. What do you think?

dzid26 commented 2 years ago

I think this pretty much exists. I used File: Compare Active File With... from Ctrl+Shift+P image And then select the recently opened file which coincides with files opened on other tabs. image

This way it is possible to compare files even between WSL and Windows after first drag&dropping file from Windows.

cwgonzalez1192 commented 1 year ago

Did this ever get resolved? With two tabs opened side-by-side (which I think means "two editors"), I still get "Please first open 2 documents to compare".

maximilianmordig commented 2 months ago

In a split view with two editors side-by-side, it opens the diff in the first editor group, so it becomes very small. Would be good if it could span the whole editor, not just the first editor group.