diff --git a/index.js b/index.js index ec44e28..0ed717c 100644 --- a/index.js +++ b/index.js @@ -218,6 +218,8 @@ function createServer() { function __init__() { let folders = vsc.workspace.workspaceFolders + enabled = false + statItem.hide() if (folders && folders.length) { @@ -269,12 +271,12 @@ export function activate(ctx) { __init__() vsc.workspace.onDidSaveTextDocument(doc => { - if (enabled) { - let file = doc.fileName - if (file.startsWith(root)) { - if (basename(file) === CONFIG_FILE) { - return __init__() - } + let file = doc.fileName + if (file?.startsWith(root)) { + if (basename(file) === CONFIG_FILE) { + return __init__() + } + if (enabled) { ws.send() } } diff --git a/package.json b/package.json index 298a58c..dd6d3fe 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "simple-http", "displayName": "simple http.server", "description": "🔥 简单的http服务器, 方便临时调试html", - "version": "1.6.0", + "version": "1.6.1", "publisher": "yutent", "author": "Yutent [@yutent]", "icon": "logo.png", diff --git a/test/.httpserver b/test/.httpserver index 3cf1d27..d15a409 100644 --- a/test/.httpserver +++ b/test/.httpserver @@ -1,4 +1,4 @@ { - "enabled": true, + "enabled": false, "port": 9090 }