Add reference to another sql project (#12186)

* add projects to add database reference dialog

* able to add project references

* check for circular dependency

* only allow adding reference to project in the same workspace

* fix location dropdown when project reference is enabled

* add tests

* more tests

* cleanup

* fix flakey test

* addressing comments
This commit is contained in:
Kim Santiago
2020-09-10 17:44:39 -07:00
committed by GitHub
parent 7df132b307
commit 133ff73a43
11 changed files with 380 additions and 70 deletions

View File

@@ -6,8 +6,9 @@
import * as vscode from 'vscode';
import * as os from 'os';
import * as constants from './constants';
import { promises as fs } from 'fs';
import * as path from 'path';
import * as glob from 'fast-glob';
import { promises as fs } from 'fs';
/**
* Consolidates on the error message string
@@ -143,3 +144,16 @@ export function readSqlCmdVariables(xmlDoc: any): Record<string, string> {
return sqlCmdVariables;
}
/**
* Recursively gets all the sqlproj files at any depth in a folder
* @param folderPath
*/
export async function getSqlProjectFilesInFolder(folderPath: string): Promise<string[]> {
// path needs to use forward slashes for glob to work
const escapedPath = glob.escapePath(folderPath.replace(/\\/g, '/'));
const sqlprojFilter = path.posix.join(escapedPath, '**', '*.sqlproj');
const results = await glob(sqlprojFilter);
return results;
}