@@ -8,7 +8,7 @@ async function main(): Promise<void> {
8
8
try {
9
9
const watcher = new Watcher ( )
10
10
await watcher . watch ( )
11
- } catch ( error ) {
11
+ } catch ( error : any ) {
12
12
console . error ( error . message )
13
13
process . exit ( 1 )
14
14
}
@@ -38,6 +38,9 @@ class Watcher {
38
38
}
39
39
40
40
const vscode = cp . spawn ( "yarn" , [ "watch" ] , { cwd : this . vscodeSourcePath } )
41
+
42
+ const vscodeWebExtensions = cp . spawn ( "yarn" , [ "watch-web" ] , { cwd : this . vscodeSourcePath } )
43
+
41
44
const tsc = cp . spawn ( "tsc" , [ "--watch" , "--pretty" , "--preserveWatchOutput" ] , { cwd : this . rootPath } )
42
45
const plugin = process . env . PLUGIN_DIR
43
46
? cp . spawn ( "yarn" , [ "build" , "--watch" ] , { cwd : process . env . PLUGIN_DIR } )
@@ -48,6 +51,10 @@ class Watcher {
48
51
vscode . removeAllListeners ( )
49
52
vscode . kill ( )
50
53
54
+ Watcher . log ( "killing vs code web extension watcher" )
55
+ vscodeWebExtensions . removeAllListeners ( )
56
+ vscodeWebExtensions . kill ( )
57
+
51
58
Watcher . log ( "killing tsc" )
52
59
tsc . removeAllListeners ( )
53
60
tsc . kill ( )
@@ -75,19 +82,28 @@ class Watcher {
75
82
Watcher . log ( "vs code watcher terminated unexpectedly" )
76
83
cleanup ( code )
77
84
} )
85
+
86
+ vscodeWebExtensions . on ( "exit" , ( code ) => {
87
+ Watcher . log ( "vs code extension watcher terminated unexpectedly" )
88
+ cleanup ( code )
89
+ } )
90
+
78
91
tsc . on ( "exit" , ( code ) => {
79
92
Watcher . log ( "tsc terminated unexpectedly" )
80
93
cleanup ( code )
81
94
} )
95
+
82
96
if ( plugin ) {
83
97
plugin . on ( "exit" , ( code ) => {
84
98
Watcher . log ( "plugin terminated unexpectedly" )
85
99
cleanup ( code )
86
100
} )
87
101
}
88
102
103
+ vscodeWebExtensions . stderr . on ( "data" , ( d ) => process . stderr . write ( d ) )
89
104
vscode . stderr . on ( "data" , ( d ) => process . stderr . write ( d ) )
90
105
tsc . stderr . on ( "data" , ( d ) => process . stderr . write ( d ) )
106
+
91
107
if ( plugin ) {
92
108
plugin . stderr . on ( "data" , ( d ) => process . stderr . write ( d ) )
93
109
}
0 commit comments