Browse Source

Changes behavior of showQuickFileHistory

Executes showQuickRepoHistory if there is no active editor
main
Eric Amodio 7 years ago
parent
commit
5eb4a778e8
2 changed files with 10 additions and 10 deletions
  1. +5
    -2
      src/commands/showQuickFileHistory.ts
  2. +5
    -8
      src/commands/showQuickRepoHistory.ts

+ 5
- 2
src/commands/showQuickFileHistory.ts View File

@ -15,8 +15,11 @@ export default class ShowQuickFileHistoryCommand extends ActiveEditorCommand {
async execute(editor: TextEditor, uri?: Uri, maxCount?: number, commit?: GitCommit, goBackCommand?: CommandQuickPickItem) {
if (!(uri instanceof Uri)) {
if (!editor || !editor.document) return undefined;
uri = editor.document.uri;
uri = editor && editor.document && editor.document.uri;
}
if (!uri) {
return commands.executeCommand(Commands.ShowQuickRepoHistory);
}
const gitUri = GitUri.fromUri(uri, this.git);

+ 5
- 8
src/commands/showQuickRepoHistory.ts View File

@ -1,24 +1,21 @@
'use strict';
import { commands, Uri, window } from 'vscode';
import { Command } from './commands';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { CommandQuickPickItem } from './quickPickItems';
import { RepoCommitsQuickPick } from './quickPicks';
export default class ShowQuickRepoHistoryCommand extends Command {
export default class ShowQuickRepoHistoryCommand extends ActiveEditorCommand {
constructor(private git: GitProvider, public repoPath: string) {
super(Commands.ShowQuickRepoHistory);
}
async execute(uri?: Uri, maxCount?: number, commit?: GitCommit, goBackCommand?: CommandQuickPickItem) {
async execute(editor: TextEditor, uri?: Uri, maxCount?: number, commit?: GitCommit, goBackCommand?: CommandQuickPickItem) {
if (!(uri instanceof Uri)) {
const document = window.activeTextEditor && window.activeTextEditor.document;
if (document) {
uri = document.uri;
}
uri = editor && editor.document && editor.document.uri;
}
if (maxCount == null) {

Loading…
Cancel
Save