Adds ability to esc out of file annotations

This commit is contained in:
Eric Amodio
2017-06-13 01:31:13 -04:00
parent a2903ce4a9
commit a618b7efe6
19 changed files with 1551 additions and 1528 deletions

View File

@@ -9,8 +9,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Adds all-new recent changes annotations of the whole-file - annotates and highlights all of lines changed in the most recent commit - Adds all-new recent changes annotations of the whole-file - annotates and highlights all of lines changed in the most recent commit
- Can customize the [layout](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens#file-recent-changes-annotation-settings), as well as the [theme](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens#theme-settings) - Can customize the [layout](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens#file-recent-changes-annotation-settings), as well as the [theme](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens#theme-settings)
- Adds `Toggle Recent File Changes Annotations` command (`gitlens.toggleFileRecentChanges`) - toggles the recent changes annotations on and off - Adds `Toggle Recent File Changes Annotations` command (`gitlens.toggleFileRecentChanges`) - toggles the recent changes annotations on and off
- Adds ability to press `Escape` to quickly toggle any whole-file annotations off
- Improves performance - Improves performance
- Optimized git output parsing to increase speed and reduce memory usage - Optimized git output parsing to increase speed and dramatically reduce memory usage
- Defers diff chunk parsing until it is actually required - Defers diff chunk parsing until it is actually required
- Adds `gitlens.defaultDateFormat` setting to specify how all absolute dates will be formatted by default - Adds `gitlens.defaultDateFormat` setting to specify how all absolute dates will be formatted by default

View File

@@ -33,6 +33,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Adds a `details` hover annotation to the line's annotation, which provides more commit details ([optional](#file-blame-annotation-settings), on by default) - Adds a `details` hover annotation to the line's annotation, which provides more commit details ([optional](#file-blame-annotation-settings), on by default)
- Adds a `heatmap` (age) indicator to the gutter annotations (on right edge by [default](#file-blame-annotation-settings)), which provides an easy, at-a-glance way to tell the age of a line ([optional](#file-blame-annotation-settings), on by default) - Adds a `heatmap` (age) indicator to the gutter annotations (on right edge by [default](#file-blame-annotation-settings)), which provides an easy, at-a-glance way to tell the age of a line ([optional](#file-blame-annotation-settings), on by default)
- Indicator ranges from bright yellow (newer) to dark brown (older) - Indicator ranges from bright yellow (newer) to dark brown (older)
- Press `Escape` to quickly toggle the annotations off
- Adds [customizable](#status-bar-settings) **blame information** about the current line to the **status bar** ([optional](#status-bar-settings), on by default) - Adds [customizable](#status-bar-settings) **blame information** about the current line to the **status bar** ([optional](#status-bar-settings), on by default)
@@ -61,6 +62,7 @@ GitLens provides an unobtrusive blame annotation at the end of the current line,
- Highlights all of lines changed in the most recent commit - Highlights all of lines changed in the most recent commit
- Adds a `details` hover annotation to each line, which provides more commit details ([optional](#file-blame-annotation-settings), on by default) - Adds a `details` hover annotation to each line, which provides more commit details ([optional](#file-blame-annotation-settings), on by default)
- Adds a `changes` (diff) hover annotation to each line, which provides **instant** access to the line's previous version ([optional](#file-recent-changes-annotation-settings), on by default) - Adds a `changes` (diff) hover annotation to each line, which provides **instant** access to the line's previous version ([optional](#file-recent-changes-annotation-settings), on by default)
- Press `Escape` to quickly toggle the annotations off
- Adds `Toggle Recent File Changes Annotations` command (`gitlens.toggleFileRecentChanges`) to toggle the recent changes annotations on and off - Adds `Toggle Recent File Changes Annotations` command (`gitlens.toggleFileRecentChanges`) to toggle the recent changes annotations on and off

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
import { Functions, Objects } from '../system'; import { Functions, Objects } from '../system';
import { DecorationRenderOptions, Disposable, Event, EventEmitter, ExtensionContext, OverviewRulerLane, TextDocument, TextDocumentChangeEvent, TextEditor, TextEditorDecorationType, TextEditorViewColumnChangeEvent, window, workspace } from 'vscode'; import { DecorationRenderOptions, Disposable, Event, EventEmitter, ExtensionContext, OverviewRulerLane, TextDocument, TextDocumentChangeEvent, TextEditor, TextEditorDecorationType, TextEditorViewColumnChangeEvent, window, workspace } from 'vscode';
import { AnnotationProviderBase } from './annotationProvider'; import { AnnotationProviderBase } from './annotationProvider';
import { Keyboard, KeyboardScope, KeyCommand, Keys } from '../keyboard';
import { TextDocumentComparer, TextEditorComparer } from '../comparers'; import { TextDocumentComparer, TextEditorComparer } from '../comparers';
import { ExtensionKey, IConfig, LineHighlightLocations, themeDefaults } from '../configuration'; import { ExtensionKey, IConfig, LineHighlightLocations, themeDefaults } from '../configuration';
import { BlameabilityChangeEvent, GitContextTracker, GitService, GitUri } from '../gitService'; import { BlameabilityChangeEvent, GitContextTracker, GitService, GitUri } from '../gitService';
@@ -193,13 +194,17 @@ export class AnnotationController extends Disposable {
async clear(column: number) { async clear(column: number) {
const provider = this._annotationProviders.get(column); const provider = this._annotationProviders.get(column);
if (!provider) return; if (provider === undefined) return;
this._annotationProviders.delete(column); this._annotationProviders.delete(column);
await provider.dispose(); await provider.dispose();
if (this._annotationProviders.size === 0) { if (this._annotationProviders.size === 0) {
Logger.log(`Remove listener registrations for annotations`); Logger.log(`Remove listener registrations for annotations`);
this._keyboardScope && this._keyboardScope.dispose();
this._keyboardScope = undefined;
this._annotationsDisposable && this._annotationsDisposable.dispose(); this._annotationsDisposable && this._annotationsDisposable.dispose();
this._annotationsDisposable = undefined; this._annotationsDisposable = undefined;
} }
@@ -207,17 +212,19 @@ export class AnnotationController extends Disposable {
this._onDidToggleAnnotations.fire(); this._onDidToggleAnnotations.fire();
} }
getAnnotationType(editor: TextEditor): FileAnnotationType | undefined { getAnnotationType(editor: TextEditor | undefined): FileAnnotationType | undefined {
const provider = this.getProvider(editor); const provider = this.getProvider(editor);
return provider === undefined ? undefined : provider.annotationType; return provider === undefined ? undefined : provider.annotationType;
} }
getProvider(editor: TextEditor): AnnotationProviderBase | undefined { getProvider(editor: TextEditor | undefined): AnnotationProviderBase | undefined {
if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return undefined; if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return undefined;
return this._annotationProviders.get(editor.viewColumn || -1); return this._annotationProviders.get(editor.viewColumn || -1);
} }
private _keyboardScope: KeyboardScope | undefined = undefined;
async showAnnotations(editor: TextEditor, type: FileAnnotationType, shaOrLine?: string | number): Promise<boolean> { async showAnnotations(editor: TextEditor, type: FileAnnotationType, shaOrLine?: string | number): Promise<boolean> {
if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return false; if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return false;
@@ -227,6 +234,21 @@ export class AnnotationController extends Disposable {
return true; return true;
} }
// Allows pressing escape to exit the annotations
if (this._keyboardScope === undefined) {
this._keyboardScope = await Keyboard.instance.beginScope({
escape: {
onDidPressKey: (key: Keys) => {
const editor = window.activeTextEditor;
if (editor === undefined) return Promise.resolve(undefined);
this.clear(editor.viewColumn || -1);
return Promise.resolve(undefined);
}
} as KeyCommand
});
}
const gitUri = await GitUri.fromUri(editor.document.uri, this.git); const gitUri = await GitUri.fromUri(editor.document.uri, this.git);
let provider: AnnotationProviderBase | undefined = undefined; let provider: AnnotationProviderBase | undefined = undefined;

View File

@@ -1,8 +1,6 @@
'use strict'; 'use strict';
export * from './commands/common'; export * from './commands/common';
export * from './commands/keyboard';
export * from './commands/closeUnchangedFiles'; export * from './commands/closeUnchangedFiles';
export * from './commands/copyMessageToClipboard'; export * from './commands/copyMessageToClipboard';
export * from './commands/copyShaToClipboard'; export * from './commands/copyShaToClipboard';

View File

@@ -1,6 +1,5 @@
'use strict'; 'use strict';
import { commands, Disposable, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode'; import { commands, Disposable, TextDocumentShowOptions, TextEditor, TextEditorEdit, Uri, window, workspace } from 'vscode';
import { BuiltInCommands } from '../constants';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { Telemetry } from '../telemetry'; import { Telemetry } from '../telemetry';
@@ -87,27 +86,6 @@ export function getCommandUri(uri?: Uri, editor?: TextEditor): Uri | undefined {
return editor.document.uri; return editor.document.uri;
} }
export type CommandContext = 'gitlens:canToggleCodeLens' |
'gitlens:enabled' |
'gitlens:hasRemotes' |
'gitlens:isBlameable' |
'gitlens:isRepository' |
'gitlens:isTracked' |
'gitlens:key';
export const CommandContext = {
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
Enabled: 'gitlens:enabled' as CommandContext,
HasRemotes: 'gitlens:hasRemotes' as CommandContext,
IsBlameable: 'gitlens:isBlameable' as CommandContext,
IsRepository: 'gitlens:isRepository' as CommandContext,
IsTracked: 'gitlens:isTracked' as CommandContext,
Key: 'gitlens:key' as CommandContext
};
export function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
}
export abstract class Command extends Disposable { export abstract class Command extends Disposable {
private _disposable: Disposable; private _disposable: Disposable;

View File

@@ -1,4 +1,5 @@
'use strict'; 'use strict';
import { commands } from 'vscode';
export const ExtensionId = 'gitlens'; export const ExtensionId = 'gitlens';
export const ExtensionKey = ExtensionId; export const ExtensionKey = ExtensionId;
@@ -38,6 +39,27 @@ export const BuiltInCommands = {
ToggleRenderWhitespace: 'editor.action.toggleRenderWhitespace' as BuiltInCommands ToggleRenderWhitespace: 'editor.action.toggleRenderWhitespace' as BuiltInCommands
}; };
export type CommandContext = 'gitlens:canToggleCodeLens' |
'gitlens:enabled' |
'gitlens:hasRemotes' |
'gitlens:isBlameable' |
'gitlens:isRepository' |
'gitlens:isTracked' |
'gitlens:key';
export const CommandContext = {
CanToggleCodeLens: 'gitlens:canToggleCodeLens' as CommandContext,
Enabled: 'gitlens:enabled' as CommandContext,
HasRemotes: 'gitlens:hasRemotes' as CommandContext,
IsBlameable: 'gitlens:isBlameable' as CommandContext,
IsRepository: 'gitlens:isRepository' as CommandContext,
IsTracked: 'gitlens:isTracked' as CommandContext,
Key: 'gitlens:key' as CommandContext
};
export function setCommandContext(key: CommandContext | string, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value);
}
export type DocumentSchemes = 'file' | 'git' | 'gitlens-git'; export type DocumentSchemes = 'file' | 'git' | 'gitlens-git';
export const DocumentSchemes = { export const DocumentSchemes = {
File: 'file' as DocumentSchemes, File: 'file' as DocumentSchemes,

View File

@@ -2,7 +2,6 @@
// import { Objects } from './system'; // import { Objects } from './system';
import { ExtensionContext, extensions, languages, window, workspace } from 'vscode'; import { ExtensionContext, extensions, languages, window, workspace } from 'vscode';
import { AnnotationController } from './annotations/annotationController'; import { AnnotationController } from './annotations/annotationController';
import { CommandContext, setCommandContext } from './commands';
import { CloseUnchangedFilesCommand, OpenChangedFilesCommand } from './commands'; import { CloseUnchangedFilesCommand, OpenChangedFilesCommand } from './commands';
import { OpenBranchInRemoteCommand, OpenCommitInRemoteCommand, OpenFileInRemoteCommand, OpenInRemoteCommand, OpenRepoInRemoteCommand } from './commands'; import { OpenBranchInRemoteCommand, OpenCommitInRemoteCommand, OpenFileInRemoteCommand, OpenInRemoteCommand, OpenRepoInRemoteCommand } from './commands';
import { CopyMessageToClipboardCommand, CopyShaToClipboardCommand } from './commands'; import { CopyMessageToClipboardCommand, CopyShaToClipboardCommand } from './commands';
@@ -16,13 +15,13 @@ import { ShowCommitSearchCommand, ShowQuickCommitDetailsCommand, ShowQuickCommit
import { ShowQuickRepoStatusCommand, ShowQuickStashListCommand } from './commands'; import { ShowQuickRepoStatusCommand, ShowQuickStashListCommand } from './commands';
import { StashApplyCommand, StashDeleteCommand, StashSaveCommand } from './commands'; import { StashApplyCommand, StashDeleteCommand, StashSaveCommand } from './commands';
import { ToggleCodeLensCommand } from './commands'; import { ToggleCodeLensCommand } from './commands';
import { Keyboard } from './commands';
import { CodeLensLocations, IConfig, LineHighlightLocations } from './configuration'; import { CodeLensLocations, IConfig, LineHighlightLocations } from './configuration';
import { ApplicationInsightsKey, ExtensionKey, QualifiedExtensionId, WorkspaceState } from './constants'; import { ApplicationInsightsKey, CommandContext, ExtensionKey, QualifiedExtensionId, setCommandContext, WorkspaceState } from './constants';
import { CurrentLineController, LineAnnotationType } from './currentLineController'; import { CurrentLineController, LineAnnotationType } from './currentLineController';
import { GitContentProvider } from './gitContentProvider'; import { GitContentProvider } from './gitContentProvider';
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider'; import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
import { GitContextTracker, GitService } from './gitService'; import { GitContextTracker, GitService } from './gitService';
import { Keyboard } from './keyboard';
import { Logger } from './logger'; import { Logger } from './logger';
import { Messages, SuppressedKeys } from './messages'; import { Messages, SuppressedKeys } from './messages';
import { Telemetry } from './telemetry'; import { Telemetry } from './telemetry';

View File

@@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { Disposable, Event, EventEmitter, TextDocument, TextDocumentChangeEvent, TextEditor, window, workspace } from 'vscode'; import { Disposable, Event, EventEmitter, TextDocument, TextDocumentChangeEvent, TextEditor, window, workspace } from 'vscode';
import { CommandContext, setCommandContext } from '../commands';
import { TextDocumentComparer } from '../comparers'; import { TextDocumentComparer } from '../comparers';
import { CommandContext, setCommandContext } from '../constants';
import { GitService, GitUri } from '../gitService'; import { GitService, GitUri } from '../gitService';
import { Logger } from '../logger'; import { Logger } from '../logger';

View File

@@ -1,9 +1,8 @@
'use strict'; 'use strict';
import { Iterables, Objects } from './system'; import { Iterables, Objects } from './system';
import { Disposable, Event, EventEmitter, ExtensionContext, FileSystemWatcher, languages, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode'; import { Disposable, Event, EventEmitter, ExtensionContext, FileSystemWatcher, languages, Location, Position, Range, TextDocument, TextDocumentChangeEvent, TextEditor, Uri, workspace } from 'vscode';
import { CommandContext, setCommandContext } from './commands';
import { IConfig } from './configuration'; import { IConfig } from './configuration';
import { DocumentSchemes, ExtensionKey } from './constants'; import { CommandContext, DocumentSchemes, ExtensionKey, setCommandContext } from './constants';
import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitCommit, GitDiff, GitDiffLine, GitDiffParser, GitLog, GitLogCommit, GitLogParser, GitRemote, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git'; import { Git, GitAuthor, GitBlame, GitBlameCommit, GitBlameLine, GitBlameLines, GitBlameParser, GitBranch, GitCommit, GitDiff, GitDiffLine, GitDiffParser, GitLog, GitLogCommit, GitLogParser, GitRemote, GitStash, GitStashParser, GitStatus, GitStatusFile, GitStatusParser, IGit, setDefaultEncoding } from './git/git';
import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri'; import { GitUri, IGitCommitInfo, IGitUriData } from './git/gitUri';
import { GitCodeLensProvider } from './gitCodeLensProvider'; import { GitCodeLensProvider } from './gitCodeLensProvider';

View File

@@ -1,140 +1,143 @@
'use strict'; 'use strict';
import { commands, Disposable } from 'vscode'; import { commands, Disposable } from 'vscode';
import { CommandContext, setCommandContext } from './common'; import { CommandContext, ExtensionKey, setCommandContext } from './constants';
import { ExtensionKey } from '../constants'; import { Logger } from './logger';
import { QuickPickItem } from '../quickPicks';
import { Logger } from '../logger'; export declare interface KeyCommand {
onDidPressKey?(key: Keys): Promise<{} | undefined>;
const keyNoopCommand = Object.create(null) as QuickPickItem; }
export { keyNoopCommand as KeyNoopCommand };
const keyNoopCommand = Object.create(null) as KeyCommand;
export declare type Keys = 'left' | 'right' | ',' | '.'; export { keyNoopCommand as KeyNoopCommand };
export const keys: Keys[] = [
'left', export declare type Keys = 'left' | 'right' | ',' | '.' | 'escape';
'right', export const keys: Keys[] = [
',', 'left',
'.' 'right',
]; ',',
'.',
export declare interface KeyMapping { 'escape'
[id: string]: (QuickPickItem | (() => Promise<QuickPickItem>) | undefined); ];
}
export declare interface KeyMapping {
const mappings: KeyMapping[] = []; [id: string]: (KeyCommand | (() => Promise<KeyCommand>) | undefined);
}
let _instance: Keyboard;
const mappings: KeyMapping[] = [];
export class KeyboardScope extends Disposable {
let _instance: Keyboard;
constructor(private mapping: KeyMapping) {
super(() => this.dispose()); export class KeyboardScope extends Disposable {
for (const key in mapping) { constructor(private mapping: KeyMapping) {
mapping[key] = mapping[key] || keyNoopCommand; super(() => this.dispose());
}
} for (const key in mapping) {
mapping[key] = mapping[key] || keyNoopCommand;
async dispose() { }
const index = mappings.indexOf(this.mapping); }
Logger.log('KeyboardScope.dispose', mappings.length, index);
if (index === (mappings.length - 1)) { async dispose() {
mappings.pop(); const index = mappings.indexOf(this.mapping);
await this.updateKeyCommandsContext(mappings[mappings.length - 1]); Logger.log('KeyboardScope.dispose', mappings.length, index);
} if (index === (mappings.length - 1)) {
else { mappings.pop();
mappings.splice(index, 1); await this.updateKeyCommandsContext(mappings[mappings.length - 1]);
} }
} else {
mappings.splice(index, 1);
async begin() { }
mappings.push(this.mapping); }
await this.updateKeyCommandsContext(this.mapping);
return this; async begin() {
} mappings.push(this.mapping);
await this.updateKeyCommandsContext(this.mapping);
async clearKeyCommand(key: Keys) { return this;
const mapping = mappings[mappings.length - 1]; }
if (mapping !== this.mapping || !mapping[key]) return;
async clearKeyCommand(key: Keys) {
Logger.log('KeyboardScope.clearKeyCommand', mappings.length, key); const mapping = mappings[mappings.length - 1];
mapping[key] = undefined; if (mapping !== this.mapping || !mapping[key]) return;
await setCommandContext(`${CommandContext.Key}:${key}`, false);
} Logger.log('KeyboardScope.clearKeyCommand', mappings.length, key);
mapping[key] = undefined;
async setKeyCommand(key: Keys, command: QuickPickItem | (() => Promise<QuickPickItem>)) { await setCommandContext(`${CommandContext.Key}:${key}`, false);
const mapping = mappings[mappings.length - 1]; }
if (mapping !== this.mapping) return;
async setKeyCommand(key: Keys, command: KeyCommand | (() => Promise<KeyCommand>)) {
Logger.log('KeyboardScope.setKeyCommand', mappings.length, key, !!mapping[key]); const mapping = mappings[mappings.length - 1];
if (mapping !== this.mapping) return;
if (!mapping[key]) {
mapping[key] = command; Logger.log('KeyboardScope.setKeyCommand', mappings.length, key, !!mapping[key]);
await setCommandContext(`${CommandContext.Key}:${key}`, true);
} if (!mapping[key]) {
else { mapping[key] = command;
mapping[key] = command; await setCommandContext(`${CommandContext.Key}:${key}`, true);
} }
} else {
mapping[key] = command;
private async updateKeyCommandsContext(mapping: KeyMapping) { }
const promises = []; }
for (const key of keys) {
promises.push(setCommandContext(`${CommandContext.Key}:${key}`, !!(mapping && mapping[key]))); private async updateKeyCommandsContext(mapping: KeyMapping) {
} const promises = [];
await Promise.all(promises); for (const key of keys) {
} promises.push(setCommandContext(`${CommandContext.Key}:${key}`, !!(mapping && mapping[key])));
} }
await Promise.all(promises);
export class Keyboard extends Disposable { }
}
static get instance(): Keyboard {
return _instance; export class Keyboard extends Disposable {
}
static get instance(): Keyboard {
private _disposable: Disposable; return _instance;
}
constructor() {
super(() => this.dispose()); private _disposable: Disposable;
const subscriptions: Disposable[] = []; constructor() {
super(() => this.dispose());
for (const key of keys) {
subscriptions.push(commands.registerCommand(`${ExtensionKey}.key.${key}`, () => this.execute(key), this)); const subscriptions: Disposable[] = [];
}
for (const key of keys) {
this._disposable = Disposable.from(...subscriptions); subscriptions.push(commands.registerCommand(`${ExtensionKey}.key.${key}`, () => this.execute(key), this));
}
_instance = this;
} this._disposable = Disposable.from(...subscriptions);
dispose() { _instance = this;
this._disposable && this._disposable.dispose(); }
}
dispose() {
async beginScope(mapping?: KeyMapping): Promise<KeyboardScope> { this._disposable && this._disposable.dispose();
Logger.log('Keyboard.beginScope', mappings.length); }
return await new KeyboardScope(mapping ? Object.assign(Object.create(null), mapping) : Object.create(null)).begin();
} async beginScope(mapping?: KeyMapping): Promise<KeyboardScope> {
Logger.log('Keyboard.beginScope', mappings.length);
async execute(key: Keys): Promise<{} | undefined> { return await new KeyboardScope(mapping ? Object.assign(Object.create(null), mapping) : Object.create(null)).begin();
if (!mappings.length) return undefined; }
try { async execute(key: Keys): Promise<{} | undefined> {
const mapping = mappings[mappings.length - 1]; if (!mappings.length) return undefined;
let command = mapping[key] as QuickPickItem | (() => Promise<QuickPickItem>); try {
if (typeof command === 'function') { const mapping = mappings[mappings.length - 1];
command = await command();
} let command = mapping[key] as KeyCommand | (() => Promise<KeyCommand>);
if (!command || typeof command.onDidPressKey !== 'function') return undefined; if (typeof command === 'function') {
command = await command();
Logger.log('Keyboard.execute', key); }
if (!command || typeof command.onDidPressKey !== 'function') return undefined;
return await command.onDidPressKey(key);
} Logger.log('Keyboard.execute', key);
catch (ex) {
Logger.error(ex, 'Keyboard.execute'); return await command.onDidPressKey(key);
return undefined; }
} catch (ex) {
} Logger.error(ex, 'Keyboard.execute');
return undefined;
}
}
} }

View File

@@ -1,9 +1,10 @@
'use strict'; 'use strict';
import { Arrays, Iterables } from '../system'; import { Arrays, Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode'; import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands'; import { Commands, ShowCommitSearchCommandArgs, ShowQuickBranchHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common'; import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GitLog, GitService, GitUri, RemoteResource } from '../gitService'; import { GitLog, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes'; import { OpenRemotesCommandQuickPickItem } from './remotes';
export class BranchHistoryQuickPick { export class BranchHistoryQuickPick {

View File

@@ -1,9 +1,10 @@
'use strict'; 'use strict';
import { Arrays, Iterables } from '../system'; import { Arrays, Iterables } from '../system';
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode'; import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, Keyboard, KeyNoopCommand, Keys, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands'; import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffDirectoryCommandCommandArgs, DiffWithPreviousCommandArgs, ShowQuickCommitDetailsCommandArgs, StashApplyCommandArgs, StashDeleteCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common'; import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem, OpenFilesCommandQuickPickItem, QuickPickItem } from './common';
import { getGitStatusIcon, GitCommit, GitLog, GitLogCommit, GitService, GitStashCommit, GitStatusFile, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitStatusFile, RemoteResource } from '../gitService'; import { getGitStatusIcon, GitCommit, GitLog, GitLogCommit, GitService, GitStashCommit, GitStatusFile, GitStatusFileStatus, GitUri, IGitCommitInfo, IGitStatusFile, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand, Keys } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes'; import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as moment from 'moment'; import * as moment from 'moment';
import * as path from 'path'; import * as path from 'path';

View File

@@ -1,9 +1,10 @@
'use strict'; 'use strict';
import { Arrays, Iterables } from '../system'; import { Arrays, Iterables } from '../system';
import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode'; import { QuickPickItem, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, Keyboard, KeyNoopCommand, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands'; import { Commands, CopyMessageToClipboardCommandArgs, CopyShaToClipboardCommandArgs, DiffWithPreviousCommandArgs, DiffWithWorkingCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common'; import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, KeyCommandQuickPickItem, OpenFileCommandQuickPickItem } from './common';
import { GitBranch, GitLog, GitLogCommit, GitService, GitUri, RemoteResource } from '../gitService'; import { GitBranch, GitLog, GitLogCommit, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes'; import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as moment from 'moment'; import * as moment from 'moment';
import * as path from 'path'; import * as path from 'path';

View File

@@ -1,8 +1,8 @@
'use strict'; 'use strict';
import { Iterables } from '../system'; import { Iterables } from '../system';
import { QuickPickOptions, window } from 'vscode'; import { QuickPickOptions, window } from 'vscode';
import { Keyboard } from '../commands';
import { GitLog, GitService } from '../gitService'; import { GitLog, GitService } from '../gitService';
import { Keyboard } from '../keyboard';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks'; import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
export class CommitsQuickPick { export class CommitsQuickPick {

View File

@@ -1,8 +1,9 @@
'use strict'; 'use strict';
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, TextEditor, Uri, window, workspace } from 'vscode'; import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, TextEditor, Uri, window, workspace } from 'vscode';
import { Commands, Keyboard, KeyboardScope, KeyMapping, Keys, openEditor } from '../commands'; import { Commands, openEditor } from '../commands';
import { ExtensionKey, IAdvancedConfig } from '../configuration'; import { ExtensionKey, IAdvancedConfig } from '../configuration';
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService'; import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
import { Keyboard, KeyboardScope, KeyMapping, Keys } from '../keyboard';
// import { Logger } from '../logger'; // import { Logger } from '../logger';
import * as moment from 'moment'; import * as moment from 'moment';

View File

@@ -1,9 +1,10 @@
'use strict'; 'use strict';
import { Arrays, Iterables } from '../system'; import { Arrays, Iterables } from '../system';
import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode'; import { CancellationTokenSource, QuickPickOptions, Uri, window } from 'vscode';
import { Commands, Keyboard, KeyNoopCommand, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands'; import { Commands, ShowQuickCurrentBranchHistoryCommandArgs, ShowQuickFileHistoryCommandArgs } from '../commands';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common'; import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut, showQuickPickProgress } from './common';
import { GitLog, GitService, GitUri, RemoteResource } from '../gitService'; import { GitLog, GitService, GitUri, RemoteResource } from '../gitService';
import { Keyboard, KeyNoopCommand } from '../keyboard';
import { OpenRemotesCommandQuickPickItem } from './remotes'; import { OpenRemotesCommandQuickPickItem } from './remotes';
import * as path from 'path'; import * as path from 'path';

View File

@@ -1,9 +1,10 @@
'use strict'; 'use strict';
import { Iterables } from '../system'; import { Iterables } from '../system';
import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode'; import { commands, QuickPickOptions, TextDocumentShowOptions, Uri, window } from 'vscode';
import { Commands, DiffWithWorkingCommandArgs, Keyboard, Keys, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands'; import { Commands, DiffWithWorkingCommandArgs, OpenChangedFilesCommandArgs, ShowQuickBranchHistoryCommandArgs, ShowQuickRepoStatusCommandArgs, ShowQuickStashListCommandArgs } from '../commands';
import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem, QuickPickItem } from './common'; import { CommandQuickPickItem, getQuickPickIgnoreFocusOut, OpenFileCommandQuickPickItem, QuickPickItem } from './common';
import { GitStatus, GitStatusFile, GitUri } from '../gitService'; import { GitStatus, GitStatusFile, GitUri } from '../gitService';
import { Keyboard, Keys } from '../keyboard';
import * as path from 'path'; import * as path from 'path';
export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem { export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPickItem {

View File

@@ -1,8 +1,9 @@
'use strict'; 'use strict';
import { Iterables } from '../system'; import { Iterables } from '../system';
import { QuickPickOptions, window } from 'vscode'; import { QuickPickOptions, window } from 'vscode';
import { Commands, Keyboard, StashSaveCommandArgs } from '../commands'; import { Commands, StashSaveCommandArgs } from '../commands';
import { GitService, GitStash } from '../gitService'; import { GitService, GitStash } from '../gitService';
import { Keyboard } from '../keyboard';
import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks'; import { CommandQuickPickItem, CommitQuickPickItem, getQuickPickIgnoreFocusOut } from '../quickPicks';
export class StashListQuickPick { export class StashListQuickPick {