parent
c5f8164281
commit
e3fb4fcf41
6
index.js
6
index.js
|
@ -218,6 +218,8 @@ function createServer() {
|
||||||
function __init__() {
|
function __init__() {
|
||||||
let folders = vsc.workspace.workspaceFolders
|
let folders = vsc.workspace.workspaceFolders
|
||||||
|
|
||||||
|
enabled = false
|
||||||
|
|
||||||
statItem.hide()
|
statItem.hide()
|
||||||
|
|
||||||
if (folders && folders.length) {
|
if (folders && folders.length) {
|
||||||
|
@ -269,12 +271,12 @@ export function activate(ctx) {
|
||||||
__init__()
|
__init__()
|
||||||
|
|
||||||
vsc.workspace.onDidSaveTextDocument(doc => {
|
vsc.workspace.onDidSaveTextDocument(doc => {
|
||||||
if (enabled) {
|
|
||||||
let file = doc.fileName
|
let file = doc.fileName
|
||||||
if (file.startsWith(root)) {
|
if (file?.startsWith(root)) {
|
||||||
if (basename(file) === CONFIG_FILE) {
|
if (basename(file) === CONFIG_FILE) {
|
||||||
return __init__()
|
return __init__()
|
||||||
}
|
}
|
||||||
|
if (enabled) {
|
||||||
ws.send()
|
ws.send()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "simple-http",
|
"name": "simple-http",
|
||||||
"displayName": "simple http.server",
|
"displayName": "simple http.server",
|
||||||
"description": "🔥 简单的http服务器, 方便临时调试html",
|
"description": "🔥 简单的http服务器, 方便临时调试html",
|
||||||
"version": "1.6.0",
|
"version": "1.6.1",
|
||||||
"publisher": "yutent",
|
"publisher": "yutent",
|
||||||
"author": "Yutent [@yutent]",
|
"author": "Yutent [@yutent]",
|
||||||
"icon": "logo.png",
|
"icon": "logo.png",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": false,
|
||||||
"port": 9090
|
"port": 9090
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue