Consolidates setContext into commands

Adds context for toggling CodeLens
This commit is contained in:
Eric Amodio
2017-03-10 12:37:20 -05:00
parent 88c09bec6d
commit 0480477136
6 changed files with 36 additions and 16 deletions

View File

@@ -1,4 +1,7 @@
'use strict';
import { commands } from 'vscode';
import { BuiltInCommands } from './constants';
export { Keyboard } from './commands/keyboard';
export { ActiveEditorCommand, Command, Commands, EditorCommand, openEditor } from './commands/commands';
@@ -20,4 +23,17 @@ export { ShowQuickFileHistoryCommand } from './commands/showQuickFileHistory';
export { ShowQuickRepoHistoryCommand } from './commands/showQuickRepoHistory';
export { ShowQuickRepoStatusCommand } from './commands/showQuickRepoStatus';
export { ToggleBlameCommand } from './commands/toggleBlame';
export { ToggleCodeLensCommand } from './commands/toggleCodeLens';
export { ToggleCodeLensCommand } from './commands/toggleCodeLens';
export type CommandContext = 'gitlens:canToggleCodeLens' | 'gitlens:enabled' | 'gitlens:isBlameable' | 'gitlens:key';
export const CommandContext = {
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
Enabled: 'gitlens:enabled' as CommandContext,
IsBlameable: 'gitlens:isBlameable' as CommandContext,
Key: 'gitlens:key' as CommandContext
};
export function setCommandContext(key: CommandContext, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
}