修复配置初始化为false时, 不会自动启动的bug

master 1.6.1
yutent 2024-01-02 17:34:57 +08:00
parent c5f8164281
commit e3fb4fcf41
3 changed files with 10 additions and 8 deletions

View File

@ -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()
}
}

View File

@ -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",

View File

@ -1,4 +1,4 @@
{
"enabled": true,
"enabled": false,
"port": 9090
}