diff --git a/build/gulpfile.sql.js b/build/gulpfile.sql.js index 4242199ad9..910713a3b3 100644 --- a/build/gulpfile.sql.js +++ b/build/gulpfile.sql.js @@ -129,16 +129,19 @@ gulp.task('package-external-extensions', task.series( const packageManifestPath = path.join(packageDir, 'package.json'); const json = require('gulp-json-editor'); const packageJsonStream = gulp.src(packageManifestPath) // Create stream for the original package.json - .pipe(json(data => { // And now use gulp-json-editor to modify the contents + .pipe(json(data => { + // And now use gulp-json-editor to modify the contents const updateData = JSON.parse(fs.readFileSync(vscodeManifestFullPath)); // Read in the set of values to replace from package.vscode.json Object.keys(updateData).forEach(key => { data[key] = updateData[key]; }); - // Remove ADS-only menus. This is a subset of the menus listed in https://github.com/microsoft/azuredatastudio/blob/main/src/vs/workbench/api/common/menusExtensionPoint.ts - // More can be added to the list as needed. - ['objectExplorer/item/context', 'dataExplorer/context', 'dashboard/toolbar'].forEach(menu => { - delete data.contributes.menus[menu]; - }); + if(data.contributes?.menus){ + // Remove ADS-only menus. This is a subset of the menus listed in https://github.com/microsoft/azuredatastudio/blob/main/src/vs/workbench/api/common/menusExtensionPoint.ts + // More can be added to the list as needed. + ['objectExplorer/item/context', 'dataExplorer/context', 'dashboard/toolbar'].forEach(menu => { + delete data.contributes.menus[menu]; + }); + } return data; }, { beautify: false })) .pipe(gulp.dest(packageDir)); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index 02a39c1688..94f132c995 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -135,6 +135,7 @@ const extensionsFilter = filter([ '**/schema-compare.xlf', '**/server-report.xlf', '**/sql-assessment.xlf', + '**/sql-bindings.xlf', '**/sql-database-projects.xlf', '**/sql-migration.xlf', '**/xml-language-features.xlf' diff --git a/build/lib/extensions.js b/build/lib/extensions.js index a31b383689..c4d027cd3b 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -231,6 +231,7 @@ const externalExtensions = [ 'schema-compare', 'server-report', 'sql-assessment', + 'sql-bindings', 'sql-database-projects', 'sql-migration' ]; diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index 6001b8fd0f..791479bffe 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -267,6 +267,7 @@ const externalExtensions = [ 'schema-compare', 'server-report', 'sql-assessment', + 'sql-bindings', 'sql-database-projects', 'sql-migration' ]; diff --git a/build/npm/dirs.js b/build/npm/dirs.js index 731837fbe2..e57a8df3b8 100644 --- a/build/npm/dirs.js +++ b/build/npm/dirs.js @@ -48,6 +48,7 @@ exports.dirs = [ 'extensions/server-report', 'extensions/simple-browser', 'extensions/sql-assessment', + 'extensions/sql-bindings', 'extensions/sql-database-projects', 'extensions/sql-migration', 'extensions/vscode-test-resolver', diff --git a/extensions/sql-bindings/.eslintrc.json b/extensions/sql-bindings/.eslintrc.json new file mode 100644 index 0000000000..a617490989 --- /dev/null +++ b/extensions/sql-bindings/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "parserOptions": { + "project": "./extensions/sql-bindings/tsconfig.json" + }, + "rules": { + "@typescript-eslint/no-floating-promises": [ + "error", + { + "ignoreVoid": true + } + ] + } +} diff --git a/extensions/sql-bindings/.gitignore b/extensions/sql-bindings/.gitignore new file mode 100644 index 0000000000..27a1f10d94 --- /dev/null +++ b/extensions/sql-bindings/.gitignore @@ -0,0 +1 @@ +*.vsix diff --git a/extensions/sql-bindings/.vscode/launch.json b/extensions/sql-bindings/.vscode/launch.json new file mode 100644 index 0000000000..2233e3b04d --- /dev/null +++ b/extensions/sql-bindings/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + // This task is meant for running the VS Code version of the extension. See VSCODE_DEVELOPMENT.md for more information + { + "type": "extensionHost", + "request": "launch", + "name": "Launch Extension in VS Code", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ] + } + ] +} diff --git a/extensions/sql-bindings/.vscodeignore b/extensions/sql-bindings/.vscodeignore new file mode 100644 index 0000000000..e4f5602a29 --- /dev/null +++ b/extensions/sql-bindings/.vscodeignore @@ -0,0 +1,9 @@ +src +out +tsconfig.json +.gitignore +coverage +coverConfig.json +extension.webpack.config.js +*.vsix +yarn.lock diff --git a/extensions/sql-bindings/README.md b/extensions/sql-bindings/README.md new file mode 100644 index 0000000000..48cf7ffe99 --- /dev/null +++ b/extensions/sql-bindings/README.md @@ -0,0 +1,29 @@ +# Microsoft SQL Bindings for Azure Data Studio and VS Code + +## Overview + +Microsoft SQL Bindings for Azure Data Studio and VS Code enables users to develop Azure Functions with Azure SQL bindings + +### VS Code + +This extension is bundled into the `SQL Server (MSSQL)` extension for VS Code and will be installed automatically when that extension is updated or installed. + +### Azure Data Studio + +This extension is provided as a separate extension in the marketplace. + +Please report issues and feature requests [here.](https://github.com/microsoft/azuredatastudio/issues) + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Privacy Statement + +The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/privacystatement) describes the privacy statement of this software. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the [Source EULA](https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt). diff --git a/extensions/sql-bindings/VSCODE_DEVELOPMENT.md b/extensions/sql-bindings/VSCODE_DEVELOPMENT.md new file mode 100644 index 0000000000..998e95f058 --- /dev/null +++ b/extensions/sql-bindings/VSCODE_DEVELOPMENT.md @@ -0,0 +1,11 @@ +# VS Code Extension Development + +For working on the VS Code version of the package follow these steps for local development/testing. + +1. Copy the values from [package.vscode.json](./package.vscode.json) into [package.json](./package.json) (overwriting the properties with the same name there) +2. Compile Azure Data Studio as normal and wait for it to finish +3. Run `code /extensions/sql-bindings` from the command line to open a new VS Code instance at the `sql-bindings` folder +4. Run the `Launch Extension in VS Code` launch target from the `Run and Debug` view +5. This should launch an `Extension Development Host` version of VS Code that is running the extension from sources. + +If you have the compilation running as watch then once you make changes you can just reload the window to pick up the latest changes being made. diff --git a/extensions/sql-bindings/coverConfig.json b/extensions/sql-bindings/coverConfig.json new file mode 100644 index 0000000000..cc3ae238fa --- /dev/null +++ b/extensions/sql-bindings/coverConfig.json @@ -0,0 +1,20 @@ +{ + "enabled": true, + "relativeSourcePath": "..", + "relativeCoverageDir": "../../coverage", + "ignorePatterns": [ + "**/node_modules/**", + "**/test/**", + "extension.js" + ], + "reports": [ + "cobertura", + "lcov", + "json" + ], + "verbose": false, + "remapOptions": { + "basePath": "..", + "useAbsolutePaths": true + } +} diff --git a/extensions/sql-bindings/extension.webpack.config.js b/extensions/sql-bindings/extension.webpack.config.js new file mode 100644 index 0000000000..35b95ccffc --- /dev/null +++ b/extensions/sql-bindings/extension.webpack.config.js @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); + +module.exports = withDefaults({ + context: __dirname, + entry: { + extension: './src/extension.ts' + } +}); diff --git a/extensions/sql-bindings/package.json b/extensions/sql-bindings/package.json new file mode 100644 index 0000000000..53ee59e2f7 --- /dev/null +++ b/extensions/sql-bindings/package.json @@ -0,0 +1,32 @@ +{ + "name": "sql-bindings", + "displayName": "%displayName%", + "description": "%description%", + "version": "0.0.1", + "publisher": "Microsoft", + "preview": true, + "engines": { + "vscode": "^1.30.1", + "azdata": ">=1.35.0" + }, + "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", + "icon": "", + "aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e", + "activationEvents": [ + "*" + ], + "main": "./out/extension", + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/azuredatastudio.git" + }, + "extensionDependencies": [ + "Microsoft.mssql" + ], + "capabilities": { + "virtualWorkspaces": false, + "untrustedWorkspaces": { + "supported": true + } + } +} diff --git a/extensions/sql-bindings/package.nls.json b/extensions/sql-bindings/package.nls.json new file mode 100644 index 0000000000..937cb5ba20 --- /dev/null +++ b/extensions/sql-bindings/package.nls.json @@ -0,0 +1,4 @@ +{ + "%displayName%": "SQL Bindings", + "%description%": "Enables users to develop and publish Azure Functions with Azure SQL bindings" +} diff --git a/extensions/sql-bindings/package.vscode.json b/extensions/sql-bindings/package.vscode.json new file mode 100644 index 0000000000..853fc7d729 --- /dev/null +++ b/extensions/sql-bindings/package.vscode.json @@ -0,0 +1,7 @@ +{ + "name": "sql-bindings-vscode", + "publisher": "ms-mssql", + "extensionDependencies": [ + "ms-mssql.mssql" + ] +} \ No newline at end of file diff --git a/extensions/sql-bindings/src/extension.ts b/extensions/sql-bindings/src/extension.ts new file mode 100644 index 0000000000..155e182622 --- /dev/null +++ b/extensions/sql-bindings/src/extension.ts @@ -0,0 +1,10 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +export function activate(): void { +} + +export function deactivate(): void { +} diff --git a/extensions/sql-bindings/tsconfig.json b/extensions/sql-bindings/tsconfig.json new file mode 100644 index 0000000000..1655691c5f --- /dev/null +++ b/extensions/sql-bindings/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../tsconfig.base.json", + "compileOnSave": true, + "compilerOptions": { + "outDir": "./out", + "lib": [ + "es6", + "es2015.promise", + "dom" + ] + }, + "exclude": [ + "node_modules" + ] +} diff --git a/extensions/sql-bindings/yarn.lock b/extensions/sql-bindings/yarn.lock new file mode 100644 index 0000000000..fb57ccd13a --- /dev/null +++ b/extensions/sql-bindings/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +