diff --git a/README.md b/README.md index 4e48cef..9406a9e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # vscode-hermione -Integration Hermione with VS Code + +This extension supports [Hermione][hermione] features in VS Code environment. Available features: + +- [Install Hermione](#install-hermione) +- [Using the REPL mode][#using-the-repl-mode] + +## Install Hermione + +If you are not using hermione yet or starting a new testing project, the "Install Hermione" action from the command panel will help you get started. + +## Using the REPL mode + +Adds a keybinding (`cmd+shift+8` for mac and `ctrl+shift+8` for others) to run a dedicated section of code in the VSCode terminal. More infor about [REPL mode][hermione-repl-mode]. + +[hermione]: https://github.com/gemini-testing/hermione +[hermione-repl-mode]: https://github.com/gemini-testing/hermione?tab=readme-ov-file#repl-mode diff --git a/src/extension.ts b/src/extension.ts new file mode 100644 index 0000000..a6f9fe1 --- /dev/null +++ b/src/extension.ts @@ -0,0 +1,23 @@ +import * as vscode from "vscode"; + +export function activate(context: vscode.ExtensionContext): void { + const disposable = vscode.commands.registerCommand("hrm.install", async () => { + const [workspaceFolder] = vscode.workspace.workspaceFolders || []; + if (!workspaceFolder) { + await vscode.window.showErrorMessage("Open a folder in VS Code to initialize Hermione"); + return; + } + + const terminal = vscode.window.createTerminal({ + name: "Install Hermione", + cwd: workspaceFolder.uri.fsPath, + env: process.env, + }); + + terminal.show(); + + terminal.sendText(`npm init hermione-app -- --yes`, true); + }); + + context.subscriptions.push(disposable); +}