Swapping Record usage to Map in SQL Projects (#22758)

* Changing SqlCmdVars from Record to Map

* Converting the rest

* Updating tests

* more cleanup

* Updating test to use new test creation API
This commit is contained in:
Benjin Dubishar
2023-04-17 12:56:39 -07:00
committed by GitHub
parent 4a4580e9ef
commit 02e61d1598
21 changed files with 132 additions and 138 deletions

View File

@@ -163,7 +163,7 @@ export async function getPublishDatabaseSettings(project: ISqlProject, promptFor
// project file (if they exist)
let sqlCmdVariables = Object.assign({}, project.sqlCmdVariables, publishProfile?.sqlCmdVariables);
if (Object.keys(sqlCmdVariables).length > 0) {
if (sqlCmdVariables.size > 0) {
// Continually loop here, allowing the user to modify SQLCMD variables one
// at a time until they're done (either by selecting the "Done" option or
// escaping out of the quick pick dialog). Users can modify each variable
@@ -173,7 +173,7 @@ export async function getPublishDatabaseSettings(project: ISqlProject, promptFor
const quickPickItems = Object.keys(sqlCmdVariables).map(key => {
return {
label: key,
description: sqlCmdVariables[key],
description: sqlCmdVariables.get(key),
key: key
} as vscode.QuickPickItem & { key?: string, isResetAllVars?: boolean, isDone?: boolean };
});
@@ -192,12 +192,12 @@ export async function getPublishDatabaseSettings(project: ISqlProject, promptFor
const newValue = await vscode.window.showInputBox(
{
title: constants.enterNewValueForVar(sqlCmd.key),
value: sqlCmdVariables[sqlCmd.key],
value: sqlCmdVariables.get(sqlCmd.key),
ignoreFocusOut: true
}
);
if (newValue) {
sqlCmdVariables[sqlCmd.key] = newValue;
sqlCmdVariables.set(sqlCmd.key, newValue);
}
} else if (sqlCmd.isResetAllVars) {
sqlCmdVariables = Object.assign({}, project.sqlCmdVariables, publishProfile?.sqlCmdVariables);