Browse Source

Fixes blame toolbar button to work on the left diff

main
Eric Amodio 6 years ago
parent
commit
11afc45ee1
2 changed files with 10 additions and 10 deletions
  1. +7
    -6
      src/commands/clearFileAnnotations.ts
  2. +3
    -4
      src/commands/toggleFileBlame.ts

+ 7
- 6
src/commands/clearFileAnnotations.ts View File

@ -1,6 +1,7 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { UriComparer } from '../comparers';
import { isTextEditor } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
@ -12,13 +13,13 @@ export class ClearFileAnnotationsCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri): Promise<any> {
if (editor == null) return undefined;
// Handle the case where we are focused on a non-editor editor (output, debug console)
if (uri != null && !UriComparer.equals(uri, editor.document.uri)) {
const e = window.visibleTextEditors.find(e => UriComparer.equals(uri, e.document.uri));
if (e !== undefined) {
editor = e;
if (editor != null && !isTextEditor(editor)) {
if (uri != null && !UriComparer.equals(uri, editor.document.uri)) {
const e = window.visibleTextEditors.find(e => UriComparer.equals(uri, e.document.uri));
if (e !== undefined) {
editor = e;
}
}
}

+ 3
- 4
src/commands/toggleFileBlame.ts View File

@ -2,6 +2,7 @@
import { TextEditor, Uri, window } from 'vscode';
import { UriComparer } from '../comparers';
import { FileAnnotationType } from '../configuration';
import { isTextEditor } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { ActiveEditorCommand, Commands } from './common';
@ -17,10 +18,8 @@ export class ToggleFileBlameCommand extends ActiveEditorCommand {
}
async execute(editor: TextEditor, uri?: Uri, args: ToggleFileBlameCommandArgs = {}): Promise<any> {
// if (editor == null) return undefined;
if (editor != null) {
// Handle the case where we are focused on a non-editor editor (output, debug console)
// Handle the case where we are focused on a non-editor editor (output, debug console)
if (editor != null && !isTextEditor(editor)) {
if (uri != null && !UriComparer.equals(uri, editor.document.uri)) {
const e = window.visibleTextEditors.find(e => UriComparer.equals(uri, e.document.uri));
if (e !== undefined) {

Loading…
Cancel
Save