Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/features/ISECompatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ISECompatibilityFeature implements vscode.Disposable {

private _commandRegistrations: vscode.Disposable[] = [];
private _iseModeEnabled: boolean;
private _originalSettings: Record<string, boolean | string | undefined> = {};

constructor() {
// TODO: This test isn't great.
Expand All @@ -50,7 +51,9 @@ export class ISECompatibilityFeature implements vscode.Disposable {
this._iseModeEnabled = true;
for (const iseSetting of ISECompatibilityFeature.settings) {
try {
await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, iseSetting.value, true);
const config = vscode.workspace.getConfiguration(iseSetting.path);
this._originalSettings[iseSetting.path + iseSetting.name] = config.get(iseSetting.name);
await config.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
Expand All @@ -72,9 +75,10 @@ export class ISECompatibilityFeature implements vscode.Disposable {
private async DisableISEMode() {
this._iseModeEnabled = false;
for (const iseSetting of ISECompatibilityFeature.settings) {
const currently = vscode.workspace.getConfiguration(iseSetting.path).get<string | boolean>(iseSetting.name);
const config = vscode.workspace.getConfiguration(iseSetting.path);
const currently = config.get(iseSetting.name);
if (currently === iseSetting.value) {
await vscode.workspace.getConfiguration(iseSetting.path).update(iseSetting.name, undefined, true);
await config.update(iseSetting.name, this._originalSettings[iseSetting.path + iseSetting.name], true);
}
}
}
Expand Down