mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Required changes to make sql projects extension work with vscode (#22847)
* Update CreateProject api * More updates * Fix a few comments * Address comments * Remove package.json changes * Fix error * Fix testUtil
This commit is contained in:
@@ -16,6 +16,7 @@ import * as fse from 'fs-extra';
|
||||
import * as which from 'which';
|
||||
import { promises as fs } from 'fs';
|
||||
import { ISqlProject, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabase } from './typeHelper';
|
||||
|
||||
export interface ValidationResult {
|
||||
errorMessage: string;
|
||||
@@ -157,14 +158,22 @@ export function convertSlashesForSqlProj(filePath: string): string {
|
||||
* @param systemDb
|
||||
* @returns
|
||||
*/
|
||||
export function systemDatabaseToString(systemDb: mssql.SystemDatabase): string {
|
||||
if (systemDb === mssql.SystemDatabase.Master) {
|
||||
export function systemDatabaseToString(systemDb: SystemDatabase): string {
|
||||
if (systemDb === mssql.SystemDatabase.Master || systemDb === vscodeMssql.SystemDatabase.Master) {
|
||||
return constants.master;
|
||||
} else {
|
||||
return constants.msdb;
|
||||
}
|
||||
}
|
||||
|
||||
export function getSystemDatabase(name: string): SystemDatabase {
|
||||
if (getAzdataApi()) {
|
||||
return name === constants.master ? mssql.SystemDatabase.Master : mssql.SystemDatabase.MSDB;
|
||||
} else {
|
||||
return name === constants.master ? vscodeMssql.SystemDatabase.Master : vscodeMssql.SystemDatabase.MSDB;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read SQLCMD variables from xmlDoc and return them
|
||||
* @param xmlDoc xml doc to read SQLCMD variables from. Format must be the same that sqlproj and publish profiles use
|
||||
@@ -315,15 +324,14 @@ export async function getSchemaCompareService(): Promise<ISchemaCompareService>
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSqlProjectsService(): Promise<mssql.ISqlProjectsService> {
|
||||
export async function getSqlProjectsService(): Promise<ISqlProjectsService> {
|
||||
if (getAzdataApi()) {
|
||||
const ext = vscode.extensions.getExtension(mssql.extension.name) as vscode.Extension<mssql.IExtension>;
|
||||
const api = await ext.activate();
|
||||
return api.sqlProjects;
|
||||
} else {
|
||||
throw new Error(constants.errorNotSupportedInVsCode('SqlProjectService'));
|
||||
// const api = await getVscodeMssqlApi();
|
||||
// return api.sqlProjects;
|
||||
const api = await getVscodeMssqlApi();
|
||||
return api.sqlProjects;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user