carlthome / vscode-git-line-blame

Display inline information of the last commit that edited the currently selected line in the editor
https://marketplace.visualstudio.com/items?itemName=carlthome.git-line-blame
GNU Affero General Public License v3.0
20 stars 4 forks source link

Popup error notification when opening git changes editor window #30

Closed serg3295 closed 8 months ago

serg3295 commented 8 months ago

Reproduce: Timeline -> right click on a file 'Open Changes' -> blame_err1

dereli commented 8 months ago

@carlthome, apparently I introduced this one.

Reverting the following should fix it with no visible issue 🤞.


if (activeEditor === undefined || activeEditor !== e.textEditor) {
      vscode.window.showErrorMessage("No active text editor or incorrect one");
      return;
    }
carlthome commented 8 months ago

Thanks for raising this @serg3295! 🥇

And thanks for pointing to a fix @dereli! 👏

I've been a bit confused as to how one can access the editor within the event handler.

Since both vscode.window.onDidChangeTextEditorSelection and vscode.window.onDidChangeTextEditorVisibleRanges receive a TextEditor, it's easier to avoid accessing vscode.window.activeTextEditor in the event handler. Fix incoming: https://github.com/carlthome/vscode-git-line-blame/pull/31

serg3295 commented 8 months ago

Thanks!