mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-22 01:35:38 -05:00
Adds "on" state to file annotation command
Adds "progress" state to file annotation command
This commit is contained in:
24
src/commands/clearFileAnnotations.ts
Normal file
24
src/commands/clearFileAnnotations.ts
Normal 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`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user