Browse Source

Removes Directive namespace

main
Eric Amodio 1 year ago
parent
commit
c8f6cc84d6
3 changed files with 6 additions and 8 deletions
  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 View File

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

+ 2
- 2
src/commands/quickCommand.ts View File

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

+ 2
- 4
src/quickpicks/items/directive.ts View File

@ -13,10 +13,8 @@ export enum Directive {
StartPreviewTrial, 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 { export interface DirectiveQuickPickItem extends QuickPickItem {

Loading…
Cancel
Save