mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
Add SQL Bindings Tests / Vbump (#19717)
* add further testing * vbump version * add successfully test * address comments
This commit is contained in:
@@ -36,7 +36,7 @@ export interface IFileFunctionObject {
|
||||
* @returns settings in local.settings.json. If no settings are found, returns default "empty" settings
|
||||
*/
|
||||
export async function getLocalSettingsJson(localSettingsPath: string): Promise<ILocalSettingsJson> {
|
||||
if (fs.existsSync(localSettingsPath)) {
|
||||
if (await utils.exists(localSettingsPath)) {
|
||||
const data: string = (fs.readFileSync(localSettingsPath)).toString();
|
||||
try {
|
||||
return JSON.parse(data);
|
||||
@@ -281,7 +281,7 @@ export async function getAFProjectContainingFile(fileUri: vscode.Uri): Promise<v
|
||||
// Use 'host.json' as an indicator that this is a functions project
|
||||
// copied from verifyIsproject.ts in vscode-azurefunctions extension
|
||||
export async function isFunctionProject(folderPath: string): Promise<boolean> {
|
||||
return fs.existsSync(path.join(folderPath, constants.hostFileName));
|
||||
return await utils.exists(path.join(folderPath, constants.hostFileName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -359,7 +359,6 @@ export async function promptForObjectName(bindingType: BindingType, connectionIn
|
||||
*/
|
||||
export async function promptAndUpdateConnectionStringSetting(projectUri: vscode.Uri | undefined, connectionInfo?: IConnectionInfo): Promise<IConnectionStringInfo | undefined> {
|
||||
let connectionStringSettingName: string | undefined;
|
||||
const vscodeMssqlApi = await utils.getVscodeMssqlApi();
|
||||
|
||||
// show the settings from project's local.settings.json if there's an AF functions project
|
||||
if (projectUri) {
|
||||
@@ -494,6 +493,7 @@ export async function promptAndUpdateConnectionStringSetting(projectUri: vscode.
|
||||
}
|
||||
} else {
|
||||
// Let user choose from existing connections to create connection string from
|
||||
const vscodeMssqlApi = await utils.getVscodeMssqlApi();
|
||||
connectionInfo = await vscodeMssqlApi.promptForConnection(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,9 @@ export async function getUniqueFileName(fileName: string, folderPath?: string):
|
||||
let uniqueFileName = fileName;
|
||||
|
||||
while (count < maxCount) {
|
||||
if (!fs.existsSync(path.join(folderPath, uniqueFileName + '.cs'))) {
|
||||
// checks to see if file exists
|
||||
let uniqueFilePath = path.join(folderPath, uniqueFileName + '.cs');
|
||||
if (!(await exists(uniqueFilePath))) {
|
||||
return uniqueFileName;
|
||||
}
|
||||
count += 1;
|
||||
@@ -173,3 +175,12 @@ export function getErrorType(error: any): string | undefined {
|
||||
return 'UnknownError';
|
||||
}
|
||||
}
|
||||
|
||||
export async function exists(path: string): Promise<boolean> {
|
||||
try {
|
||||
await fs.promises.access(path);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user