Kaynağa Gözat

Removes Directive namespace

main
Eric Amodio 1 yıl önce
ebeveyn
işleme
c8f6cc84d6
3 değiştirilmiş dosya ile 6 ekleme ve 8 silme
  1. +2
    -2
      src/commands/gitCommands.ts
  2. +2
    -2
      src/commands/quickCommand.ts
  3. +2
    -4
      src/quickpicks/items/directive.ts

+ 2
- 2
src/commands/gitCommands.ts Dosyayı Görüntüle

@ -4,7 +4,7 @@ import { configuration } from '../configuration';
import { Commands } from '../constants';
import { Container } from '../container';
import type { KeyMapping } from '../keyboard';
import { Directive, DirectiveQuickPickItem } from '../quickpicks/items/directive';
import { Directive, DirectiveQuickPickItem, isDirective } from '../quickpicks/items/directive';
import { command } from '../system/command';
import { log } from '../system/decorators/log';
import type { Deferred } from '../system/promise';
@ -295,7 +295,7 @@ export class GitCommandsCommand extends Command {
const result = await step.show(step);
if (result === StepResult.Break) return undefined;
if (Directive.is(result)) {
if (isDirective(result)) {
switch (result) {
case Directive.Back:
return (await commandsStep?.command?.previous()) ?? commandsStep;

+ 2
- 2
src/commands/quickCommand.ts Dosyayı Görüntüle

@ -2,7 +2,7 @@ import type { InputBox, QuickInputButton, QuickPick, QuickPickItem } from 'vscod
import { configuration } from '../configuration';
import type { Container } from '../container';
import type { Keys } from '../keyboard';
import { Directive, DirectiveQuickPickItem } from '../quickpicks/items/directive';
import { Directive, DirectiveQuickPickItem, isDirective } from '../quickpicks/items/directive';
export * from './quickCommand.buttons';
export * from './quickCommand.steps';
@ -298,7 +298,7 @@ export namespace QuickCommand {
result: Directive | StepItemType<T>,
): result is StepItemType<T> {
if (result == null) return false;
if (Directive.is(result)) {
if (isDirective(result)) {
switch (result) {
case Directive.Back:
state.counter--;

+ 2
- 4
src/quickpicks/items/directive.ts Dosyayı Görüntüle

@ -13,10 +13,8 @@ export enum Directive {
StartPreviewTrial,
}
export namespace Directive {
export function is<T>(value: Directive | T): value is Directive {
return typeof value === 'number' && Directive[value] != null;
}
export function isDirective<T>(value: Directive | T): value is Directive {
return typeof value === 'number' && Directive[value] != null;
}
export interface DirectiveQuickPickItem extends QuickPickItem {

Yükleniyor…
İptal
Kaydet