Adds "on" state to file annotation command

Adds "progress" state to file annotation command
This commit is contained in:
Eric Amodio
2017-08-15 01:35:50 -04:00
parent 787e0e6aa1
commit 00cdd2e375
17 changed files with 146 additions and 25 deletions

View File

@@ -0,0 +1,24 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { AnnotationController } from '../annotations/annotationController';
import { Commands, EditorCommand } from './common';
import { Logger } from '../logger';
export class ClearFileAnnotationsCommand extends EditorCommand {
constructor(private annotationController: AnnotationController) {
super(Commands.ClearFileAnnotations);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri): Promise<any> {
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
return this.annotationController.clear(editor.viewColumn || -1);
}
catch (ex) {
Logger.error(ex, 'ClearFileAnnotationsCommand');
return window.showErrorMessage(`Unable to clear file annotations. See output channel for more details`);
}
}
}

View File

@@ -4,7 +4,9 @@ import { ExplorerNode } from '../views/explorerNodes';
import { Logger } from '../logger';
import { Telemetry } from '../telemetry';
export type Commands = 'gitlens.closeUnchangedFiles' |
export type Commands =
'gitlens.clearFileAnnotations' |
'gitlens.closeUnchangedFiles' |
'gitlens.copyMessageToClipboard' |
'gitlens.copyShaToClipboard' |
'gitlens.diffDirectory' |
@@ -43,6 +45,7 @@ export type Commands = 'gitlens.closeUnchangedFiles' |
'gitlens.toggleFileRecentChanges' |
'gitlens.toggleLineBlame';
export const Commands = {
ClearFileAnnotations: 'gitlens.clearFileAnnotations' as Commands,
CloseUnchangedFiles: 'gitlens.closeUnchangedFiles' as Commands,
CopyMessageToClipboard: 'gitlens.copyMessageToClipboard' as Commands,
CopyShaToClipboard: 'gitlens.copyShaToClipboard' as Commands,

View File

@@ -17,7 +17,7 @@ export class ShowFileBlameCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ShowFileBlameCommandArgs = {}): Promise<any> {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
if (args.type === undefined) {

View File

@@ -16,7 +16,7 @@ export class ShowLineBlameCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ShowLineBlameCommandArgs = {}): Promise<any> {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
if (args.type === undefined) {

View File

@@ -17,7 +17,7 @@ export class ToggleFileBlameCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ToggleFileBlameCommandArgs = {}): Promise<any> {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
if (args.type === undefined) {

View File

@@ -11,7 +11,7 @@ export class ToggleFileRecentChangesCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri): Promise<any> {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
return this.annotationController.toggleAnnotations(editor, FileAnnotationType.RecentChanges);

View File

@@ -16,7 +16,7 @@ export class ToggleLineBlameCommand extends EditorCommand {
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, args: ToggleLineBlameCommandArgs = {}): Promise<any> {
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
if (editor === undefined || editor.document === undefined || editor.document.isDirty) return undefined;
try {
if (args.type === undefined) {