Boilerplate for SQL Bindings Extension (#18624)

* boilerplate for sql bindings extension

* edit gulpfile task as it was trying to find specific menus within package.json
This commit is contained in:
Vasu Bhog
2022-03-04 15:16:45 -08:00
committed by GitHub
parent 8e9957adbe
commit c9aa3e9f4b
19 changed files with 206 additions and 6 deletions

View File

@@ -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));

View File

@@ -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'

View File

@@ -231,6 +231,7 @@ const externalExtensions = [
'schema-compare',
'server-report',
'sql-assessment',
'sql-bindings',
'sql-database-projects',
'sql-migration'
];

View File

@@ -267,6 +267,7 @@ const externalExtensions = [
'schema-compare',
'server-report',
'sql-assessment',
'sql-bindings',
'sql-database-projects',
'sql-migration'
];

View File

@@ -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',

View File

@@ -0,0 +1,13 @@
{
"parserOptions": {
"project": "./extensions/sql-bindings/tsconfig.json"
},
"rules": {
"@typescript-eslint/no-floating-promises": [
"error",
{
"ignoreVoid": true
}
]
}
}

1
extensions/sql-bindings/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.vsix

View File

@@ -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"
]
}
]
}

View File

@@ -0,0 +1,9 @@
src
out
tsconfig.json
.gitignore
coverage
coverConfig.json
extension.webpack.config.js
*.vsix
yarn.lock

View File

@@ -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).

View File

@@ -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 <PathToAzureDataStudioSource>/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.

View File

@@ -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
}
}

View File

@@ -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'
}
});

View File

@@ -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
}
}
}

View File

@@ -0,0 +1,4 @@
{
"%displayName%": "SQL Bindings",
"%description%": "Enables users to develop and publish Azure Functions with Azure SQL bindings"
}

View File

@@ -0,0 +1,7 @@
{
"name": "sql-bindings-vscode",
"publisher": "ms-mssql",
"extensionDependencies": [
"ms-mssql.mssql"
]
}

View File

@@ -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 {
}

View File

@@ -0,0 +1,15 @@
{
"extends": "../tsconfig.base.json",
"compileOnSave": true,
"compilerOptions": {
"outDir": "./out",
"lib": [
"es6",
"es2015.promise",
"dom"
]
},
"exclude": [
"node_modules"
]
}

View File

@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1