From 7db7f447986fcba9b7be4a77f1b22f2b561c2cc7 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 23 May 2019 14:32:40 -0400 Subject: [PATCH] Adds Uris command context (for multi-select) --- src/commands/common.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/commands/common.ts b/src/commands/common.ts index d0660f3..d54690c 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -220,6 +220,11 @@ export interface CommandUriContext extends CommandBaseContext { type: 'uri'; } +export interface CommandUrisContext extends CommandBaseContext { + type: 'uris'; + uris: Uri[]; +} + // export interface CommandViewContext extends CommandBaseContext { // type: 'view'; // } @@ -326,6 +331,7 @@ export type CommandContext = | CommandScmStatesContext | CommandUnknownContext | CommandUriContext + | CommandUrisContext // | CommandViewContext | CommandViewItemContext; @@ -415,6 +421,10 @@ export abstract class Command implements Disposable { if (options.uri && (firstArg == null || firstArg instanceof Uri)) { const [uri, ...rest] = args as [Uri, any]; if (uri !== undefined) { + const uris = rest[0]; + if (uris != null && Array.isArray(uris) && uris.length !== 0 && uris[0] instanceof Uri) { + return [{ command: command, type: 'uris', editor: editor, uri: uri, uris: uris }, rest.slice(1)]; + } return [{ command: command, type: 'uri', editor: editor, uri: uri }, rest]; }