Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
josephinoo committed Feb 21, 2024
1 parent c22544f commit 4f4b035
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
{
"command": "asyncapi.paste",
"title": "AsyncAPI: Paste as Schema"
},
{
"command": "asyncapi.hello",
"title": "Hello AsyncAPI"
}
],
"snippets": [
Expand Down
6 changes: 5 additions & 1 deletion src/PreviewWebPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function openAsyncAPI(context: vscode.ExtensionContext, uri: vscode.Uri)

panel.title = path.basename(uri.fsPath);
panel.webview.html = getWebviewContent(context, panel.webview, uri, position);

panel.webview.onDidReceiveMessage(
message => {
switch (message.type) {
Expand Down Expand Up @@ -95,6 +95,10 @@ async function promptForAsyncapiFile() {
});
return uris?.[0];
}
export function printHello() {
console.log('Hello');
}


function getWebviewContent(context: vscode.ExtensionContext, webview: vscode.Webview, asyncapiFile: vscode.Uri, position: {x:0,y:0}) {
const asyncapiComponentJs = webview.asWebviewUri(
Expand Down
4 changes: 3 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { isAsyncAPIFile, openAsyncAPI, openAsyncapiFiles, previewAsyncAPI } from './PreviewWebPanel';
import { isAsyncAPIFile, openAsyncAPI, openAsyncapiFiles, previewAsyncAPI, printHello } from './PreviewWebPanel';
import { asyncapiSmartPaste } from './SmartPasteCommand';


Expand Down Expand Up @@ -37,6 +37,8 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('asyncapi.preview', previewAsyncAPI(context)));

context.subscriptions.push(vscode.commands.registerCommand("asyncapi.paste", asyncapiSmartPaste));

context.subscriptions.push(vscode.commands.registerCommand('asyncapi.hello', printHello ));
}

export function deactivate() {}

0 comments on commit 4f4b035

Please sign in to comment.