Skip to content

Commit 6feb87f

Browse files
authored
fix: return one single file when prompting for AsyncAPI files #146 (#150)
1 parent d8a93e7 commit 6feb87f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/PreviewWebPanel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function promptForAsyncapiFile() {
6262
if (isAsyncAPIFile(vscode.window.activeTextEditor?.document)) {
6363
return vscode.window.activeTextEditor?.document.uri;
6464
}
65-
return await vscode.window.showOpenDialog({
65+
const uris = await vscode.window.showOpenDialog({
6666
canSelectFiles: true,
6767
canSelectFolders: false,
6868
canSelectMany: false,
@@ -71,6 +71,7 @@ async function promptForAsyncapiFile() {
7171
AsyncAPI: ['yml', 'yaml', 'json'],
7272
},
7373
});
74+
return uris?.[0];
7475
}
7576

7677
function getWebviewContent(context: vscode.ExtensionContext, webview: vscode.Webview, asyncapiFile: vscode.Uri) {

src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export function activate(context: vscode.ExtensionContext) {
2828
console.log('Reloading asyncapi file', document.uri.fsPath);
2929
openAsyncAPI(context, document.uri);
3030
}
31+
if (vscode.window.activeTextEditor?.document) {
32+
setAsyncAPIPreviewContext(vscode.window.activeTextEditor.document);
33+
}
3134
});
3235

3336

0 commit comments

Comments
 (0)