Skip to content

Commit 79df80d

Browse files
committed
feat: enable it to open multiple files
1 parent ab0a907 commit 79df80d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/extension.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class OpenController implements vscode.Disposable {
1919
constructor() {
2020

2121
const subscriptions: vscode.Disposable[] = [];
22-
const disposable = vscode.commands.registerCommand('workbench.action.files.openFileWithDefaultApplication', (uri: vscode.Uri | undefined) => {
23-
this.open(uri);
22+
const disposable = vscode.commands.registerCommand('workbench.action.files.openFileWithDefaultApplication', (uri: vscode.Uri | undefined, uris: vscode.Uri[] | undefined) => {
23+
this.open(uri, uris);
2424
});
2525
subscriptions.push(disposable);
2626

@@ -48,7 +48,16 @@ class OpenController implements vscode.Disposable {
4848
this._disposable.dispose();
4949
}
5050

51-
private open(uri: vscode.Uri | undefined): void {
51+
private open(uri: vscode.Uri | undefined, uris: vscode.Uri[] | undefined): void {
52+
if (uris && uris.some((uri) => uri?.scheme)) {
53+
uris
54+
.filter((uri) => uri?.scheme)
55+
.forEach((uri) => {
56+
console.log("Opening from uris", uri.toString());
57+
this.openFile(uri.toString());
58+
});
59+
return;
60+
}
5261

5362
if (uri?.scheme) {
5463
console.log("Opening from uri", uri.toString());

0 commit comments

Comments
 (0)