diff --git a/package.json b/package.json index fe4bea0..174598d 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,16 @@ "when": "devrun.serverActive" } ] + }, + "configuration": { + "title": "DevRun", + "properties": { + "devrun.autoStartServer": { + "type": "boolean", + "default": false, + "description": "Automatically start the server when vscode starts" + } + } } }, "scripts": { diff --git a/src/extension.ts b/src/extension.ts index 66f7d2b..173d0b3 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -3,8 +3,7 @@ import { currentRun, startRun, stopRun } from "./run"; import { startServer, stopServer } from "./server"; export function activate(context: vscode.ExtensionContext) { - console.log("dev-run Activated"); - + const config = vscode.workspace.getConfiguration("devrun"); const statusBarItem = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, 10, @@ -49,6 +48,14 @@ export function activate(context: vscode.ExtensionContext) { stopServer(statusBarItem), ), ); + console.log("dev-run Activated"); + + const autoStart = config.get("autoStartServer"); + + if (autoStart) { + startServer(statusBarItem); + console.log("dev-run server auto started!"); + } } export function deactivate() {