Files
vscode-gitlens/src/commands/clearFileAnnotations.ts
Eric Amodio 00cdd2e375 Adds "on" state to file annotation command
Adds "progress" state to file annotation command
2017-08-15 01:35:50 -04:00

24 lines
951 B
TypeScript

'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`);
}
}
}