ryu1kn/vscode-partial-diff

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

ryu1kn opened this issue · 4 comments

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

  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.

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?

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

  • From the command palette: window.ActiveTextEditor doesn't point to the output channel
    (but the channel is in window.visibleTextEditors)
  • From the context menu: window.ActiveTextEditor points to the output channel

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...

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