@@ -273,17 +273,30 @@ export class Remote {
273
273
[ `${ authorityParts [ 1 ] } ` ] : agent . operating_system ,
274
274
}
275
275
276
+ // VS Code ignores the connect timeout in the SSH config and uses a default
277
+ // of 15 seconds, which can be too short in the case where we wait for
278
+ // startup scripts. For now we hardcode a longer value.
279
+ const connectTimeout = 1800
280
+
276
281
let settingsContent = "{}"
277
282
try {
278
283
settingsContent = await fs . readFile ( this . storage . getUserSettingsPath ( ) , "utf8" )
279
284
} catch ( ex ) {
280
285
// Ignore! It's probably because the file doesn't exist.
281
286
}
282
- const parsed = jsonc . parse ( settingsContent )
283
- parsed [ "remote.SSH.remotePlatform" ] = remotePlatforms
284
- const edits = jsonc . modify ( settingsContent , [ "remote.SSH.remotePlatform" ] , remotePlatforms , { } )
287
+
288
+ settingsContent = jsonc . applyEdits (
289
+ settingsContent ,
290
+ jsonc . modify ( settingsContent , [ "remote.SSH.remotePlatform" ] , remotePlatforms , { } ) ,
291
+ )
292
+
293
+ settingsContent = jsonc . applyEdits (
294
+ settingsContent ,
295
+ jsonc . modify ( settingsContent , [ "remote.SSH.connectTimeout" ] , connectTimeout , { } ) ,
296
+ )
297
+
285
298
try {
286
- await fs . writeFile ( this . storage . getUserSettingsPath ( ) , jsonc . applyEdits ( settingsContent , edits ) )
299
+ await fs . writeFile ( this . storage . getUserSettingsPath ( ) , settingsContent )
287
300
} catch ( ex ) {
288
301
// The user will just be prompted instead, which is fine!
289
302
// If a user's settings.json is read-only, then we can't write to it.
0 commit comments