Fix watcher not restarting code-server on VS Code compilation (#4520)

The "Starting watch-client" string no longer appears in the latest build
output.  We could look for "Finished compilation with" to avoid
restarting when other tasks restart (since they also include the name
i.e. "Finished compilation extensions with 0 errors") but I figure we
might as well restart code-server when any compilation task completes in
case other tasks include changes that need to be reloaded.
This commit is contained in:
Asher 2021-11-16 16:21:14 -06:00 committed by GitHub
parent ccb9d948c0
commit cd26f84bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 11 deletions

View File

@ -106,19 +106,10 @@ class Watcher {
plugin.stderr.on("data", (d) => process.stderr.write(d)) plugin.stderr.on("data", (d) => process.stderr.write(d))
} }
let startingVscode = false
let startedVscode = false
onLine(vscode, (line, original) => { onLine(vscode, (line, original) => {
console.log("[vscode]", original) console.log("[vscode]", original)
// Wait for watch-client since "Finished compilation" will appear multiple if (line.includes("Finished compilation")) {
// times before the client starts building. restartServer()
if (!startingVscode && line.includes("Starting watch-client")) {
startingVscode = true
} else if (startingVscode && line.includes("Finished compilation")) {
if (startedVscode) {
restartServer()
}
startedVscode = true
} }
}) })