mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Adds ability to esc out of file annotations
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
18
package.json
18
package.json
@@ -1228,82 +1228,74 @@
|
|||||||
"key": "alt+.",
|
"key": "alt+.",
|
||||||
"when": "gitlens:key:."
|
"when": "gitlens:key:."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"command": "gitlens.key.escape",
|
||||||
|
"key": "escape",
|
||||||
|
"when": "gitlens:key:escape"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.toggleFileBlame",
|
"command": "gitlens.toggleFileBlame",
|
||||||
"key": "alt+b",
|
"key": "alt+b",
|
||||||
"mac": "alt+b",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.toggleCodeLens",
|
"command": "gitlens.toggleCodeLens",
|
||||||
"key": "shift+alt+b",
|
"key": "shift+alt+b",
|
||||||
"mac": "shift+alt+b",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked && gitlens:canToggleCodeLens"
|
"when": "editorTextFocus && gitlens:isTracked && gitlens:canToggleCodeLens"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showLastQuickPick",
|
"command": "gitlens.showLastQuickPick",
|
||||||
"key": "alt+-",
|
"key": "alt+-",
|
||||||
"mac": "alt+-",
|
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showCommitSearch",
|
"command": "gitlens.showCommitSearch",
|
||||||
"key": "alt+/",
|
"key": "alt+/",
|
||||||
"mac": "alt+/",
|
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickFileHistory",
|
"command": "gitlens.showQuickFileHistory",
|
||||||
"key": "alt+h",
|
"key": "alt+h",
|
||||||
"mac": "alt+h",
|
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickRepoHistory",
|
"command": "gitlens.showQuickRepoHistory",
|
||||||
"key": "shift+alt+h",
|
"key": "shift+alt+h",
|
||||||
"mac": "shift+alt+h",
|
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickRepoStatus",
|
"command": "gitlens.showQuickRepoStatus",
|
||||||
"key": "alt+s",
|
"key": "alt+s",
|
||||||
"mac": "alt+s",
|
|
||||||
"when": "gitlens:enabled"
|
"when": "gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.showQuickCommitFileDetails",
|
"command": "gitlens.showQuickCommitFileDetails",
|
||||||
"key": "alt+c",
|
"key": "alt+c",
|
||||||
"mac": "alt+c",
|
|
||||||
"when": "editorTextFocus && gitlens:enabled"
|
"when": "editorTextFocus && gitlens:enabled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.diffWithNext",
|
"command": "gitlens.diffWithNext",
|
||||||
"key": "alt+.",
|
"key": "alt+.",
|
||||||
"mac": "alt+.",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.diffLineWithPrevious",
|
"command": "gitlens.diffLineWithPrevious",
|
||||||
"key": "shift+alt+,",
|
"key": "shift+alt+,",
|
||||||
"mac": "shift+alt+,",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.diffWithPrevious",
|
"command": "gitlens.diffWithPrevious",
|
||||||
"key": "alt+,",
|
"key": "alt+,",
|
||||||
"mac": "alt+,",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.diffLineWithWorking",
|
"command": "gitlens.diffLineWithWorking",
|
||||||
"key": "alt+w",
|
"key": "alt+w",
|
||||||
"mac": "alt+w",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "gitlens.diffWithWorking",
|
"command": "gitlens.diffWithWorking",
|
||||||
"key": "shift+alt+w",
|
"key": "shift+alt+w",
|
||||||
"mac": "shift+alt+w",
|
|
||||||
"when": "editorTextFocus && gitlens:isTracked"
|
"when": "editorTextFocus && gitlens:isTracked"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -1,23 +1,26 @@
|
|||||||
'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';
|
|
||||||
|
|
||||||
const keyNoopCommand = Object.create(null) as QuickPickItem;
|
export declare interface KeyCommand {
|
||||||
|
onDidPressKey?(key: Keys): Promise<{} | undefined>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyNoopCommand = Object.create(null) as KeyCommand;
|
||||||
export { keyNoopCommand as KeyNoopCommand };
|
export { keyNoopCommand as KeyNoopCommand };
|
||||||
|
|
||||||
export declare type Keys = 'left' | 'right' | ',' | '.';
|
export declare type Keys = 'left' | 'right' | ',' | '.' | 'escape';
|
||||||
export const keys: Keys[] = [
|
export const keys: Keys[] = [
|
||||||
'left',
|
'left',
|
||||||
'right',
|
'right',
|
||||||
',',
|
',',
|
||||||
'.'
|
'.',
|
||||||
|
'escape'
|
||||||
];
|
];
|
||||||
|
|
||||||
export declare interface KeyMapping {
|
export declare interface KeyMapping {
|
||||||
[id: string]: (QuickPickItem | (() => Promise<QuickPickItem>) | undefined);
|
[id: string]: (KeyCommand | (() => Promise<KeyCommand>) | undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mappings: KeyMapping[] = [];
|
const mappings: KeyMapping[] = [];
|
||||||
@@ -61,7 +64,7 @@ export class KeyboardScope extends Disposable {
|
|||||||
await setCommandContext(`${CommandContext.Key}:${key}`, false);
|
await setCommandContext(`${CommandContext.Key}:${key}`, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async setKeyCommand(key: Keys, command: QuickPickItem | (() => Promise<QuickPickItem>)) {
|
async setKeyCommand(key: Keys, command: KeyCommand | (() => Promise<KeyCommand>)) {
|
||||||
const mapping = mappings[mappings.length - 1];
|
const mapping = mappings[mappings.length - 1];
|
||||||
if (mapping !== this.mapping) return;
|
if (mapping !== this.mapping) return;
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ export class Keyboard extends Disposable {
|
|||||||
try {
|
try {
|
||||||
const mapping = mappings[mappings.length - 1];
|
const mapping = mappings[mappings.length - 1];
|
||||||
|
|
||||||
let command = mapping[key] as QuickPickItem | (() => Promise<QuickPickItem>);
|
let command = mapping[key] as KeyCommand | (() => Promise<KeyCommand>);
|
||||||
if (typeof command === 'function') {
|
if (typeof command === 'function') {
|
||||||
command = await command();
|
command = await command();
|
||||||
}
|
}
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user