Skip to content

Commit 7db7f44

Browse files
committed
Adds Uris command context (for multi-select)
1 parent 5a794d4 commit 7db7f44

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/commands/common.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ export interface CommandUriContext extends CommandBaseContext {
220220
type: 'uri';
221221
}
222222

223+
export interface CommandUrisContext extends CommandBaseContext {
224+
type: 'uris';
225+
uris: Uri[];
226+
}
227+
223228
// export interface CommandViewContext extends CommandBaseContext {
224229
// type: 'view';
225230
// }
@@ -326,6 +331,7 @@ export type CommandContext =
326331
| CommandScmStatesContext
327332
| CommandUnknownContext
328333
| CommandUriContext
334+
| CommandUrisContext
329335
// | CommandViewContext
330336
| CommandViewItemContext;
331337

@@ -415,6 +421,10 @@ export abstract class Command implements Disposable {
415421
if (options.uri && (firstArg == null || firstArg instanceof Uri)) {
416422
const [uri, ...rest] = args as [Uri, any];
417423
if (uri !== undefined) {
424+
const uris = rest[0];
425+
if (uris != null && Array.isArray(uris) && uris.length !== 0 && uris[0] instanceof Uri) {
426+
return [{ command: command, type: 'uris', editor: editor, uri: uri, uris: uris }, rest.slice(1)];
427+
}
418428
return [{ command: command, type: 'uri', editor: editor, uri: uri }, rest];
419429
}
420430

0 commit comments

Comments
 (0)