diff --git a/extensions/mssql/src/contracts.ts b/extensions/mssql/src/contracts.ts index 70648d0adc..5c33a8bb64 100644 --- a/extensions/mssql/src/contracts.ts +++ b/extensions/mssql/src/contracts.ts @@ -638,32 +638,14 @@ export namespace MoveSqlObjectScriptRequest { export const type = new RequestType('sqlProjects/moveSqlObjectScript'); } -export namespace GetDatabaseReferencesRequest { - export const type = new RequestType('sqlProjects/getDatabaseReferences'); -} - -export namespace GetFoldersRequest { - export const type = new RequestType('sqlProjects/getFolders'); -} - -export namespace GetPostDeploymentScriptsRequest { - export const type = new RequestType('sqlProjects/getPostDeploymentScripts'); -} - -export namespace GetPreDeploymentScriptsRequest { - export const type = new RequestType('sqlProjects/getPreDeploymentScripts'); -} - -export namespace GetSqlCmdVariablesRequest { - export const type = new RequestType('sqlProjects/getSqlCmdVariables'); -} - export namespace GetSqlObjectScriptsRequest { export const type = new RequestType('sqlProjects/getSqlObjectScripts'); } //#endregion +//#endregion + //#region Folder functions export namespace AddFolderRequest { @@ -674,6 +656,10 @@ export namespace DeleteFolderRequest { export const type = new RequestType('sqlProjects/deleteFolder'); } +export namespace GetFoldersRequest { + export const type = new RequestType('sqlProjects/getFolders'); +} + //#endregion //#region Pre/Post-deployment script functions @@ -698,6 +684,10 @@ export namespace ExcludePostDeploymentScriptRequest { export const type = new RequestType('sqlProjects/excludePostDeploymentScript'); } +export namespace GetPostDeploymentScriptsRequest { + export const type = new RequestType('sqlProjects/getPostDeploymentScripts'); +} + export namespace ExcludePreDeploymentScriptRequest { export const type = new RequestType('sqlProjects/excludePreDeploymentScript'); } @@ -710,6 +700,34 @@ export namespace MovePreDeploymentScriptRequest { export const type = new RequestType('sqlProjects/movePreDeploymentScript'); } +export namespace GetPreDeploymentScriptsRequest { + export const type = new RequestType('sqlProjects/getPreDeploymentScripts'); +} + +//#endregion + +//#region None functions + +export namespace AddNoneItemRequest { + export const type = new RequestType('sqlProjects/addNoneScript'); +} + +export namespace DeleteNoneItemRequest { + export const type = new RequestType('sqlProjects/deleteNoneScript'); +} + +export namespace ExcludeNoneItemRequest { + export const type = new RequestType('sqlProjects/excludeNoneScript'); +} + +export namespace GetNoneItemsRequest { + export const type = new RequestType('sqlProjects/getNoneScripts'); +} + +export namespace MoveNoneItemRequest { + export const type = new RequestType('sqlProjects/moveNoneScript'); +} + //#endregion //#endregion @@ -728,14 +746,15 @@ export namespace UpdateSqlCmdVariableRequest { export const type = new RequestType('sqlProjects/updateSqlCmdVariable'); } +export namespace GetSqlCmdVariablesRequest { + export const type = new RequestType('sqlProjects/getSqlCmdVariables'); +} + //#endregion //#region Database reference functions export namespace AddDacpacReferenceRequest { - /** - * - */ export const type = new RequestType('sqlprojects/addDacpacReference'); } @@ -751,6 +770,10 @@ export namespace DeleteDatabaseReferenceRequest { export const type = new RequestType('sqlprojects/deleteDatabaseReference'); } +export namespace GetDatabaseReferencesRequest { + export const type = new RequestType('sqlProjects/getDatabaseReferences'); +} + //#endregion //#endregion diff --git a/extensions/mssql/src/mssql.d.ts b/extensions/mssql/src/mssql.d.ts index c36351c366..29981f16f5 100644 --- a/extensions/mssql/src/mssql.d.ts +++ b/extensions/mssql/src/mssql.d.ts @@ -520,31 +520,31 @@ declare module 'mssql' { moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise; /** - * getDatabaseReferences + * Get all the database references in a project * @param projectUri Absolute path of the project, including .sqlproj */ getDatabaseReferences(projectUri: string): Promise; /** - * getFolders + * Get all the folders in a project * @param projectUri Absolute path of the project, including .sqlproj */ getFolders(projectUri: string): Promise; /** - * getPostDeploymentScripts + * Get all the post-deployment scripts in a project * @param projectUri Absolute path of the project, including .sqlproj */ getPostDeploymentScripts(projectUri: string): Promise; /** - * getPreDeploymentScripts + * Get all the pre-deployment scripts in a project * @param projectUri Absolute path of the project, including .sqlproj */ getPreDeploymentScripts(projectUri: string): Promise; /** - * getSqlCmdVariables + * Get all the SQLCMD variables in a project * @param projectUri Absolute path of the project, including .sqlproj */ getSqlCmdVariables(projectUri: string): Promise; @@ -554,6 +554,41 @@ declare module 'mssql' { * @param projectUri Absolute path of the project, including .sqlproj */ getSqlObjectScripts(projectUri: string): Promise; + + /** + * Add a None item to a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + addNoneItem(projectUri: string, path: string): Promise; + + /** + * Delete a None item from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + deleteNoneItem(projectUri: string, path: string): Promise; + + /** + * Exclude a None item from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + excludeNoneItem(projectUri: string, path: string): Promise; + + /** + * Get all the None items in a project + * @param projectUri Absolute path of the project, including .sqlproj + */ + getNoneItems(projectUri: string): Promise; + + /** + * Move a None item in a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param destinationPath Destination path of the file or folder, relative to the .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise; } diff --git a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts index 1d2040144b..98d80e2a19 100644 --- a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts +++ b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts @@ -367,6 +367,56 @@ export class SqlProjectsService implements mssql.ISqlProjectsService { return await this.runWithErrorHandling(contracts.GetSqlObjectScriptsRequest.type, params); } + /** + * Add a SQL object script to a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the script, including .sql, relative to the .sqlproj + */ + public async addNoneItem(projectUri: string, path: string): Promise { + const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path }; + return await this.runWithErrorHandling(contracts.AddNoneItemRequest.type, params); + } + + /** + * Delete a SQL object script from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the script, including .sql, relative to the .sqlproj + */ + public async deleteNoneItem(projectUri: string, path: string): Promise { + const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path }; + return await this.runWithErrorHandling(contracts.DeleteNoneItemRequest.type, params); + } + + /** + * Exclude a SQL object script from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the script, including .sql, relative to the .sqlproj + */ + public async excludeNoneItem(projectUri: string, path: string): Promise { + const params: contracts.SqlProjectScriptParams = { projectUri: projectUri, path: path }; + return await this.runWithErrorHandling(contracts.ExcludeNoneItemRequest.type, params); + } + + /** + * getNoneScripts + * @param projectUri Absolute path of the project, including .sqlproj + */ + public async getNoneItems(projectUri: string): Promise { + const params: contracts.SqlProjectParams = { projectUri: projectUri }; + return await this.runWithErrorHandling(contracts.GetNoneItemsRequest.type, params); + } + + /** + * Move a SQL object script in a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param destinationPath Destination path of the file or folder, relative to the .sqlproj + * @param path Path of the script, including .sql, relative to the .sqlproj + */ + public async moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise { + const params: contracts.MoveItemParams = { projectUri: projectUri, destinationPath: destinationPath, path: path }; + return await this.runWithErrorHandling(contracts.MoveNoneItemRequest.type, params); + } + private async runWithErrorHandling(type: RequestType, params: P): Promise { try { const result = await this.client.sendRequest(type, params); diff --git a/extensions/types/vscode-mssql.d.ts b/extensions/types/vscode-mssql.d.ts index 0c54ada7fa..46ca3453d0 100644 --- a/extensions/types/vscode-mssql.d.ts +++ b/extensions/types/vscode-mssql.d.ts @@ -640,31 +640,31 @@ declare module 'vscode-mssql' { moveSqlObjectScript(projectUri: string, destinationPath: string, path: string): Promise; /** - * getDatabaseReferences + * Get all the database references in a project * @param projectUri Absolute path of the project, including .sqlproj */ getDatabaseReferences(projectUri: string): Promise; /** - * getFolders + * Get all the folders in a project * @param projectUri Absolute path of the project, including .sqlproj */ getFolders(projectUri: string): Promise; /** - * getPostDeploymentScripts + * Get all the post-deployment scripts in a project * @param projectUri Absolute path of the project, including .sqlproj */ getPostDeploymentScripts(projectUri: string): Promise; /** - * getPreDeploymentScripts + * Get all the pre-deployment scripts in a project * @param projectUri Absolute path of the project, including .sqlproj */ getPreDeploymentScripts(projectUri: string): Promise; /** - * getSqlCmdVariables + * Get all the SQLCMD variables in a project * @param projectUri Absolute path of the project, including .sqlproj */ getSqlCmdVariables(projectUri: string): Promise; @@ -674,6 +674,41 @@ declare module 'vscode-mssql' { * @param projectUri Absolute path of the project, including .sqlproj */ getSqlObjectScripts(projectUri: string): Promise; + + /** + * Add a None item to a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + addNoneItem(projectUri: string, path: string): Promise; + + /** + * Delete a None item from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + deleteNoneItem(projectUri: string, path: string): Promise; + + /** + * Exclude a None item from a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + excludeNoneItem(projectUri: string, path: string): Promise; + + /** + * Get all the None items in a project + * @param projectUri Absolute path of the project, including .sqlproj + */ + getNoneItems(projectUri: string): Promise; + + /** + * Move a None item in a project + * @param projectUri Absolute path of the project, including .sqlproj + * @param destinationPath Destination path of the file or folder, relative to the .sqlproj + * @param path Path of the item, including extension, relative to the .sqlproj + */ + moveNoneItem(projectUri: string, destinationPath: string, path: string): Promise; } export interface GetCrossPlatformCompatibilityResult extends ResultStatus {