File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -116,11 +116,20 @@ class Env {
116
116
}
117
117
118
118
public async teardown ( ) {
119
- await this . languageClient ?. stop ( ) ;
120
- for ( const d of this . disposables ) {
121
- d . dispose ( ) ;
119
+ try {
120
+ await this . languageClient ?. stop ( 1_000 ) ; // 1s timeout
121
+ } catch ( e ) {
122
+ console . log ( `failed to stop gopls within 1sec: ${ e } ` ) ;
123
+ } finally {
124
+ if ( this . languageClient ?. isRunning ( ) ) {
125
+ console . log ( `failed to stop language client on time: ${ this . languageClient ?. state } ` ) ;
126
+ this . flushTrace ( true ) ;
127
+ }
128
+ for ( const d of this . disposables ) {
129
+ d . dispose ( ) ;
130
+ }
131
+ this . languageClient = undefined ;
122
132
}
123
- this . languageClient = undefined ;
124
133
}
125
134
126
135
public async openDoc ( ...paths : string [ ] ) {
You can’t perform that action at this time.
0 commit comments