From c65e26b82f116d18976f06334a53d9aa17ff1978 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Mon, 20 Dec 2021 17:47:53 -0800 Subject: [PATCH] Fix `EnableISEMode` for Azure Data Studio Because ADS stripped out VS Code's debugger, the `debug` settings don't exist, causing our `update()` call for the debug setting to throw an error to the user when they run `EnableISEMode`. I couldn't find a reliable way to test if the extension is running in the ADS fork instead of the upstream VS Code, but a simple `try {} catch {}` that allows the funciton to continue is a reliable fix, as we can't do anything about this setting regardless. --- src/features/ISECompatibility.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts index 89c54eb3d2..d48b999c81 100644 --- a/src/features/ISECompatibility.ts +++ b/src/features/ISECompatibility.ts @@ -42,7 +42,15 @@ export class ISECompatibilityFeature implements vscode.Disposable { private async EnableISEMode() { for (const iseSetting of ISECompatibilityFeature.settings) { - await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); + try { + await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true); + } catch { + // The `update` call can fail if the setting doesn't exist. This + // happens when the extension runs in Azure Data Studio, which + // doesn't have a debugger, so the `debug` setting can't be + // updated. Unless we catch this exception and allow the + // function to continue, it throws an error to the user. + } } // Show the PowerShell Command Explorer