diff --git a/monster-js/dist/extension.js b/monster-js/dist/extension.js index 9409a37b2434d292a0931537fefd88b305b1c573..1e0132b1e21f64969314965ff8b6c1a33742f094 100644 --- a/monster-js/dist/extension.js +++ b/monster-js/dist/extension.js @@ -34,16 +34,35 @@ __export(extension_exports, { }); module.exports = __toCommonJS(extension_exports); var vscode = __toESM(require("vscode"), 1); -var isWeb = false; -if (isWeb) { - console.log("web"); -} else { - console.log("something"); -} function activate(context) { - console.log('Congratulations, your extension "helloworld-minimal-sample" is now active!'); - let disposable = vscode.commands.registerCommand("extension.helloWorld", () => { - vscode.window.showInformationMessage("Hello World!"); + let disposable = vscode.commands.registerCommand("monster.open-doc", () => { + let documentationUrls; + vscode.env.openExternal(vscode.Uri.parse("https://monsterjs.org/en/doc/")); + const onDiskPath = vscode.Uri.joinPath(context.extensionUri, "documentation"); + documentationUrls = panel.webview.asWebviewUri(onDiskPath); + const panel = vscode.window.createWebviewPanel( + "monsterDocumentation", + // Identifies the type of the webview. Used internally + "Monster JS Documentation", + // Title of the panel displayed to the user + vscode.ViewColumn.One, + { + enableScripts: true, + localResourceRoots: [documentationUrls] + } + // Webview options. More on these later. + ); + getWebviewContent(context).then((html) => { + panel.webview.html = html; + }).catch((error) => { + console.log(error); + }); + panel.onDidDispose( + () => { + }, + null, + context.subscriptions + ); }); context.subscriptions.push(disposable); } diff --git a/monster-js/dist/extension.js.map b/monster-js/dist/extension.js.map index 309cfdb8db69ea5ef8a52f31363d3a4a48c6c7be..5ee3cc81292ea9eabc846165c198b1b29fb4ccd3 100644 --- a/monster-js/dist/extension.js.map +++ b/monster-js/dist/extension.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../source/extension.mjs"], - "sourcesContent": ["import * as vscode from 'vscode';\n//import * as vscodeWeb from 'vscode-web';\n\n\nlet isWeb = false;\n//if (typeof vscodeWeb !== 'undefined') {\n// isWeb = true;\n//}\n\nif (isWeb) {\n\tconsole.log(\"web\")\n // Code f\u00FCr die Web-Version von VS Code\n} else {\n\tconsole.log(\"something\")\n // Code f\u00FCr die Desktop-Version von VS Code\n}\n\nexport function activate(context) {\n console.log('Congratulations, your extension \"helloworld-minimal-sample\" is now active!');\n\t\n let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {\n\t\t// The code you place here will be executed every time your command is executed\n\n\t\t// Display a message box to the user\n\t\tvscode.window.showInformationMessage('Hello World!');\n\t});\n\n\tcontext.subscriptions.push(disposable);\n}\n\nexport function deactivate() {}\n\n\n/**\nconst view = vscode.window.createWebviewView('myView', 'My Button', vscode.ViewColumn.Beside, {});\nview.webview.html = '<button>Hello World</button>';\n\n\nview.reveal({ select: false, focus: false });\n\n\nview.webview.onDidReceiveMessage(message => {\n if (message.command === 'buttonClicked') {\n vscode.window.showInformationMessage('Button clicked!');\n }\n});\n */"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIxB,IAAI,QAAQ;AAKZ,IAAI,OAAO;AACV,UAAQ,IAAI,KAAK;AAElB,OAAO;AACN,UAAQ,IAAI,WAAW;AAExB;AAEO,SAAS,SAAS,SAAS;AAChC,UAAQ,IAAI,4EAA4E;AAExF,MAAI,aAAoB,gBAAS,gBAAgB,wBAAwB,MAAM;AAI/E,IAAO,cAAO,uBAAuB,cAAc;AAAA,EACpD,CAAC;AAED,UAAQ,cAAc,KAAK,UAAU;AACtC;AAEO,SAAS,aAAa;AAAC;", + "sourcesContent": ["import * as vscode from 'vscode';\n\n// see https://code.visualstudio.com/api/extension-guides/webview\n\nexport function activate(context) {\n\n let disposable = vscode.commands.registerCommand('monster.open-doc', () => {\n // The code you place here will be executed every time your command is executed\n\n let documentationUrls;\n\n vscode.env.openExternal(vscode.Uri.parse('https://monsterjs.org/en/doc/'));\n\n const onDiskPath = vscode.Uri.joinPath(context.extensionUri, 'documentation');\n \n\n documentationUrls = panel.webview.asWebviewUri(onDiskPath);\n \n\n const panel = vscode.window.createWebviewPanel(\n 'monsterDocumentation', // Identifies the type of the webview. Used internally\n 'Monster JS Documentation', // Title of the panel displayed to the user\n vscode.ViewColumn.One,\n {\n enableScripts: true,\n localResourceRoots: [documentationUrls]\n } // Webview options. More on these later.\n );\n\n getWebviewContent(context).then(html => {\n panel.webview.html = html;\n }).catch(error => {\n console.log(error)\n })\n // \n panel.onDidDispose(\n () => {\n // When the panel is closed, cancel any future updates to the webview content\n\n },\n null,\n context.subscriptions\n );\n\n });\n\n context.subscriptions.push(disposable);\n}\n\nexport function deactivate() { }"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAIjB,SAAS,SAAS,SAAS;AAEhC,MAAI,aAAoB,gBAAS,gBAAgB,oBAAoB,MAAM;AAGzE,QAAI;AAEJ,IAAO,WAAI,aAAoB,WAAI,MAAM,+BAA+B,CAAC;AAEzE,UAAM,aAAoB,WAAI,SAAS,QAAQ,cAAc,eAAe;AAG5E,wBAAoB,MAAM,QAAQ,aAAa,UAAU;AAGzD,UAAM,QAAe,cAAO;AAAA,MAC1B;AAAA;AAAA,MACA;AAAA;AAAA,MACO,kBAAW;AAAA,MAClB;AAAA,QACE,eAAe;AAAA,QACf,oBAAoB,CAAC,iBAAiB;AAAA,MACxC;AAAA;AAAA,IACF;AAEA,sBAAkB,OAAO,EAAE,KAAK,UAAQ;AACtC,YAAM,QAAQ,OAAO;AAAA,IACvB,CAAC,EAAE,MAAM,WAAS;AAChB,cAAQ,IAAI,KAAK;AAAA,IACnB,CAAC;AAED,UAAM;AAAA,MACJ,MAAM;AAAA,MAGN;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EAEF,CAAC;AAED,UAAQ,cAAc,KAAK,UAAU;AACvC;AAEO,SAAS,aAAa;AAAE;", "names": [] } diff --git a/monster-js/package.json b/monster-js/package.json index d32aa1da2bc144947b29fced216253b69259ec05..774db78446a462f0b77252e9d48d0cae7129c3be 100644 --- a/monster-js/package.json +++ b/monster-js/package.json @@ -14,7 +14,7 @@ }, "homepage": "https://monsterjs.org", "pricing": "Free", - "version": "0.0.5", + "version": "0.0.6", "engines": { "vscode": "^1.76.0" }, @@ -40,8 +40,8 @@ "contributes": { "commands": [ { - "command": "extension.helloWorld", - "title": "Hello World" + "command": "monster.open-doc", + "title": "Open Monster JS Documentation" } ], "configuration": [ diff --git a/monster-js/source/extension.mjs b/monster-js/source/extension.mjs index 10e2360bacaedb6299b84c831bf3b645b98c122f..4e28a3b735d9c86b3e2c14f85c73a105446ff632 100644 --- a/monster-js/source/extension.mjs +++ b/monster-js/source/extension.mjs @@ -1,47 +1,50 @@ import * as vscode from 'vscode'; -//import * as vscodeWeb from 'vscode-web'; +// see https://code.visualstudio.com/api/extension-guides/webview -let isWeb = false; -//if (typeof vscodeWeb !== 'undefined') { -// isWeb = true; -//} +export function activate(context) { -if (isWeb) { - console.log("web") - // Code für die Web-Version von VS Code -} else { - console.log("something") - // Code für die Desktop-Version von VS Code -} + let disposable = vscode.commands.registerCommand('monster.open-doc', () => { + // The code you place here will be executed every time your command is executed -export function activate(context) { - console.log('Congratulations, your extension "helloworld-minimal-sample" is now active!'); - - let disposable = vscode.commands.registerCommand('extension.helloWorld', () => { - // The code you place here will be executed every time your command is executed + let documentationUrls; - // Display a message box to the user - vscode.window.showInformationMessage('Hello World!'); - }); + vscode.env.openExternal(vscode.Uri.parse('https://monsterjs.org/en/doc/')); - context.subscriptions.push(disposable); -} + const onDiskPath = vscode.Uri.joinPath(context.extensionUri, 'documentation'); + -export function deactivate() {} + documentationUrls = panel.webview.asWebviewUri(onDiskPath); + + const panel = vscode.window.createWebviewPanel( + 'monsterDocumentation', // Identifies the type of the webview. Used internally + 'Monster JS Documentation', // Title of the panel displayed to the user + vscode.ViewColumn.One, + { + enableScripts: true, + localResourceRoots: [documentationUrls] + } // Webview options. More on these later. + ); -/** -const view = vscode.window.createWebviewView('myView', 'My Button', vscode.ViewColumn.Beside, {}); -view.webview.html = '<button>Hello World</button>'; + getWebviewContent(context).then(html => { + panel.webview.html = html; + }).catch(error => { + console.log(error) + }) + // + panel.onDidDispose( + () => { + // When the panel is closed, cancel any future updates to the webview content + }, + null, + context.subscriptions + ); -view.reveal({ select: false, focus: false }); + }); + context.subscriptions.push(disposable); +} -view.webview.onDidReceiveMessage(message => { - if (message.command === 'buttonClicked') { - vscode.window.showInformationMessage('Button clicked!'); - } -}); - */ \ No newline at end of file +export function deactivate() { } \ No newline at end of file