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

Cannot compare texts in Outputs channel if the mark text commands are executed from the command palette #3

Closed ryu1kn closed 7 years ago

ryu1kn commented 7 years ago

Can compare if mark text commands are executed from the context menu (right-click menu)

ryu1kn commented 7 years ago
  1. Open "Git Ouptut" (Or another output channel)
  2. Select a text in the Output
  3. Open the command palette and execute any of the 2 mark text commands
  4. The command receives last focused editor but not the Output channel

If, at step 3, I execute the mark text command from context menu or keyboard shortcut, the editor object passed to the command is the Output channel.

If I close all editors other than the Output Channel, the command is not executed if I invoke them via the command palette. Whereas it is executed if I invoke them via context menu or keyboard shortcut.

ryu1kn commented 7 years ago

The mark text commands are registered with vscode.commands.registerTextEditorCommand; so their being not called when there are no editors makes sense, but then why those commands still get called when they're invoked via a context menu or keyboard shortcuts?

ryu1kn commented 7 years ago

If I register commands with vscode.commands.registerCommand, and focus the Output channel and execute the command with 2 ways:

So, even though I can execute the mark text command, then I will have problem with finding out if a user is really focusing on a text editor or actually on an output channel...

ryu1kn commented 7 years ago

Added a note on README. Closing for now...