Переглянути джерело

Moves Keys into constants

main
Eric Amodio 1 рік тому
джерело
коміт
d6cdd00b5d
8 змінених файлів з 26 додано та 24 видалено
  1. +1
    -1
      src/commands/quickCommand.ts
  2. +16
    -1
      src/constants.ts
  3. +2
    -1
      src/quickpicks/commitPicker.ts
  4. +1
    -1
      src/quickpicks/items/commits.ts
  5. +1
    -2
      src/quickpicks/items/common.ts
  6. +2
    -1
      src/quickpicks/referencePicker.ts
  7. +1
    -1
      src/quickpicks/remoteProviderPicker.ts
  8. +2
    -16
      src/system/keyboard.ts

+ 1
- 1
src/commands/quickCommand.ts Переглянути файл

@ -1,9 +1,9 @@
import type { InputBox, QuickInputButton, QuickPick, QuickPickItem } from 'vscode';
import type { Keys } from '../constants';
import type { Container } from '../container';
import type { DirectiveQuickPickItem } from '../quickpicks/items/directive';
import { createDirectiveQuickPickItem, Directive, isDirective } from '../quickpicks/items/directive';
import { configuration } from '../system/configuration';
import type { Keys } from '../system/keyboard';
export * from './quickCommand.buttons';
export * from './quickCommand.steps';

+ 16
- 1
src/constants.ts Переглянути файл

@ -306,7 +306,7 @@ export type WebviewViewIds = 'commitDetails' | 'graph' | 'home' | 'timeline';
export type ContextKeys =
| `${typeof extensionPrefix}:action:${string}`
| `${typeof extensionPrefix}:key:${string}`
| `${typeof extensionPrefix}:key:${Keys}`
| `${typeof extensionPrefix}:webview:${WebviewIds | CustomEditorIds}:${'active' | 'focus' | 'inputFocus'}`
| `${typeof extensionPrefix}:webviewView:${WebviewViewIds}:${'active' | 'focus' | 'inputFocus'}`
| `${typeof extensionPrefix}:activeFileStatus`
@ -443,6 +443,21 @@ export const enum GlyphChars {
ZeroWidthSpace = '\u200b',
}
export const keys = [
'left',
'alt+left',
'ctrl+left',
'right',
'alt+right',
'ctrl+right',
'alt+,',
'alt+.',
'alt+enter',
'ctrl+enter',
'escape',
] as const;
export type Keys = (typeof keys)[number];
export const enum Schemes {
DebugConsole = 'debug',
File = 'file',

+ 2
- 1
src/quickpicks/commitPicker.ts Переглянути файл

@ -1,12 +1,13 @@
import type { Disposable } from 'vscode';
import { window } from 'vscode';
import type { Keys } from '../constants';
import { Container } from '../container';
import type { GitCommit, GitStashCommit } from '../git/models/commit';
import type { GitLog } from '../git/models/log';
import type { GitStash } from '../git/models/stash';
import { configuration } from '../system/configuration';
import { filter, map } from '../system/iterable';
import type { KeyboardScope, Keys } from '../system/keyboard';
import type { KeyboardScope } from '../system/keyboard';
import { isPromise } from '../system/promise';
import { getQuickPickIgnoreFocusOut } from '../system/utils';
import { CommandQuickPickItem } from './items/common';

+ 1
- 1
src/quickpicks/items/commits.ts Переглянути файл

@ -2,6 +2,7 @@ import type { QuickPickItem } from 'vscode';
import { window } from 'vscode';
import type { OpenChangedFilesCommandArgs } from '../../commands/openChangedFiles';
import { RevealInSideBarQuickInputButton, ShowDetailsViewQuickInputButton } from '../../commands/quickCommand.buttons';
import type { Keys } from '../../constants';
import { Commands, GlyphChars } from '../../constants';
import { Container } from '../../container';
import { browseAtRevision } from '../../git/actions';
@ -11,7 +12,6 @@ import type { GitCommit } from '../../git/models/commit';
import type { GitFile, GitFileChange } from '../../git/models/file';
import { getGitFileFormattedDirectory, getGitFileStatusCodicon } from '../../git/models/file';
import type { GitStatusFile } from '../../git/models/status';
import type { Keys } from '../../system/keyboard';
import { basename } from '../../system/path';
import { pad } from '../../system/string';
import { CommandQuickPickItem } from './common';

+ 1
- 2
src/quickpicks/items/common.ts Переглянути файл

@ -1,7 +1,6 @@
import type { QuickPickItem } from 'vscode';
import { commands, QuickPickItemKind } from 'vscode';
import type { Commands } from '../../constants';
import type { Keys } from '../../system/keyboard';
import type { Commands, Keys } from '../../constants';
declare module 'vscode' {
interface QuickPickItem {

+ 2
- 1
src/quickpicks/referencePicker.ts Переглянути файл

@ -5,6 +5,7 @@ import {
getValidateGitReferenceFn,
RevealInSideBarQuickInputButton,
} from '../commands/quickCommand';
import type { Keys } from '../constants';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { reveal as revealBranch } from '../git/actions/branch';
@ -14,7 +15,7 @@ import type { BranchSortOptions, GitBranch } from '../git/models/branch';
import type { GitReference } from '../git/models/reference';
import { isBranchReference, isRevisionReference, isTagReference } from '../git/models/reference';
import type { GitTag, TagSortOptions } from '../git/models/tag';
import type { KeyboardScope, Keys } from '../system/keyboard';
import type { KeyboardScope } from '../system/keyboard';
import { getQuickPickIgnoreFocusOut } from '../system/utils';
import type { BranchQuickPickItem, RefQuickPickItem, TagQuickPickItem } from './items/gitCommands';
import { createRefQuickPickItem } from './items/gitCommands';

+ 1
- 1
src/quickpicks/remoteProviderPicker.ts Переглянути файл

@ -2,6 +2,7 @@ import type { Disposable, QuickInputButton } from 'vscode';
import { env, Uri, window } from 'vscode';
import type { OpenOnRemoteCommandArgs } from '../commands';
import { SetRemoteAsDefaultQuickInputButton } from '../commands/quickCommand.buttons';
import type { Keys } from '../constants';
import { Commands, GlyphChars } from '../constants';
import { Container } from '../container';
import { getBranchNameWithoutRemote, getRemoteNameFromBranchName } from '../git/models/branch';
@ -9,7 +10,6 @@ import { GitRemote } from '../git/models/remote';
import type { RemoteResource } from '../git/models/remoteResource';
import { getNameFromRemoteResource, RemoteResourceType } from '../git/models/remoteResource';
import type { RemoteProvider } from '../git/remotes/remoteProvider';
import type { Keys } from '../system/keyboard';
import { getSettledValue } from '../system/promise';
import { getQuickPickIgnoreFocusOut } from '../system/utils';
import { CommandQuickPickItem } from './items/common';

+ 2
- 16
src/system/keyboard.ts Переглянути файл

@ -1,5 +1,6 @@
import { Disposable } from 'vscode';
import { extensionPrefix } from '../constants';
import type { Keys } from '../constants';
import { extensionPrefix, keys } from '../constants';
import { setContext } from '../context';
import { registerCommand } from './command';
import { log } from './decorators/log';
@ -13,21 +14,6 @@ export declare interface KeyCommand {
const keyNoopCommand = Object.create(null) as KeyCommand;
export { keyNoopCommand as KeyNoopCommand };
export const keys = [
'left',
'alt+left',
'ctrl+left',
'right',
'alt+right',
'ctrl+right',
'alt+,',
'alt+.',
'alt+enter',
'ctrl+enter',
'escape',
] as const;
export type Keys = (typeof keys)[number];
export type KeyMapping = { [K in Keys]?: KeyCommand | (() => Promise<KeyCommand>) };
type IndexableKeyMapping = KeyMapping & {
[index: string]: KeyCommand | (() => Promise<KeyCommand>) | undefined;

Завантаження…
Відмінити
Зберегти