mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-19 18:46:52 -05:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebd620bf7b | ||
|
|
79980d95e4 | ||
|
|
49d19a9ab8 | ||
|
|
f5a866aa42 | ||
|
|
250d84923c | ||
|
|
f1ddea986a | ||
|
|
040549d264 | ||
|
|
4b51d9b386 | ||
|
|
73fbd787d8 | ||
|
|
b6f848eff1 | ||
|
|
6f21d6e27e | ||
|
|
af9c3d3872 | ||
|
|
7806a29bed | ||
|
|
0412b643d2 | ||
|
|
d7ee37a946 | ||
|
|
af53a13e6b | ||
|
|
98fa028ce5 | ||
|
|
ed4d4e33b5 | ||
|
|
6c83736626 | ||
|
|
959b4fbab5 | ||
|
|
3b7ff61000 | ||
|
|
cf283a9266 | ||
|
|
e28b86ea87 | ||
|
|
362664c4d8 | ||
|
|
c860a0edb2 | ||
|
|
8e11e460b5 | ||
|
|
ce4e7f4bef | ||
|
|
a8c7c69509 | ||
|
|
579e6bf0cb | ||
|
|
332dc03df0 | ||
|
|
24ea675d7d | ||
|
|
3df522536f | ||
|
|
f5aa49ebb9 | ||
|
|
3076390eb1 | ||
|
|
b7c935c602 | ||
|
|
bbb0f39a94 | ||
|
|
fe04fd72bc | ||
|
|
8a350809fd | ||
|
|
642514fd94 | ||
|
|
234c2f7c9e | ||
|
|
1b2e264c7d | ||
|
|
495c2e62e6 | ||
|
|
03baf3610a | ||
|
|
251ae01c3e | ||
|
|
9a1ac20710 | ||
|
|
f640bda802 | ||
|
|
f9ff1c5910 | ||
|
|
a63800deb1 | ||
|
|
e432884e25 | ||
|
|
0c14c3cc7f | ||
|
|
006eedd3a1 | ||
|
|
cb4fe55bef | ||
|
|
b33ffafdc0 | ||
|
|
e2efe69b73 | ||
|
|
8b85a47cf7 | ||
|
|
5afa287e47 | ||
|
|
0cc7c540a9 | ||
|
|
edd867b6fc | ||
|
|
7808496416 | ||
|
|
ad27f7dbba | ||
|
|
a6cb7cbd65 | ||
|
|
146fd41b50 | ||
|
|
fcb6f7f9ee | ||
|
|
94bd1c4d7d | ||
|
|
e4a0e4e0c1 |
@@ -11,6 +11,6 @@ trim_trailing_whitespace = true
|
|||||||
|
|
||||||
# The indent size used in the `package.json` file cannot be changed
|
# The indent size used in the `package.json` file cannot be changed
|
||||||
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
|
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
|
||||||
[{*.yml,*.yaml,npm-shrinkwrap.json,package.json}]
|
[{*.yml,*.yaml,package.json}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|||||||
@@ -10,5 +10,10 @@
|
|||||||
"no-extra-semi": "warn",
|
"no-extra-semi": "warn",
|
||||||
"semi": "warn"
|
"semi": "warn"
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended"
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
0
.gitattributes
vendored
0
.gitattributes
vendored
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1,22 +1,8 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
.DS_Store
|
|
||||||
*.dat
|
|
||||||
*.db
|
|
||||||
*.exe
|
|
||||||
*.log
|
|
||||||
*.nupkg
|
|
||||||
*.orig
|
|
||||||
*.vsix
|
|
||||||
*BROWSE.VC*
|
|
||||||
sqltoolsservice
|
|
||||||
coverage
|
|
||||||
test-reports
|
|
||||||
.vscode-test
|
|
||||||
node_modules/
|
node_modules/
|
||||||
.build/
|
.build/
|
||||||
.vs/
|
|
||||||
out/
|
out/
|
||||||
out-build/
|
out-build/
|
||||||
out-editor/
|
out-editor/
|
||||||
@@ -26,4 +12,5 @@ out-vscode/
|
|||||||
out-vscode-min/
|
out-vscode-min/
|
||||||
build/node_modules
|
build/node_modules
|
||||||
coverage/
|
coverage/
|
||||||
_site
|
test_data/
|
||||||
|
yarn-error.log
|
||||||
24
.travis.yml
24
.travis.yml
@@ -7,10 +7,13 @@ os:
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.npm
|
- $HOME/.cache/yarn
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
webhooks:
|
||||||
|
- http://vscode-probot.westus.cloudapp.azure.com:3450/travis/notifications
|
||||||
|
- http://vscode-test-probot.westus.cloudapp.azure.com:3450/travis/notifications
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
@@ -31,23 +34,26 @@ before_install:
|
|||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
- git clone --depth 1 https://github.com/creationix/nvm.git ./.nvm
|
- git clone --depth 1 https://github.com/creationix/nvm.git ./.nvm
|
||||||
- source ./.nvm/nvm.sh
|
- source ./.nvm/nvm.sh
|
||||||
- nvm install 7.9.0
|
- nvm install 8.9.1
|
||||||
- nvm use 7.9.0
|
- nvm use 8.9.1
|
||||||
- npm config set python `which python`
|
- npm i -g yarn
|
||||||
- npm install -g gulp
|
# - npm config set python `which python`
|
||||||
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
- if [ $TRAVIS_OS_NAME == "linux" ]; then
|
||||||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
|
||||||
sh -e /etc/init.d/xvfb start;
|
sh -e /etc/init.d/xvfb start;
|
||||||
sleep 3;
|
sleep 3;
|
||||||
fi
|
fi
|
||||||
|
# Make npm logs less verbose
|
||||||
|
# - npm config set depth 0
|
||||||
|
# - npm config set loglevel warn
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ./scripts/npm.sh install
|
- yarn
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- gulp electron --silent
|
- node_modules/.bin/gulp electron --silent
|
||||||
- gulp compile --silent --max_old_space_size=4096
|
- node_modules/.bin/gulp compile --silent --max_old_space_size=4096
|
||||||
- gulp optimize-vscode --silent --max_old_space_size=4096
|
- node_modules/.bin/gulp optimize-vscode --silent --max_old_space_size=4096
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/test.sh --coverage --reporter dot; else ./scripts/test.sh --reporter dot; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/test.sh --coverage --reporter dot; else ./scripts/test.sh --reporter dot; fi
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
|||||||
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@@ -104,6 +104,7 @@
|
|||||||
},
|
},
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"args": [
|
"args": [
|
||||||
|
"--delay",
|
||||||
"--timeout",
|
"--timeout",
|
||||||
"2000"
|
"2000"
|
||||||
],
|
],
|
||||||
|
|||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -34,5 +34,7 @@
|
|||||||
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
|
"command": "${workspaceFolder}\\scripts\\test.bat --coverage --run ${file}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
|
"git.ignoreLimitWarning": true
|
||||||
}
|
}
|
||||||
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
@@ -33,11 +33,11 @@
|
|||||||
"task": "tslint",
|
"task": "tslint",
|
||||||
"label": "Run tslint",
|
"label": "Run tslint",
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
"$tslint4"
|
"$tslint5"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskName": "Run tests",
|
"label": "Run tests",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./scripts/test.sh",
|
"command": "./scripts/test.sh",
|
||||||
"windows": {
|
"windows": {
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskName": "Run Dev",
|
"label": "Run Dev",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./scripts/code.sh",
|
"command": "./scripts/code.sh",
|
||||||
"windows": {
|
"windows": {
|
||||||
|
|||||||
3
.yarnrc
Normal file
3
.yarnrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
disturl "https://atom.io/download/electron"
|
||||||
|
target "1.7.11"
|
||||||
|
runtime "electron"
|
||||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,6 +1,38 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
## Version 0.25.2
|
## Version 0.26.4
|
||||||
|
* Release date: February 15, 2017
|
||||||
|
* Release status: Public Preview
|
||||||
|
|
||||||
|
## What's new in this version
|
||||||
|
The February release fixes several important customer reported issues, as well as various feature improvements. We've also introduced auto-update support in February which will simplify keeping updated with the lastest changes.
|
||||||
|
|
||||||
|
Here's some of the highlights in the February release.
|
||||||
|
|
||||||
|
* Support Auto-Update installation on Windows and macOS
|
||||||
|
* Publish RPM and DEB packages to offical Microsoft repos
|
||||||
|
* Fix #6 Keep connection and selected database when opening new query tabs
|
||||||
|
* Fix #22 'Server Name' and 'Database Name' - Can these be drop downs instead of text boxes?
|
||||||
|
* Fix #549 Silent/Very Silent Install results in application opening after installation
|
||||||
|
* Fix #481 Add "Check for updates" option.
|
||||||
|
* SQL Editor colorization and auto-completion fixes
|
||||||
|
* #584 Keyword "FULL" not highlighted by IntelliSense
|
||||||
|
* #345 Colorize SQL functions within the editor
|
||||||
|
* #300 [#tempData] latest "]" will display green color
|
||||||
|
* #225 Keyword color mismatch
|
||||||
|
* #60 invalid sql syntax color highlighting when using temporary table in from clause
|
||||||
|
* Introduce Connection extensibility API
|
||||||
|
* VS Code Editor 1.19 integration
|
||||||
|
* Update JustinPealing/html-query-plan component to pick-up several Query Plan viewer improvements
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
* mikaoelitiana for fix: `revert README and CONTRIBUTING after last VSCode merge (#574)`
|
||||||
|
* alextercete for `Reinstate menu item to install from VSIX (#682)`
|
||||||
|
|
||||||
|
## Version 0.25.4
|
||||||
* Release date: January 17, 2017
|
* Release date: January 17, 2017
|
||||||
* Release status: Public Preview
|
* Release status: Public Preview
|
||||||
|
|
||||||
@@ -23,6 +55,7 @@ Here's some of the highlights in the January release.
|
|||||||
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
|
||||||
## Version 0.24.1
|
## Version 0.24.1
|
||||||
* Release date: December 19, 2017
|
* Release date: December 19, 2017
|
||||||
|
|||||||
@@ -771,5 +771,42 @@
|
|||||||
"\"\"\""
|
"\"\"\""
|
||||||
],
|
],
|
||||||
"isProd": true
|
"isProd": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spdlog original",
|
||||||
|
"version": "0.14.0",
|
||||||
|
"repositoryURL": "https://github.com/gabime/spdlog",
|
||||||
|
"license": "MIT",
|
||||||
|
"isProd": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isLicense": true,
|
||||||
|
"name": "spdlog",
|
||||||
|
"version": "0.14.0",
|
||||||
|
"repositoryURL": "https://github.com/gabime/spdlog",
|
||||||
|
"license": "MIT",
|
||||||
|
"licenseDetail": [
|
||||||
|
"MIT License",
|
||||||
|
"",
|
||||||
|
"Copyright (c) Microsoft Corporation. All rights reserved.",
|
||||||
|
"",
|
||||||
|
"Permission is hereby granted, free of charge, to any person obtaining a copy",
|
||||||
|
"of this software and associated documentation files (the \"Software\"), to deal",
|
||||||
|
"in the Software without restriction, including without limitation the rights",
|
||||||
|
"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell",
|
||||||
|
"copies of the Software, and to permit persons to whom the Software is",
|
||||||
|
"furnished to do so, subject to the following conditions:",
|
||||||
|
"",
|
||||||
|
"The above copyright notice and this permission notice shall be included in all",
|
||||||
|
"copies or substantial portions of the Software.",
|
||||||
|
"",
|
||||||
|
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
|
||||||
|
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
||||||
|
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
|
||||||
|
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
||||||
|
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
|
||||||
|
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
|
||||||
|
"SOFTWARE"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -2,21 +2,23 @@
|
|||||||
|
|
||||||
SQL Operations Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
|
SQL Operations Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
|
||||||
|
|
||||||
**Download SQL Operations Studio December Public Preview**
|
**Download SQL Operations Studio February Public Preview**
|
||||||
|
|
||||||
Platform | Link
|
Platform | Link
|
||||||
-- | --
|
-- | --
|
||||||
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=865305
|
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=866480
|
||||||
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=865304
|
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=866479
|
||||||
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=865306
|
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=866481
|
||||||
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=865307
|
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=866482
|
||||||
Linux DEB | https://go.microsoft.com/fwlink/?linkid=865308
|
Linux DEB | https://go.microsoft.com/fwlink/?linkid=866484
|
||||||
Linux RPM | https://go.microsoft.com/fwlink/?linkid=865309
|
Linux RPM | https://go.microsoft.com/fwlink/?linkid=866483
|
||||||
|
|
||||||
Go to our [download page](https://aka.ms/sqlopsstudio) for more specific instructions.
|
Go to our [download page](https://aka.ms/sqlopsstudio) for more specific instructions.
|
||||||
|
|
||||||
Try out the latest insiders build from `master` at https://github.com/Microsoft/sqlopsstudio/releases.
|
Try out the latest insiders build from `master` at https://github.com/Microsoft/sqlopsstudio/releases.
|
||||||
|
|
||||||
|
See the [change log](https://github.com/Microsoft/sqlopsstudio/blob/master/CHANGELOG.md) for additional details of what's in this release.
|
||||||
|
|
||||||
**Feature Highlights**
|
**Feature Highlights**
|
||||||
|
|
||||||
- Cross-Platform DB management for Windows, macOS and Linux with simple XCopy deployment
|
- Cross-Platform DB management for Windows, macOS and Linux with simple XCopy deployment
|
||||||
@@ -49,6 +51,21 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
|
|||||||
## Privacy Statement
|
## Privacy Statement
|
||||||
The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software.
|
The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software.
|
||||||
|
|
||||||
|
## Contributions and "thank you"
|
||||||
|
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||||
|
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
* mikaoelitiana for fix: `revert README and CONTRIBUTING after last VSCode merge (#574)`
|
||||||
|
* alextercete for `Reinstate menu item to install from VSIX (#682)`
|
||||||
|
* alextercete for `Fix "No extension gallery service configured" error (#427)`
|
||||||
|
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||||
|
* mwiedemeyer for `Fix #58: Default sort order for DB size widget (#111)`
|
||||||
|
* AlexTroshkin for `Show disconnect in context menu only when connectionProfile connected (#150)`
|
||||||
|
* AlexTroshkin for `Fix #138: Invalid syntax color highlighting (identity not highlighting) (#140))`
|
||||||
|
* stebet for `Fix #153: Fixing sql snippets that failed on a DB with case-sensitive collation. (#152)`
|
||||||
|
* SebastianPfliegel `Remove sqlExtensionHelp (#312)`
|
||||||
|
* olljanat for `Implemented npm version check (#314)`
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|||||||
@@ -3,19 +3,17 @@ environment:
|
|||||||
VSCODE_BUILD_VERBOSE: true
|
VSCODE_BUILD_VERBOSE: true
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- '%APPDATA%\npm-cache'
|
- '%LOCALAPPDATA%\Yarn\cache'
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: Install-Product node 7.9.0 x64
|
- ps: Install-Product node 8.9.1 x64
|
||||||
- npm install -g npm@4 --silent
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- .\scripts\npm.bat install
|
- yarn
|
||||||
- .\node_modules\.bin\gulp electron
|
- .\node_modules\.bin\gulp electron
|
||||||
- npm run compile
|
- npm run compile
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- node --version
|
- node --version
|
||||||
- npm --version
|
|
||||||
- .\scripts\test.bat
|
- .\scripts\test.bat
|
||||||
- .\scripts\test-integration.bat
|
- .\scripts\test-integration.bat
|
||||||
|
|||||||
74
build/dependencies.js
Normal file
74
build/dependencies.js
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const parseSemver = require('parse-semver');
|
||||||
|
const cp = require('child_process');
|
||||||
|
const _ = require('underscore');
|
||||||
|
|
||||||
|
function asYarnDependency(prefix, tree) {
|
||||||
|
let parseResult;
|
||||||
|
|
||||||
|
try {
|
||||||
|
parseResult = parseSemver(tree.name);
|
||||||
|
} catch (err) {
|
||||||
|
err.message += `: ${tree.name}`;
|
||||||
|
console.warn(`Could not parse semver: ${tree.name}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// not an actual dependency in disk
|
||||||
|
if (parseResult.version !== parseResult.range) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = parseResult.name;
|
||||||
|
const version = parseResult.version;
|
||||||
|
const dependencyPath = path.join(prefix, name);
|
||||||
|
const children = [];
|
||||||
|
|
||||||
|
for (const child of (tree.children || [])) {
|
||||||
|
const dep = asYarnDependency(path.join(prefix, name, 'node_modules'), child);
|
||||||
|
|
||||||
|
if (dep) {
|
||||||
|
children.push(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { name, version, path: dependencyPath, children };
|
||||||
|
}
|
||||||
|
|
||||||
|
function getYarnProductionDependencies(cwd) {
|
||||||
|
const raw = cp.execSync('yarn list --json', { cwd, encoding: 'utf8', env: { ...process.env, NODE_ENV: 'production' }, stdio: [null, null, 'ignore'] });
|
||||||
|
const match = /^{"type":"tree".*$/m.exec(raw);
|
||||||
|
|
||||||
|
if (!match || match.length !== 1) {
|
||||||
|
throw new Error('Could not parse result of `yarn list --json`');
|
||||||
|
}
|
||||||
|
|
||||||
|
const trees = JSON.parse(match[0]).data.trees;
|
||||||
|
|
||||||
|
return trees
|
||||||
|
.map(tree => asYarnDependency(path.join(cwd, 'node_modules'), tree))
|
||||||
|
.filter(dep => !!dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProductionDependencies(cwd) {
|
||||||
|
const result = [];
|
||||||
|
const deps = getYarnProductionDependencies(cwd);
|
||||||
|
const flatten = dep => { result.push({ name: dep.name, version: dep.version, path: dep.path }); dep.children.forEach(flatten); };
|
||||||
|
deps.forEach(flatten);
|
||||||
|
|
||||||
|
return _.uniq(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getProductionDependencies = getProductionDependencies;
|
||||||
|
|
||||||
|
if (require.main === module) {
|
||||||
|
const root = path.dirname(__dirname);
|
||||||
|
console.log(JSON.stringify(getProductionDependencies(root), null, ' '));
|
||||||
|
}
|
||||||
@@ -62,6 +62,8 @@ const tasks = compilations.map(function (tsconfigFile) {
|
|||||||
const reporter = createReporter();
|
const reporter = createReporter();
|
||||||
|
|
||||||
tsOptions.inlineSources = !!build;
|
tsOptions.inlineSources = !!build;
|
||||||
|
tsOptions.base = path.dirname(absolutePath);
|
||||||
|
|
||||||
const compilation = tsb.create(tsOptions, null, null, err => reporter(err.toString()));
|
const compilation = tsb.create(tsOptions, null, null, err => reporter(err.toString()));
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ const eolFilter = [
|
|||||||
'!ThirdPartyNotices.txt',
|
'!ThirdPartyNotices.txt',
|
||||||
'!LICENSE.txt',
|
'!LICENSE.txt',
|
||||||
'!extensions/**/out/**',
|
'!extensions/**/out/**',
|
||||||
|
'!test/smoke/out/**',
|
||||||
'!**/node_modules/**',
|
'!**/node_modules/**',
|
||||||
'!**/fixtures/**',
|
'!**/fixtures/**',
|
||||||
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot}',
|
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot}',
|
||||||
@@ -56,6 +57,7 @@ const indentationFilter = [
|
|||||||
'!**/*.template',
|
'!**/*.template',
|
||||||
'!**/*.yaml',
|
'!**/*.yaml',
|
||||||
'!**/*.yml',
|
'!**/*.yml',
|
||||||
|
'!**/yarn.lock',
|
||||||
'!**/lib/**',
|
'!**/lib/**',
|
||||||
'!extensions/**/*.d.ts',
|
'!extensions/**/*.d.ts',
|
||||||
'!src/typings/**/*.d.ts',
|
'!src/typings/**/*.d.ts',
|
||||||
@@ -63,11 +65,11 @@ const indentationFilter = [
|
|||||||
'!**/*.d.ts.recipe',
|
'!**/*.d.ts.recipe',
|
||||||
'!test/assert.js',
|
'!test/assert.js',
|
||||||
'!**/package.json',
|
'!**/package.json',
|
||||||
'!**/npm-shrinkwrap.json',
|
|
||||||
'!**/octicons/**',
|
'!**/octicons/**',
|
||||||
'!**/vs/base/common/marked/raw.marked.js',
|
'!**/vs/base/common/marked/raw.marked.js',
|
||||||
'!**/vs/base/common/winjs.base.raw.js',
|
'!**/vs/base/common/winjs.base.raw.js',
|
||||||
'!**/vs/base/node/terminateProcess.sh',
|
'!**/vs/base/node/terminateProcess.sh',
|
||||||
|
'!**/vs/base/node/ps-win.ps1',
|
||||||
'!**/vs/nls.js',
|
'!**/vs/nls.js',
|
||||||
'!**/vs/css.js',
|
'!**/vs/css.js',
|
||||||
'!**/vs/loader.js',
|
'!**/vs/loader.js',
|
||||||
@@ -122,7 +124,8 @@ const tslintFilter = [
|
|||||||
'!**/node_modules/**',
|
'!**/node_modules/**',
|
||||||
'!extensions/typescript/test/colorize-fixtures/**',
|
'!extensions/typescript/test/colorize-fixtures/**',
|
||||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||||
'!extensions/**/*.test.ts'
|
'!extensions/**/*.test.ts',
|
||||||
|
'!extensions/html/server/lib/jquery.d.ts'
|
||||||
];
|
];
|
||||||
|
|
||||||
const copyrightHeader = [
|
const copyrightHeader = [
|
||||||
@@ -132,17 +135,6 @@ const copyrightHeader = [
|
|||||||
' *--------------------------------------------------------------------------------------------*/'
|
' *--------------------------------------------------------------------------------------------*/'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
function reportFailures(failures) {
|
|
||||||
failures.forEach(failure => {
|
|
||||||
const name = failure.name || failure.fileName;
|
|
||||||
const position = failure.startPosition;
|
|
||||||
const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line;
|
|
||||||
const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character;
|
|
||||||
|
|
||||||
console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('eslint', () => {
|
gulp.task('eslint', () => {
|
||||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||||
.pipe(filter(eslintFilter))
|
.pipe(filter(eslintFilter))
|
||||||
@@ -152,12 +144,12 @@ gulp.task('eslint', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('tslint', () => {
|
gulp.task('tslint', () => {
|
||||||
const options = { summarizeFailureOutput: true };
|
const options = { emitError: false };
|
||||||
|
|
||||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||||
.pipe(filter(tslintFilter))
|
.pipe(filter(tslintFilter))
|
||||||
.pipe(gulptslint({ rulesDirectory: 'build/lib/tslint' }))
|
.pipe(gulptslint({ rulesDirectory: 'build/lib/tslint' }))
|
||||||
.pipe(gulptslint.report(reportFailures, options));
|
.pipe(gulptslint.report(options));
|
||||||
});
|
});
|
||||||
|
|
||||||
const hygiene = exports.hygiene = (some, options) => {
|
const hygiene = exports.hygiene = (some, options) => {
|
||||||
@@ -219,6 +211,17 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function reportFailures(failures) {
|
||||||
|
failures.forEach(failure => {
|
||||||
|
const name = failure.name || failure.fileName;
|
||||||
|
const position = failure.startPosition;
|
||||||
|
const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line;
|
||||||
|
const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character;
|
||||||
|
|
||||||
|
// console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const tsl = es.through(function (file) {
|
const tsl = es.through(function (file) {
|
||||||
const configuration = tslint.Configuration.findConfiguration(null, '.');
|
const configuration = tslint.Configuration.findConfiguration(null, '.');
|
||||||
const options = { formatter: 'json', rulesDirectory: 'build/lib/tslint' };
|
const options = { formatter: 'json', rulesDirectory: 'build/lib/tslint' };
|
||||||
@@ -227,9 +230,9 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
linter.lint(file.relative, contents, configuration.results);
|
linter.lint(file.relative, contents, configuration.results);
|
||||||
const result = linter.getResult();
|
const result = linter.getResult();
|
||||||
|
|
||||||
if (result.failureCount > 0) {
|
if (result.failures.length > 0) {
|
||||||
reportFailures(result.failures);
|
reportFailures(result.failures);
|
||||||
errorCount += result.failureCount;
|
errorCount += result.failures.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit('data', file);
|
this.emit('data', file);
|
||||||
@@ -254,20 +257,20 @@ const hygiene = exports.hygiene = (some, options) => {
|
|||||||
const javascript = result
|
const javascript = result
|
||||||
.pipe(filter(eslintFilter))
|
.pipe(filter(eslintFilter))
|
||||||
.pipe(gulpeslint('src/.eslintrc'))
|
.pipe(gulpeslint('src/.eslintrc'))
|
||||||
.pipe(gulpeslint.formatEach('compact'));
|
.pipe(gulpeslint.formatEach('compact'))
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
// .pipe(gulpeslint.failAfterError());
|
// .pipe(gulpeslint.failAfterError());
|
||||||
|
|
||||||
return es.merge(typescript, javascript)
|
return es.merge(typescript, javascript)
|
||||||
.pipe(es.through(null, function () {
|
.pipe(es.through(null, function () {
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
// if (errorCount > 0) {
|
// if (errorCount > 0) {
|
||||||
// this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
// this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
||||||
// } else {
|
// } else {
|
||||||
// this.emit('end');
|
// this.emit('end');
|
||||||
// }
|
// }
|
||||||
this.emit('end');
|
this.emit('end');
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('hygiene', () => hygiene(''));
|
gulp.task('hygiene', () => hygiene(''));
|
||||||
@@ -303,11 +306,13 @@ if (require.main === module) {
|
|||||||
.split(/\r?\n/)
|
.split(/\r?\n/)
|
||||||
.filter(l => !!l);
|
.filter(l => !!l);
|
||||||
|
|
||||||
hygiene(some, { skipEOL: skipEOL }).on('error', err => {
|
if (some.length > 0) {
|
||||||
console.error();
|
hygiene(some, { skipEOL: skipEOL }).on('error', err => {
|
||||||
console.error(err);
|
console.error();
|
||||||
process.exit(1);
|
console.error(err);
|
||||||
});
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,21 +6,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const json = require('gulp-json-editor');
|
// {{SQL CARBON EDIT}}
|
||||||
const buffer = require('gulp-buffer');
|
const jeditor = require('gulp-json-editor');
|
||||||
const filter = require('gulp-filter');
|
|
||||||
const es = require('event-stream');
|
|
||||||
const util = require('./lib/util');
|
|
||||||
const remote = require('gulp-remote-src');
|
|
||||||
const zip = require('gulp-vinyl-zip');
|
|
||||||
const assign = require('object-assign');
|
|
||||||
const pkg = require('../package.json');
|
|
||||||
|
|
||||||
gulp.task('mixin', function () {
|
gulp.task('mixin', function () {
|
||||||
const repo = process.env['VSCODE_MIXIN_REPO'];
|
// {{SQL CARBON EDIT}}
|
||||||
|
const updateUrl = process.env['SQLOPS_UPDATEURL'];
|
||||||
if (!repo) {
|
if (!updateUrl) {
|
||||||
console.log('Missing VSCODE_MIXIN_REPO, skipping mixin');
|
console.log('Missing SQLOPS_UPDATEURL, skipping mixin');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,39 +24,13 @@ gulp.task('mixin', function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://github.com/${repo}/archive/${pkg.distro}.zip`;
|
// {{SQL CARBON EDIT}}
|
||||||
const opts = { base: url };
|
let newValues = {
|
||||||
const username = process.env['VSCODE_MIXIN_USERNAME'];
|
"updateUrl": updateUrl,
|
||||||
const password = process.env['VSCODE_MIXIN_PASSWORD'];
|
"quality": quality
|
||||||
|
};
|
||||||
|
|
||||||
if (username || password) {
|
return gulp.src('./product.json')
|
||||||
opts.auth = { user: username || '', pass: password || '' };
|
.pipe(jeditor(newValues))
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Mixing in sources from \'' + url + '\':');
|
|
||||||
|
|
||||||
let all = remote('', opts)
|
|
||||||
.pipe(zip.src())
|
|
||||||
.pipe(filter(function (f) { return !f.isDirectory(); }))
|
|
||||||
.pipe(util.rebase(1));
|
|
||||||
|
|
||||||
if (quality) {
|
|
||||||
const productJsonFilter = filter('product.json', { restore: true });
|
|
||||||
const mixin = all
|
|
||||||
.pipe(filter(['quality/' + quality + '/**']))
|
|
||||||
.pipe(util.rebase(2))
|
|
||||||
.pipe(productJsonFilter)
|
|
||||||
.pipe(buffer())
|
|
||||||
.pipe(json(o => assign({}, require('../product.json'), o)))
|
|
||||||
.pipe(productJsonFilter.restore);
|
|
||||||
|
|
||||||
all = es.merge(mixin);
|
|
||||||
}
|
|
||||||
|
|
||||||
return all
|
|
||||||
.pipe(es.mapSync(function (f) {
|
|
||||||
console.log(f.relative);
|
|
||||||
return f;
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
@@ -13,10 +13,6 @@ const filter = require('gulp-filter');
|
|||||||
|
|
||||||
gulp.task('clean-mssql-extension', util.rimraf('extensions/mssql/node_modules'));
|
gulp.task('clean-mssql-extension', util.rimraf('extensions/mssql/node_modules'));
|
||||||
gulp.task('clean-credentials-extension', util.rimraf('extensions/credentials/node_modules'));
|
gulp.task('clean-credentials-extension', util.rimraf('extensions/credentials/node_modules'));
|
||||||
gulp.task('clean-client', util.rimraf('dataprotocol-node/client/node_modules'));
|
|
||||||
gulp.task('clean-jsonrpc', util.rimraf('dataprotocol-node/jsonrpc/node_modules'));
|
|
||||||
gulp.task('clean-server', util.rimraf('dataprotocol-node/server/node_modules'));
|
|
||||||
gulp.task('clean-types', util.rimraf('dataprotocol-node/types/node_modules'));
|
|
||||||
gulp.task('clean-extensions-modules', util.rimraf('extensions-modules/node_modules'));
|
gulp.task('clean-extensions-modules', util.rimraf('extensions-modules/node_modules'));
|
||||||
gulp.task('clean-protocol', ['clean-extensions-modules', 'clean-mssql-extension', 'clean-credentials-extension', 'clean-client', 'clean-jsonrpc', 'clean-server', 'clean-types']);
|
gulp.task('clean-protocol', ['clean-extensions-modules', 'clean-mssql-extension', 'clean-credentials-extension', 'clean-client', 'clean-jsonrpc', 'clean-server', 'clean-types']);
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,19 @@ const root = path.dirname(__dirname);
|
|||||||
const commit = util.getVersion(root);
|
const commit = util.getVersion(root);
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
const product = require('../product.json');
|
const product = require('../product.json');
|
||||||
const shrinkwrap = require('../npm-shrinkwrap.json');
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const i18n = require('./lib/i18n');
|
const i18n = require('./lib/i18n');
|
||||||
var del = require('del');
|
const serviceInstaller = require('../extensions-modules/lib/languageservice/serviceInstallerUtil');
|
||||||
|
const glob = require('glob');
|
||||||
|
const deps = require('./dependencies');
|
||||||
|
const getElectronVersion = require('./lib/electron').getElectronVersion;
|
||||||
|
|
||||||
|
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const serviceInstaller = require('extensions-modules/lib/languageservice/serviceInstallerUtil');
|
var del = require('del');
|
||||||
const glob = require('glob');
|
const extensionsRoot = path.join(root, 'extensions');
|
||||||
|
const extensionsProductionDependencies = deps.getProductionDependencies(extensionsRoot);
|
||||||
const productDependencies = Object.keys(product.dependencies || {});
|
|
||||||
const dependencies = Object.keys(shrinkwrap.dependencies)
|
|
||||||
.concat(productDependencies); // additional dependencies from our product configuration
|
|
||||||
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
const baseModules = Object.keys(process.binding('natives')).filter(n => !/^_|\//.test(n));
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const nodeModules = [
|
const nodeModules = [
|
||||||
@@ -50,14 +51,15 @@ const nodeModules = [
|
|||||||
'rxjs/Subject',
|
'rxjs/Subject',
|
||||||
'rxjs/Observer',
|
'rxjs/Observer',
|
||||||
'ng2-charts/ng2-charts']
|
'ng2-charts/ng2-charts']
|
||||||
.concat(dependencies)
|
.concat(Object.keys(product.dependencies || {}))
|
||||||
|
.concat(_.uniq(productionDependencies.map(d => d.name)))
|
||||||
.concat(baseModules);
|
.concat(baseModules);
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
|
|
||||||
const builtInExtensions = [
|
const builtInExtensions = [
|
||||||
{ name: 'ms-vscode.node-debug', version: '1.18.3' },
|
{ name: 'ms-vscode.node-debug', version: '1.19.8' },
|
||||||
{ name: 'ms-vscode.node-debug2', version: '1.18.5' }
|
{ name: 'ms-vscode.node-debug2', version: '1.19.4' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const excludedExtensions = [
|
const excludedExtensions = [
|
||||||
@@ -79,8 +81,8 @@ const vscodeResources = [
|
|||||||
'out-build/bootstrap-amd.js',
|
'out-build/bootstrap-amd.js',
|
||||||
'out-build/paths.js',
|
'out-build/paths.js',
|
||||||
'out-build/vs/**/*.{svg,png,cur,html}',
|
'out-build/vs/**/*.{svg,png,cur,html}',
|
||||||
'out-build/vs/base/node/startupTimers.js',
|
'out-build/vs/base/common/performance.js',
|
||||||
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh}',
|
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,ps-win.ps1}',
|
||||||
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
||||||
'out-build/vs/workbench/browser/media/*-theme.css',
|
'out-build/vs/workbench/browser/media/*-theme.css',
|
||||||
'out-build/vs/workbench/electron-browser/bootstrap/**',
|
'out-build/vs/workbench/electron-browser/bootstrap/**',
|
||||||
@@ -94,7 +96,7 @@ const vscodeResources = [
|
|||||||
'out-build/vs/workbench/services/files/**/*.exe',
|
'out-build/vs/workbench/services/files/**/*.exe',
|
||||||
'out-build/vs/workbench/services/files/**/*.md',
|
'out-build/vs/workbench/services/files/**/*.md',
|
||||||
'out-build/vs/code/electron-browser/sharedProcess.js',
|
'out-build/vs/code/electron-browser/sharedProcess.js',
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
'out-build/sql/workbench/electron-browser/splashscreen/*',
|
'out-build/sql/workbench/electron-browser/splashscreen/*',
|
||||||
'out-build/sql/**/*.{svg,png,cur,html}',
|
'out-build/sql/**/*.{svg,png,cur,html}',
|
||||||
'out-build/sql/base/browser/ui/table/media/*.{gif,png,svg}',
|
'out-build/sql/base/browser/ui/table/media/*.{gif,png,svg}',
|
||||||
@@ -154,10 +156,10 @@ gulp.task('minify-vscode', ['clean-minified-vscode', 'optimize-index-js'], commo
|
|||||||
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
version: packageJson.electronVersion,
|
version: getElectronVersion(),
|
||||||
productAppName: product.nameLong,
|
productAppName: product.nameLong,
|
||||||
companyName: 'Microsoft Corporation',
|
companyName: 'Microsoft Corporation',
|
||||||
copyright: 'Copyright (C) 2018 Microsoft. All rights reserved',
|
copyright: 'Copyright (C) 2017 Microsoft. All rights reserved',
|
||||||
darwinIcon: 'resources/darwin/code.icns',
|
darwinIcon: 'resources/darwin/code.icns',
|
||||||
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
||||||
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
||||||
@@ -243,7 +245,7 @@ function computeChecksum(filename) {
|
|||||||
function packageTask(platform, arch, opts) {
|
function packageTask(platform, arch, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const destination = path.join(path.dirname(root), 'sqlops') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
|
const destination = path.join(path.dirname(root), 'sqlops') + (platform ? '-' + platform : '') + (arch ? '-' + arch : '');
|
||||||
platform = platform || process.platform;
|
platform = platform || process.platform;
|
||||||
|
|
||||||
@@ -283,9 +285,18 @@ function packageTask(platform, arch, opts) {
|
|||||||
.pipe(nlsFilter.restore);
|
.pipe(nlsFilter.restore);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const localExtensionDependencies = gulp.src('extensions/node_modules/**', { base: '.' });
|
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
|
const extensionDepsSrc = [
|
||||||
|
..._.flatten(extensionsProductionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])),
|
||||||
|
];
|
||||||
|
|
||||||
|
const localExtensionDependencies = gulp.src(extensionDepsSrc, { base: '.', dot: true })
|
||||||
|
.pipe(filter(['**', '!**/package-lock.json']))
|
||||||
|
.pipe(util.cleanNodeModule('account-provider-azure', ['node_modules/date-utils/doc/**', 'node_modules/adal_node/node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('dataprotocol-client', ['node_modules/**', 'src/*.js'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('extensions-modules', ['node_modules/**', 'src/*.js'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('typescript', ['**/**'], undefined));
|
||||||
|
|
||||||
const sources = es.merge(src, localExtensions, localExtensionDependencies)
|
const sources = es.merge(src, localExtensions, localExtensionDependencies)
|
||||||
.pipe(util.setExecutableBit(['**/*.sh']))
|
.pipe(util.setExecutableBit(['**/*.sh']))
|
||||||
.pipe(filter(['**',
|
.pipe(filter(['**',
|
||||||
@@ -318,8 +329,10 @@ function packageTask(platform, arch, opts) {
|
|||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const dataApi = gulp.src('src/vs/data.d.ts').pipe(rename('out/sql/data.d.ts'));
|
const dataApi = gulp.src('src/vs/data.d.ts').pipe(rename('out/sql/data.d.ts'));
|
||||||
|
|
||||||
const depsSrc = _.flatten(dependencies
|
const depsSrc = [
|
||||||
.map(function (d) { return ['node_modules/' + d + '/**', '!node_modules/' + d + '/**/{test,tests}/**']; }));
|
..._.flatten(productionDependencies.map(d => path.relative(root, d.path)).map(d => [`${d}/**`, `!${d}/**/{test,tests}/**`])),
|
||||||
|
..._.flatten(Object.keys(product.dependencies || {}).map(d => [`node_modules/${d}/**`, `!node_modules/${d}/**/{test,tests}/**`]))
|
||||||
|
];
|
||||||
|
|
||||||
const deps = gulp.src(depsSrc, { base: '.', dot: true })
|
const deps = gulp.src(depsSrc, { base: '.', dot: true })
|
||||||
.pipe(filter(['**', '!**/package-lock.json']))
|
.pipe(filter(['**', '!**/package-lock.json']))
|
||||||
@@ -328,13 +341,22 @@ function packageTask(platform, arch, opts) {
|
|||||||
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
|
.pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
|
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
|
||||||
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
||||||
.pipe(util.cleanNodeModule('v8-profiler', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
|
||||||
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
|
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
|
||||||
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/**']))
|
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.node', 'build/Release/*.dll', 'build/Release/*.exe']))
|
||||||
|
.pipe(util.cleanNodeModule('chart.js', ['node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('emmet', ['node_modules/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('pty.js', ['build/**'], ['build/Release/**']))
|
||||||
|
.pipe(util.cleanNodeModule('jquery-ui', ['external/**', 'demos/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('core-js', ['**/**'], undefined))
|
||||||
|
.pipe(util.cleanNodeModule('slickgrid', ['node_modules/**', 'examples/**'], undefined))
|
||||||
|
|
||||||
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
||||||
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']));
|
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']));
|
||||||
|
|
||||||
@@ -487,7 +509,7 @@ gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], () => {
|
|||||||
const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');
|
const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');
|
||||||
gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => {
|
gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => {
|
||||||
const branch = process.env.BUILD_SOURCEBRANCH;
|
const branch = process.env.BUILD_SOURCEBRANCH;
|
||||||
if (!branch.endsWith('/master') && !branch.indexOf('/release/') >= 0) {
|
if (!branch.endsWith('/master') && branch.indexOf('/release/') < 0) {
|
||||||
console.log(`Only runs on master and release branches, not ${branch}`);
|
console.log(`Only runs on master and release branches, not ${branch}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
28
build/lib/electron.js
Normal file
28
build/lib/electron.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const root = path.dirname(path.dirname(__dirname));
|
||||||
|
|
||||||
|
function getElectronVersion() {
|
||||||
|
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
|
||||||
|
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
|
||||||
|
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getElectronVersion = getElectronVersion;
|
||||||
|
|
||||||
|
// returns 0 if the right version of electron is in .build/electron
|
||||||
|
if (require.main === module) {
|
||||||
|
const version = getElectronVersion();
|
||||||
|
const versionFile = path.join(root, '.build', 'electron', 'version');
|
||||||
|
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `v${version}`;
|
||||||
|
|
||||||
|
process.exit(isUpToDate ? 0 : 1);
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@ var vsce = require("vsce");
|
|||||||
var File = require("vinyl");
|
var File = require("vinyl");
|
||||||
function fromLocal(extensionPath) {
|
function fromLocal(extensionPath) {
|
||||||
var result = es.through();
|
var result = es.through();
|
||||||
vsce.listFiles({ cwd: extensionPath })
|
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||||
.then(function (fileNames) {
|
.then(function (fileNames) {
|
||||||
var files = fileNames
|
var files = fileNames
|
||||||
.map(function (fileName) { return path.join(extensionPath, fileName); })
|
.map(function (fileName) { return path.join(extensionPath, fileName); })
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import * as File from 'vinyl';
|
|||||||
export function fromLocal(extensionPath: string): Stream {
|
export function fromLocal(extensionPath: string): Stream {
|
||||||
const result = es.through();
|
const result = es.through();
|
||||||
|
|
||||||
vsce.listFiles({ cwd: extensionPath })
|
vsce.listFiles({ cwd: extensionPath, packageManager: vsce.PackageManager.Yarn })
|
||||||
.then(fileNames => {
|
.then(fileNames => {
|
||||||
const files = fileNames
|
const files = fileNames
|
||||||
.map(fileName => path.join(extensionPath, fileName))
|
.map(fileName => path.join(extensionPath, fileName))
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ var XLF = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
XLF.prototype.addStringItem = function (item) {
|
XLF.prototype.addStringItem = function (item) {
|
||||||
if (!item.id || !item.message) {
|
if (!item.id || !item.message) {
|
||||||
throw new Error('No item ID or value specified.');
|
throw new Error("No item ID or value specified: " + JSON.stringify(item));
|
||||||
}
|
}
|
||||||
this.appendNewLine("<trans-unit id=\"" + item.id + "\">", 4);
|
this.appendNewLine("<trans-unit id=\"" + item.id + "\">", 4);
|
||||||
this.appendNewLine("<source xml:lang=\"en\">" + item.message + "</source>", 6);
|
this.appendNewLine("<source xml:lang=\"en\">" + item.message + "</source>", 6);
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ export class XLF {
|
|||||||
|
|
||||||
private addStringItem(item: Item): void {
|
private addStringItem(item: Item): void {
|
||||||
if (!item.id || !item.message) {
|
if (!item.id || !item.message) {
|
||||||
throw new Error('No item ID or value specified.');
|
throw new Error(`No item ID or value specified: ${JSON.stringify(item)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appendNewLine(`<trans-unit id="${item.id}">`, 4);
|
this.appendNewLine(`<trans-unit id="${item.id}">`, 4);
|
||||||
|
|||||||
@@ -212,8 +212,7 @@ function uglifyWithCopyrights() {
|
|||||||
return stream.pipe(minify({
|
return stream.pipe(minify({
|
||||||
output: {
|
output: {
|
||||||
comments: preserveComments(f),
|
comments: preserveComments(f),
|
||||||
// linux tfs build agent is crashing, does this help?§
|
max_line_len: 1024
|
||||||
max_line_len: 3200000
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -287,8 +287,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
|||||||
return stream.pipe(minify({
|
return stream.pipe(minify({
|
||||||
output: {
|
output: {
|
||||||
comments: preserveComments(<FileWithCopyright>f),
|
comments: preserveComments(<FileWithCopyright>f),
|
||||||
// linux tfs build agent is crashing, does this help?§
|
max_line_len: 1024
|
||||||
max_line_len: 3200000
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -88,10 +88,11 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
var info = this.findDescribingParent(node);
|
var info = this.findDescribingParent(node);
|
||||||
// Ignore strings in import and export nodes.
|
// Ignore strings in import and export nodes.
|
||||||
if (info && info.isImport && doubleQuoted) {
|
if (info && info.isImport && doubleQuoted) {
|
||||||
this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
var fix = [
|
||||||
this.createReplacement(node.getStart(), 1, '\''),
|
Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''),
|
||||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''),
|
||||||
]));
|
];
|
||||||
|
this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, fix);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var callInfo = info ? info.callInfo : null;
|
var callInfo = info ? info.callInfo : null;
|
||||||
@@ -101,8 +102,9 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
||||||
var s = node.getText();
|
var s = node.getText();
|
||||||
var replacement = new Lint.Replacement(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")");
|
var fix = [
|
||||||
var fix = new Lint.Fix('Unexternalitzed string', [replacement]);
|
Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), "nls.localize('KEY-" + s.substring(1, s.length - 1) + "', " + s + ")"),
|
||||||
|
];
|
||||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Unexternalized string found: " + node.getText(), fix));
|
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), "Unexternalized string found: " + node.getText(), fix));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,16 +136,24 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var messageArg = callInfo.argIndex === this.messageIndex
|
var messageArg = callInfo.callExpression.arguments[this.messageIndex];
|
||||||
? callInfo.callExpression.arguments[this.messageIndex]
|
if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) {
|
||||||
: null;
|
|
||||||
if (messageArg && messageArg !== node) {
|
|
||||||
this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), "Message argument to '" + callInfo.callExpression.expression.getText() + "' must be a string literal."));
|
this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), "Message argument to '" + callInfo.callExpression.expression.getText() + "' must be a string literal."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NoUnexternalizedStringsRuleWalker.prototype.recordKey = function (keyNode, messageNode) {
|
NoUnexternalizedStringsRuleWalker.prototype.recordKey = function (keyNode, messageNode) {
|
||||||
var text = keyNode.getText();
|
var text = keyNode.getText();
|
||||||
|
// We have an empty key
|
||||||
|
if (text.match(/(['"]) *\1/)) {
|
||||||
|
if (messageNode) {
|
||||||
|
this.addFailureAtNode(keyNode, "Key is empty for message: " + messageNode.getText());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.addFailureAtNode(keyNode, "Key is empty.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
var occurrences = this.usedKeys[text];
|
var occurrences = this.usedKeys[text];
|
||||||
if (!occurrences) {
|
if (!occurrences) {
|
||||||
occurrences = [];
|
occurrences = [];
|
||||||
@@ -176,7 +186,7 @@ var NoUnexternalizedStringsRuleWalker = /** @class */ (function (_super) {
|
|||||||
node = parent;
|
node = parent;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double qoutes for imports.';
|
NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double quotes for imports.';
|
||||||
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
|
NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"';
|
||||||
return NoUnexternalizedStringsRuleWalker;
|
return NoUnexternalizedStringsRuleWalker;
|
||||||
}(Lint.RuleWalker));
|
}(Lint.RuleWalker));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ interface KeyMessagePair {
|
|||||||
|
|
||||||
class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
||||||
|
|
||||||
private static ImportFailureMessage = 'Do not use double qoutes for imports.';
|
private static ImportFailureMessage = 'Do not use double quotes for imports.';
|
||||||
|
|
||||||
private static DOUBLE_QUOTE: string = '"';
|
private static DOUBLE_QUOTE: string = '"';
|
||||||
|
|
||||||
@@ -104,13 +104,14 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
let info = this.findDescribingParent(node);
|
let info = this.findDescribingParent(node);
|
||||||
// Ignore strings in import and export nodes.
|
// Ignore strings in import and export nodes.
|
||||||
if (info && info.isImport && doubleQuoted) {
|
if (info && info.isImport && doubleQuoted) {
|
||||||
|
const fix = [
|
||||||
|
Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''),
|
||||||
|
Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''),
|
||||||
|
];
|
||||||
this.addFailureAtNode(
|
this.addFailureAtNode(
|
||||||
node,
|
node,
|
||||||
NoUnexternalizedStringsRuleWalker.ImportFailureMessage,
|
NoUnexternalizedStringsRuleWalker.ImportFailureMessage,
|
||||||
new Lint.Fix(NoUnexternalizedStringsRuleWalker.ImportFailureMessage, [
|
fix
|
||||||
this.createReplacement(node.getStart(), 1, '\''),
|
|
||||||
this.createReplacement(node.getStart() + text.length - 1, 1, '\''),
|
|
||||||
])
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -122,8 +123,9 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
|
|
||||||
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) {
|
||||||
const s = node.getText();
|
const s = node.getText();
|
||||||
const replacement = new Lint.Replacement(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`);
|
const fix = [
|
||||||
const fix = new Lint.Fix('Unexternalitzed string', [replacement]);
|
Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`),
|
||||||
|
];
|
||||||
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix));
|
this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,10 +156,10 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let messageArg: ts.Expression = callInfo.argIndex === this.messageIndex
|
|
||||||
? callInfo.callExpression.arguments[this.messageIndex]
|
const messageArg = callInfo.callExpression.arguments[this.messageIndex];
|
||||||
: null;
|
|
||||||
if (messageArg && messageArg !== node) {
|
if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) {
|
||||||
this.addFailure(this.createFailure(
|
this.addFailure(this.createFailure(
|
||||||
messageArg.getStart(), messageArg.getWidth(),
|
messageArg.getStart(), messageArg.getWidth(),
|
||||||
`Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`));
|
`Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`));
|
||||||
@@ -167,6 +169,15 @@ class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker {
|
|||||||
|
|
||||||
private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node) {
|
private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node) {
|
||||||
let text = keyNode.getText();
|
let text = keyNode.getText();
|
||||||
|
// We have an empty key
|
||||||
|
if (text.match(/(['"]) *\1/)) {
|
||||||
|
if (messageNode) {
|
||||||
|
this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`);
|
||||||
|
} else {
|
||||||
|
this.addFailureAtNode(keyNode, `Key is empty.`);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
let occurrences: KeyMessagePair[] = this.usedKeys[text];
|
let occurrences: KeyMessagePair[] = this.usedKeys[text];
|
||||||
if (!occurrences) {
|
if (!occurrences) {
|
||||||
occurrences = [];
|
occurrences = [];
|
||||||
|
|||||||
1
build/lib/watch/.gitignore
vendored
Normal file
1
build/lib/watch/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.yarnrc
|
||||||
1302
build/lib/watch/yarn.lock
Normal file
1302
build/lib/watch/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
1
build/monaco/LICENSE
Normal file
1
build/monaco/LICENSE
Normal file
@@ -0,0 +1 @@
|
|||||||
|
See project root directory
|
||||||
@@ -52,7 +52,7 @@ declare module monaco.editor {
|
|||||||
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||||
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
||||||
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
||||||
#include(vs/editor/standalone/browser/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||||
export interface ICommandHandler {
|
export interface ICommandHandler {
|
||||||
(...args:any[]): void;
|
(...args:any[]): void;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ declare module monaco.languages {
|
|||||||
|
|
||||||
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||||
#includeAll(vs/editor/common/modes/languageConfiguration):
|
#includeAll(vs/editor/common/modes/languageConfiguration):
|
||||||
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.):
|
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||||
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
|
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
|
||||||
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
|
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
|
||||||
|
|
||||||
|
|||||||
@@ -11,47 +11,5 @@
|
|||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Microsoft/vscode/issues"
|
"url": "https://github.com/Microsoft/vscode/issues"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/minimist": "1.2.0",
|
|
||||||
"@types/mocha": "2.2.39",
|
|
||||||
"@types/semver": "5.3.30",
|
|
||||||
"@types/sinon": "1.16.34",
|
|
||||||
"debounce": "^1.0.0",
|
|
||||||
"eslint": "^3.4.0",
|
|
||||||
"event-stream": "^3.1.7",
|
|
||||||
"ghooks": "1.0.3",
|
|
||||||
"glob": "^5.0.13",
|
|
||||||
"gulp": "^3.8.9",
|
|
||||||
"gulp-bom": "^1.0.0",
|
|
||||||
"gulp-concat": "^2.6.0",
|
|
||||||
"gulp-cssnano": "^2.1.0",
|
|
||||||
"gulp-filter": "^3.0.0",
|
|
||||||
"gulp-flatmap": "^1.0.0",
|
|
||||||
"gulp-rename": "^1.2.0",
|
|
||||||
"gulp-sourcemaps": "^1.11.0",
|
|
||||||
"gulp-tsb": "^2.0.3",
|
|
||||||
"gulp-tslint": "^7.0.1",
|
|
||||||
"gulp-uglify": "^2.0.0",
|
|
||||||
"gulp-util": "^3.0.6",
|
|
||||||
"gulp-watch": "^4.3.9",
|
|
||||||
"is": "^3.1.0",
|
|
||||||
"istanbul": "^0.3.17",
|
|
||||||
"jsdom-no-contextify": "^3.1.0",
|
|
||||||
"lazy.js": "^0.4.2",
|
|
||||||
"minimatch": "^2.0.10",
|
|
||||||
"mocha": "^2.2.5",
|
|
||||||
"object-assign": "^4.0.1",
|
|
||||||
"pump": "^1.0.1",
|
|
||||||
"remap-istanbul": "^0.6.4",
|
|
||||||
"rimraf": "^2.2.8",
|
|
||||||
"sinon": "^1.17.2",
|
|
||||||
"source-map": "^0.4.4",
|
|
||||||
"tslint": "^4.3.1",
|
|
||||||
"typescript": "2.5.2",
|
|
||||||
"typescript-formatter": "4.0.1",
|
|
||||||
"underscore": "^1.8.2",
|
|
||||||
"vinyl": "^0.4.5",
|
|
||||||
"vscode-nls-dev": "^2.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4668
build/monaco/yarn.lock
Normal file
4668
build/monaco/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
|
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
const fs = require('fs');
|
||||||
|
const yarn = process.platform === 'win32' ? 'yarn.cmd' : 'yarn';
|
||||||
|
|
||||||
function npmInstall(location, opts) {
|
function yarnInstall(location, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
opts.cwd = location;
|
opts.cwd = location;
|
||||||
opts.stdio = 'inherit';
|
opts.stdio = 'inherit';
|
||||||
|
|
||||||
const result = cp.spawnSync(npm, ['install'], opts);
|
const result = cp.spawnSync(yarn, ['install'], opts);
|
||||||
|
|
||||||
if (result.error || result.status !== 0) {
|
if (result.error || result.status !== 0) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -20,44 +21,43 @@ function npmInstall(location, opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
const protocol = [
|
yarnInstall('dataprotocol-client');
|
||||||
'jsonrpc',
|
yarnInstall('extensions-modules');
|
||||||
'types',
|
yarnInstall('extensions'); // node modules shared by all extensions
|
||||||
'client'
|
|
||||||
];
|
|
||||||
|
|
||||||
protocol.forEach(item => npmInstall(`dataprotocol-node/${item}`));
|
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
|
||||||
npmInstall('extensions-modules');
|
|
||||||
npmInstall('extensions'); // node modules shared by all extensions
|
|
||||||
|
|
||||||
const extensions = [
|
const extensions = [
|
||||||
'vscode-colorize-tests',
|
'vscode-colorize-tests',
|
||||||
'git',
|
|
||||||
'json',
|
'json',
|
||||||
'mssql',
|
'mssql',
|
||||||
'configuration-editing',
|
'configuration-editing',
|
||||||
'extension-editing',
|
'extension-editing',
|
||||||
'markdown',
|
'markdown',
|
||||||
|
'git',
|
||||||
'merge-conflict',
|
'merge-conflict',
|
||||||
'insights-default',
|
'insights-default',
|
||||||
'account-provider-azure'
|
'account-provider-azure'
|
||||||
];
|
];
|
||||||
|
|
||||||
extensions.forEach(extension => npmInstall(`extensions/${extension}`));
|
extensions.forEach(extension => yarnInstall(`extensions/${extension}`));
|
||||||
|
|
||||||
function npmInstallBuildDependencies() {
|
function yarnInstallBuildDependencies() {
|
||||||
// make sure we install gulp watch for the system installed
|
// make sure we install the deps of build/lib/watch for the system installed
|
||||||
// node, since that is the driver of gulp
|
// node, since that is the driver of gulp
|
||||||
const env = Object.assign({}, process.env);
|
const env = Object.assign({}, process.env);
|
||||||
|
const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch');
|
||||||
|
const yarnrcPath = path.join(watchPath, '.yarnrc');
|
||||||
|
|
||||||
delete env['npm_config_disturl'];
|
const disturl = 'https://nodejs.org/download/release';
|
||||||
delete env['npm_config_target'];
|
const target = process.versions.node;
|
||||||
delete env['npm_config_runtime'];
|
const runtime = 'node';
|
||||||
|
|
||||||
npmInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env });
|
const yarnrc = `disturl "${disturl}"
|
||||||
|
target "${target}"
|
||||||
|
runtime "${runtime}"`;
|
||||||
|
|
||||||
|
fs.writeFileSync(yarnrcPath, yarnrc, 'utf8');
|
||||||
|
yarnInstall(watchPath, { env });
|
||||||
}
|
}
|
||||||
|
|
||||||
npmInstall(`build`); // node modules required for build
|
yarnInstall(`build`); // node modules required for build
|
||||||
npmInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
||||||
@@ -3,13 +3,21 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
if (process.env['npm_config_disturl'] !== 'https://atom.io/download/electron') {
|
let err = false;
|
||||||
console.error("You can't use plain npm to install Code's dependencies.");
|
|
||||||
console.error(
|
|
||||||
/^win/.test(process.platform)
|
|
||||||
? "Please run '.\\scripts\\npm.bat install' instead."
|
|
||||||
: "Please run './scripts/npm.sh install' instead."
|
|
||||||
);
|
|
||||||
|
|
||||||
|
const major = parseInt(/^(\d+)\./.exec(process.versions.node)[1]);
|
||||||
|
|
||||||
|
if (major < 8) {
|
||||||
|
console.error('\033[1;31m*** Please use node>=8.\033[0;0m');
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!/yarn\.js$|yarnpkg$/.test(process.env['npm_execpath'])) {
|
||||||
|
console.error('\033[1;31m*** Please use yarn to install dependencies.\033[0;0m');
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.error('');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ function updateGrammar(location) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const extensions = [
|
const extensions = [
|
||||||
// 'bat' Grammar no longer available
|
'bat',
|
||||||
'clojure',
|
'clojure',
|
||||||
'coffeescript',
|
'coffeescript',
|
||||||
'cpp',
|
'cpp',
|
||||||
|
|||||||
@@ -11,13 +11,13 @@
|
|||||||
"@types/xml2js": "0.0.33",
|
"@types/xml2js": "0.0.33",
|
||||||
"azure-storage": "^2.1.0",
|
"azure-storage": "^2.1.0",
|
||||||
"decompress": "^4.2.0",
|
"decompress": "^4.2.0",
|
||||||
"documentdb": "^1.11.0",
|
"documentdb": "1.13.0",
|
||||||
"extensions-modules": "file:../extensions-modules",
|
"extensions-modules": "file:../extensions-modules",
|
||||||
"fs-extra-promise": "^1.0.1",
|
"fs-extra-promise": "^1.0.1",
|
||||||
"mime": "^1.3.4",
|
"mime": "^1.3.4",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"typescript": "2.5.2",
|
"typescript": "2.6.1",
|
||||||
"vscode": "^1.0.1",
|
"vscode": "^1.0.1",
|
||||||
"xml2js": "^0.4.17"
|
"xml2js": "^0.4.17"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -25,4 +25,4 @@
|
|||||||
"watch": "tsc --watch",
|
"watch": "tsc --watch",
|
||||||
"postinstall": "npm run compile"
|
"postinstall": "npm run compile"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,9 @@ if [ -n "$AGENT_WORKFOLDER" ]
|
|||||||
then
|
then
|
||||||
export npm_config_cache="$AGENT_WORKFOLDER/npm-cache"
|
export npm_config_cache="$AGENT_WORKFOLDER/npm-cache"
|
||||||
echo "Using npm cache: $npm_config_cache"
|
echo "Using npm cache: $npm_config_cache"
|
||||||
|
|
||||||
|
export YARN_CACHE_FOLDER="$AGENT_WORKFOLDER/yarn-cache"
|
||||||
|
echo "Using yarn cache: $YARN_CACHE_FOLDER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SUMMARY="Task;Duration"$'\n'
|
SUMMARY="Task;Duration"$'\n'
|
||||||
|
|||||||
@@ -4,23 +4,15 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
const cp = require('child_process');
|
const cp = require('child_process');
|
||||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
||||||
|
|
||||||
function npmInstall(package: string, args: string[]): void {
|
function yarnInstall(package: string): void {
|
||||||
const result = cp.spawnSync(npm, ['install', package, ...args], {
|
cp.execSync(`yarn add --no-lockfile ${package}`);
|
||||||
stdio: 'inherit'
|
|
||||||
});
|
|
||||||
|
|
||||||
if (result.error || result.status !== 0) {
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const product = require('../../../product.json');
|
const product = require('../../../product.json');
|
||||||
const dependencies = product.dependencies || {} as { [name: string]: string; };
|
const dependencies = product.dependencies || {} as { [name: string]: string; };
|
||||||
const [, , ...args] = process.argv;
|
|
||||||
|
|
||||||
Object.keys(dependencies).forEach(name => {
|
Object.keys(dependencies).forEach(name => {
|
||||||
const url = dependencies[name];
|
const url = dependencies[name];
|
||||||
npmInstall(url, args);
|
yarnInstall(url);
|
||||||
});
|
});
|
||||||
@@ -10,6 +10,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# install node
|
# install node
|
||||||
NODE_VERSION=7.10.0
|
NODE_VERSION=8.9.1
|
||||||
nvm install $NODE_VERSION
|
nvm install $NODE_VERSION
|
||||||
nvm use $NODE_VERSION
|
nvm use $NODE_VERSION
|
||||||
|
|
||||||
|
# install yarn
|
||||||
|
npm i -g yarn
|
||||||
@@ -14,8 +14,9 @@ import * as mime from 'mime';
|
|||||||
import * as minimist from 'minimist';
|
import * as minimist from 'minimist';
|
||||||
import { DocumentClient, NewDocument } from 'documentdb';
|
import { DocumentClient, NewDocument } from 'documentdb';
|
||||||
|
|
||||||
if (process.argv.length < 6) {
|
// {{SQL CARBON EDIT}}
|
||||||
console.error('Usage: node publish.js <product> <platform> <type> <name> <version> <commit> <is_update> <file>');
|
if (process.argv.length < 9) {
|
||||||
|
console.error('Usage: node publish.js <product_quality> <platform> <file_type> <file_name> <version> <is_update> <file> [commit_id]');
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,21 +184,10 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
const blobService = azure.createBlobService(storageAccount, process.env['AZURE_STORAGE_ACCESS_KEY_2'])
|
const blobService = azure.createBlobService(storageAccount, process.env['AZURE_STORAGE_ACCESS_KEY_2'])
|
||||||
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
||||||
|
|
||||||
const mooncakeBlobService = azure.createBlobService(storageAccount, process.env['MOONCAKE_STORAGE_ACCESS_KEY'], `${storageAccount}.blob.core.chinacloudapi.cn`)
|
// {{SQL CARBON EDIT}}
|
||||||
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
await assertContainer(blobService, quality);
|
||||||
|
|
||||||
// mooncake is fussy and far away, this is needed!
|
const blobExists = await doesAssetExist(blobService, quality, blobName);
|
||||||
mooncakeBlobService.defaultClientRequestTimeoutInMs = 10 * 60 * 1000;
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
assertContainer(blobService, quality),
|
|
||||||
assertContainer(mooncakeBlobService, quality)
|
|
||||||
]);
|
|
||||||
|
|
||||||
const [blobExists, moooncakeBlobExists] = await Promise.all([
|
|
||||||
doesAssetExist(blobService, quality, blobName),
|
|
||||||
doesAssetExist(mooncakeBlobService, quality, blobName)
|
|
||||||
]);
|
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
@@ -205,8 +195,23 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
promises.push(uploadBlob(blobService, quality, blobName, file));
|
promises.push(uploadBlob(blobService, quality, blobName, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moooncakeBlobExists) {
|
// {{SQL CARBON EDIT}}
|
||||||
promises.push(uploadBlob(mooncakeBlobService, quality, blobName, file));
|
if (process.env['MOONCAKE_STORAGE_ACCESS_KEY']) {
|
||||||
|
const mooncakeBlobService = azure.createBlobService(storageAccount, process.env['MOONCAKE_STORAGE_ACCESS_KEY'], `${storageAccount}.blob.core.chinacloudapi.cn`)
|
||||||
|
.withFilter(new azure.ExponentialRetryPolicyFilter(20));
|
||||||
|
|
||||||
|
// mooncake is fussy and far away, this is needed!
|
||||||
|
mooncakeBlobService.defaultClientRequestTimeoutInMs = 10 * 60 * 1000;
|
||||||
|
|
||||||
|
await assertContainer(mooncakeBlobService, quality);
|
||||||
|
|
||||||
|
const mooncakeBlobExists = await doesAssetExist(mooncakeBlobService, quality, blobName);
|
||||||
|
|
||||||
|
if (!mooncakeBlobExists) {
|
||||||
|
promises.push(uploadBlob(mooncakeBlobService, quality, blobName, file));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('Skipping Mooncake publishing.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (promises.length === 0) {
|
if (promises.length === 0) {
|
||||||
@@ -228,7 +233,8 @@ async function publish(commit: string, quality: string, platform: string, type:
|
|||||||
platform: platform,
|
platform: platform,
|
||||||
type: type,
|
type: type,
|
||||||
url: `${process.env['AZURE_CDN_URL']}/${quality}/${blobName}`,
|
url: `${process.env['AZURE_CDN_URL']}/${quality}/${blobName}`,
|
||||||
mooncakeUrl: `${process.env['MOONCAKE_CDN_URL']}/${quality}/${blobName}`,
|
// {{SQL CARBON EDIT}}
|
||||||
|
mooncakeUrl: process.env['MOONCAKE_CDN_URL'] ? `${process.env['MOONCAKE_CDN_URL']}/${quality}/${blobName}` : undefined,
|
||||||
hash: sha1hash,
|
hash: sha1hash,
|
||||||
sha256hash,
|
sha256hash,
|
||||||
size
|
size
|
||||||
@@ -261,8 +267,11 @@ function main(): void {
|
|||||||
boolean: ['upload-only']
|
boolean: ['upload-only']
|
||||||
});
|
});
|
||||||
|
|
||||||
const [quality, platform, type, name, version, _isUpdate, file] = opts._;
|
// {{SQL CARBON EDIT}}
|
||||||
const commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
let [quality, platform, type, name, version, _isUpdate, file, commit] = opts._;
|
||||||
|
if (!commit) {
|
||||||
|
commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
||||||
|
}
|
||||||
|
|
||||||
publish(commit, quality, platform, type, name, version, _isUpdate, file, opts).catch(err => {
|
publish(commit, quality, platform, type, name, version, _isUpdate, file, opts).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ VSO_PAT="$6"
|
|||||||
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
||||||
|
|
||||||
step "Install dependencies" \
|
step "Install dependencies" \
|
||||||
npm install
|
yarn
|
||||||
|
|
||||||
step "Hygiene" \
|
step "Hygiene" \
|
||||||
npm run gulp -- hygiene
|
npm run gulp -- hygiene
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
. ./scripts/env.sh
|
. ./scripts/env.sh
|
||||||
. ./build/tfs/common/common.sh
|
. ./build/tfs/common/common.sh
|
||||||
|
|
||||||
(cd $BUILD_SOURCESDIRECTORY/build/tfs/common && \
|
|
||||||
step "Install build dependencies" \
|
|
||||||
npm i)
|
|
||||||
|
|
||||||
REPO=`pwd`
|
REPO=`pwd`
|
||||||
ZIP=$REPO/../VSCode-darwin-selfsigned.zip
|
ZIP=$REPO/../VSCode-darwin-selfsigned.zip
|
||||||
UNSIGNEDZIP=$REPO/../VSCode-darwin-unsigned.zip
|
UNSIGNEDZIP=$REPO/../VSCode-darwin-unsigned.zip
|
||||||
|
|||||||
3
build/tfs/linux/.gitignore
vendored
3
build/tfs/linux/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
pat
|
pat
|
||||||
|
*.js
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
. ./build/tfs/common/common.sh
|
. ./build/tfs/common/common.sh
|
||||||
|
|
||||||
export ARCH="$1"
|
export ARCH="$1"
|
||||||
|
export npm_config_arch="$ARCH"
|
||||||
export VSCODE_MIXIN_PASSWORD="$2"
|
export VSCODE_MIXIN_PASSWORD="$2"
|
||||||
export AZURE_STORAGE_ACCESS_KEY="$3"
|
export AZURE_STORAGE_ACCESS_KEY="$3"
|
||||||
export AZURE_STORAGE_ACCESS_KEY_2="$4"
|
export AZURE_STORAGE_ACCESS_KEY_2="$4"
|
||||||
@@ -16,7 +17,7 @@ VSO_PAT="$8"
|
|||||||
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
|
||||||
|
|
||||||
step "Install dependencies" \
|
step "Install dependencies" \
|
||||||
npm install --arch=$ARCH --unsafe-perm
|
yarn
|
||||||
|
|
||||||
step "Hygiene" \
|
step "Hygiene" \
|
||||||
npm run gulp -- hygiene
|
npm run gulp -- hygiene
|
||||||
@@ -28,7 +29,7 @@ step "Get Electron" \
|
|||||||
npm run gulp -- "electron-$ARCH"
|
npm run gulp -- "electron-$ARCH"
|
||||||
|
|
||||||
step "Install distro dependencies" \
|
step "Install distro dependencies" \
|
||||||
node build/tfs/common/installDistro.js --arch=$ARCH
|
node build/tfs/common/installDistro.js
|
||||||
|
|
||||||
step "Build minified" \
|
step "Build minified" \
|
||||||
npm run gulp -- "vscode-linux-$ARCH-min"
|
npm run gulp -- "vscode-linux-$ARCH-min"
|
||||||
|
|||||||
42
build/tfs/linux/frozen-check.ts
Normal file
42
build/tfs/linux/frozen-check.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { DocumentClient } from 'documentdb';
|
||||||
|
|
||||||
|
interface Config {
|
||||||
|
id: string;
|
||||||
|
frozen: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDefaultConfig(quality: string): Config {
|
||||||
|
return {
|
||||||
|
id: quality,
|
||||||
|
frozen: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getConfig(quality: string): Promise<Config> {
|
||||||
|
const client = new DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT'], { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
|
||||||
|
const collection = 'dbs/builds/colls/config';
|
||||||
|
const query = {
|
||||||
|
query: `SELECT TOP 1 * FROM c WHERE c.id = @quality`,
|
||||||
|
parameters: [
|
||||||
|
{ name: '@quality', value: quality }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise<Config>((c, e) => {
|
||||||
|
client.queryDocuments(collection, query).toArray((err, results) => {
|
||||||
|
if (err && err.code !== 409) { return e(err); }
|
||||||
|
|
||||||
|
c(!results || results.length === 0 ? createDefaultConfig(quality) : results[0] as any as Config);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getConfig(process.argv[2])
|
||||||
|
.then(c => console.log(c.frozen), e => console.error(e));
|
||||||
6
build/tfs/linux/new_package.json.template
Normal file
6
build/tfs/linux/new_package.json.template
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "PACKAGENAME",
|
||||||
|
"version": "PACKAGEVERSION",
|
||||||
|
"repositoryId": "REPOSITORYID",
|
||||||
|
"sourceUrl": "PACKAGEURL"
|
||||||
|
}
|
||||||
@@ -12,10 +12,6 @@ step "Build RPM package" \
|
|||||||
# step "Build snap package" \
|
# step "Build snap package" \
|
||||||
# npm run gulp -- "vscode-linux-$ARCH-build-snap"
|
# npm run gulp -- "vscode-linux-$ARCH-build-snap"
|
||||||
|
|
||||||
(cd $BUILD_SOURCESDIRECTORY/build/tfs/common && \
|
|
||||||
step "Install build dependencies" \
|
|
||||||
npm install --unsafe-perm)
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
PLATFORM_LINUX="linux-$ARCH"
|
PLATFORM_LINUX="linux-$ARCH"
|
||||||
PLATFORM_DEB="linux-deb-$ARCH"
|
PLATFORM_DEB="linux-deb-$ARCH"
|
||||||
@@ -55,36 +51,29 @@ step "Publish RPM package" \
|
|||||||
# SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
|
# SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
|
||||||
# SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"
|
# SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"
|
||||||
|
|
||||||
|
IS_FROZEN="$(node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"
|
||||||
|
|
||||||
if [ -z "$VSCODE_QUALITY" ]; then
|
if [ -z "$VSCODE_QUALITY" ]; then
|
||||||
echo "VSCODE_QUALITY is not set, skipping repo package publish"
|
echo "VSCODE_QUALITY is not set, skipping repo package publish"
|
||||||
|
elif [ "$IS_FROZEN" = "true" ]; then
|
||||||
|
echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
|
||||||
else
|
else
|
||||||
if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ]; then
|
if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ]; then
|
||||||
if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
|
if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
|
||||||
# Get necessary information
|
|
||||||
pushd $REPO && COMMIT_HASH=$(git rev-parse HEAD) && popd
|
|
||||||
PACKAGE_NAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/ | sed -e 's/_.*//g')"
|
|
||||||
DEB_URL="https://az764295.vo.msecnd.net/$VSCODE_QUALITY/$COMMIT_HASH/$DEB_FILENAME"
|
|
||||||
RPM_URL="https://az764295.vo.msecnd.net/$VSCODE_QUALITY/$COMMIT_HASH/$RPM_FILENAME"
|
|
||||||
PACKAGE_VERSION="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/ | sed -e 's/code-[a-z]*_//g' -e 's/\_.*$//g')"
|
|
||||||
# Write config files needed by API, use eval to force environment variable expansion
|
# Write config files needed by API, use eval to force environment variable expansion
|
||||||
DIRNAME=$(dirname $(readlink -f $0))
|
DIRNAME=$(dirname $(readlink -f $0))
|
||||||
pushd $DIRNAME
|
pushd $DIRNAME
|
||||||
# Submit to apt repo
|
# Submit to apt repo
|
||||||
if [ "$DEB_ARCH" = "amd64" ]; then
|
if [ "$DEB_ARCH" = "amd64" ]; then
|
||||||
eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > apt-config.json
|
eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > apt-config.json
|
||||||
eval echo '{ \"name\": \"$PACKAGE_NAME\", \"version\": \"$PACKAGE_VERSION\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"sourceUrl\": \"$DEB_URL\" }' > apt-addpkg.json
|
|
||||||
echo "Submitting apt-addpkg.json:"
|
|
||||||
cat apt-addpkg.json
|
|
||||||
|
|
||||||
step "Publish to repositories" \
|
step "Publish to repositories" \
|
||||||
./repoapi_client.sh -config apt-config.json -addpkg apt-addpkg.json
|
./repoapi_client.sh -config apt-config.json -addfile $DEB_PATH
|
||||||
fi
|
fi
|
||||||
# Submit to yum repo (disabled as it's manual until signing is automated)
|
# Submit to yum repo (disabled as it's manual until signing is automated)
|
||||||
# eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > yum-config.json
|
# eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > yum-config.json
|
||||||
# eval echo '{ \"name\": \"$PACKAGE_NAME\", \"version\": \"$PACKAGE_VERSION\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"sourceUrl\": \"$RPM_URL\" }' > yum-addpkg.json
|
|
||||||
# echo "Submitting yum-addpkg.json:"
|
# ./repoapi_client.sh -config yum-config.json -addfile $RPM_PATH
|
||||||
# cat yum-addpkg.json
|
|
||||||
# ./repoapi_client.sh -config yum-config.json -addpkg yum-addpkg.json
|
|
||||||
popd
|
popd
|
||||||
echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
|
echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
# This is a VERY basic script for Create/Delete operations on repos and packages
|
# This is a VERY basic script for Create/Delete operations on repos and packages
|
||||||
#
|
#
|
||||||
cmd=$1
|
cmd=$1
|
||||||
urls=urls.txt
|
docDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # chrmarti: Changed to script's directory.
|
||||||
defaultPackageFile=new_package.json
|
packageJsonTemplate=$docDir/new_package.json.template
|
||||||
defaultRepoFile=new_repo.json
|
repoJsonTemplate=$docDir/new_repo.json.template
|
||||||
|
|
||||||
function Bail
|
function Bail
|
||||||
{
|
{
|
||||||
@@ -24,14 +24,21 @@ function Usage {
|
|||||||
echo "$0 -config FILENAME -listrepos | -listpkgs | -addrepo FILENAME | -addpkg FILENAME |"
|
echo "$0 -config FILENAME -listrepos | -listpkgs | -addrepo FILENAME | -addpkg FILENAME |"
|
||||||
echo "-addpkgs FILENAME | -check ID | -delrepo REPOID | -delpkg PKGID"
|
echo "-addpkgs FILENAME | -check ID | -delrepo REPOID | -delpkg PKGID"
|
||||||
echo -e "\t-config FILENAME : JSON file containing API server name and creds"
|
echo -e "\t-config FILENAME : JSON file containing API server name and creds"
|
||||||
echo -e "\t-listrepos : List repositories"
|
echo -e "Package Operations:"
|
||||||
echo -e "\t-listpkgs [REGEX] : List packages, optionally filter by REGEX"
|
echo -e "\t-listpkgs [REGEX] : List packages, optionally filter by REGEX"
|
||||||
echo -e "\t-addrepo FILENAME : Create a new repo using the specified JSON file"
|
|
||||||
echo -e "\t-addpkg FILENAME : Add package to repo using the specified JSON file"
|
echo -e "\t-addpkg FILENAME : Add package to repo using the specified JSON file"
|
||||||
echo -e "\t-addpkgs FILENAME : Add packages to repo using urls contained in FILENAME"
|
echo -e "\t-addpkgs FILENAME : Add packages to repo using urls contained in FILENAME"
|
||||||
echo -e "\t-check ID : Check upload operation by ID"
|
echo -e "\t-check ID : Check upload operation by ID"
|
||||||
echo -e "\t-delrepo REPOID : Delete the specified repo by ID"
|
|
||||||
echo -e "\t-delpkg PKGID : Delete the specified package by ID"
|
echo -e "\t-delpkg PKGID : Delete the specified package by ID"
|
||||||
|
echo -e "File Operations:"
|
||||||
|
echo -e "\t-uploadfile FILENAME: Upload FILENAME (does not publish) "
|
||||||
|
echo -e "\t-addfile FILENAME : Upload FILENAME AND publish to the repo"
|
||||||
|
echo -e "\t-listfiles : List uploaded files"
|
||||||
|
echo -e "\t-delfile FILEID : Delete uploaded file by ID"
|
||||||
|
echo -e "Repository Operations:"
|
||||||
|
echo -e "\t-listrepos : List repositories"
|
||||||
|
echo -e "\t-addrepo FILENAME : Create a new repo using the specified JSON file"
|
||||||
|
echo -e "\t-delrepo REPOID : Delete the specified repo by ID"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,33 +91,136 @@ function AddRepo
|
|||||||
{
|
{
|
||||||
repoFile=$1
|
repoFile=$1
|
||||||
if [ -z $repoFile ]; then
|
if [ -z $repoFile ]; then
|
||||||
Bail "Error: Must specify a JSON-formatted file. Reference $defaultRepoFile.template"
|
Bail "Error: Must specify a JSON-formatted file. Reference $repoJsonTemplate"
|
||||||
fi
|
fi
|
||||||
if [ ! -f $repoFile ]; then
|
if [ ! -f $repoFile ]; then
|
||||||
Bail "Error: Cannot create repo - $repoFile does not exist"
|
Bail "Error: Cannot create repo - $repoFile does not exist"
|
||||||
fi
|
fi
|
||||||
packageUrl=$(grep "url" $repoFile | head -n 1 | awk '{print $2}' | tr -d ',')
|
packageUrl=$(grep "url" $repoFile | head -n 1 | awk '{print $2}' | tr -d ',')
|
||||||
echo "Creating new repo on $server [$packageUrl]"
|
echo "Creating new repo on $server [$packageUrl]"
|
||||||
curl -i -k "$baseurl/v1/repositories" --data @./$repoFile -H "Content-Type: application/json"
|
curl -i -k "$baseurl/v1/repositories" --data @$repoFile -H "Content-Type: application/json"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Upload AND publish the file
|
||||||
|
function AddFile
|
||||||
|
{
|
||||||
|
packageFile=$1
|
||||||
|
# Validity checks are performed by UploadFile
|
||||||
|
echo "Uploading package to $server [$packageFile]"
|
||||||
|
response=$(UploadFile $packageFile "true")
|
||||||
|
id=$(echo $response | jq -r ".id")
|
||||||
|
|
||||||
|
# Parse package metadata first to confirm it's a valid deb/rpm
|
||||||
|
# Needs to be performed in this function so we can use it to publish the package
|
||||||
|
jsonFile=$(WritePackageInfoToFile $packageFile)
|
||||||
|
|
||||||
|
sed -i "s/REPOSITORYID/$repositoryId/g" $jsonFile
|
||||||
|
# Replace the url field with fileId
|
||||||
|
sed -i "s/PACKAGEURL/$id/g" $jsonFile
|
||||||
|
sed -i "s/sourceUrl/fileId/g" $jsonFile
|
||||||
|
|
||||||
|
AddPackage $jsonFile
|
||||||
|
rm -f $jsonFile
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Upload a file
|
||||||
|
function UploadFile
|
||||||
|
{
|
||||||
|
packageFile=$1
|
||||||
|
quick=$2
|
||||||
|
if [ -z $packageFile ]; then
|
||||||
|
Bail "Error: Must specify the path to a file to upload "
|
||||||
|
fi
|
||||||
|
if [ ! -f $packageFile ]; then
|
||||||
|
Bail "Error: Cannot upload - $packageFile does not exist"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Additional validation and output if quick mode isn't enabled
|
||||||
|
# Basically, if this is part of a publish operation, these steps are handled elsewhere
|
||||||
|
if [ "$quick" != "true" ]; then
|
||||||
|
# Parse package metadata first to confirm it's a valid deb/rpm
|
||||||
|
jsonFile=$(WritePackageInfoToFile $packageFile)
|
||||||
|
rm -f $jsonFile
|
||||||
|
|
||||||
|
echo "Uploading package to $server [$packageFile]"
|
||||||
|
fi
|
||||||
|
curl -s -k -X POST -F file=@$packageFile "$baseurl/v1/files"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function ListFiles
|
||||||
|
{
|
||||||
|
curl -s -k "$baseurl/v1/files" | jq
|
||||||
|
}
|
||||||
|
|
||||||
|
function DeleteFile
|
||||||
|
{
|
||||||
|
fileId=$1
|
||||||
|
if [ -z "$fileId" ]; then
|
||||||
|
Bail "Error: Must specify an ID to delete"
|
||||||
|
fi
|
||||||
|
curl -s -X DELETE "$baseurl/v1/files/$fileId"
|
||||||
|
}
|
||||||
|
|
||||||
# Upload a single package using the specified JSON file
|
# Upload a single package using the specified JSON file
|
||||||
function AddPackage
|
function AddPackage
|
||||||
{
|
{
|
||||||
packageFile=$1
|
packageFile=$1
|
||||||
if [ -z $packageFile ]; then
|
if [ -z $packageFile ]; then
|
||||||
Bail "Error: Must specify a JSON-formatted file. Reference $defaultPackageFile.template"
|
Bail "Error: Must specify a JSON-formatted file. Reference $packageJsonTemplate"
|
||||||
fi
|
fi
|
||||||
if [ ! -f $packageFile ]; then
|
if [ ! -f $packageFile ]; then
|
||||||
Bail "Error: Cannot add package - $packageFile does not exist"
|
Bail "Error: Cannot add package - $packageFile does not exist"
|
||||||
fi
|
fi
|
||||||
packageUrl=$(grep "sourceUrl" $packageFile | head -n 1 | awk '{print $2}')
|
packageUrl=$(grep "sourceUrl" $packageFile | head -n 1 | awk '{print $2}')
|
||||||
echo "Adding package to $server [$packageUrl]"
|
echo "Adding package to $server [$packageUrl]"
|
||||||
curl -i -k "$baseurl/v1/packages" --data @./$packageFile -H "Content-Type: application/json"
|
curl -i -k "$baseurl/v1/packages" --data @$packageFile -H "Content-Type: application/json"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Gets the package name and version and writes it to a file
|
||||||
|
function WritePackageInfoToFile
|
||||||
|
{
|
||||||
|
packageFile=$1
|
||||||
|
tmpOut=$(mktemp)
|
||||||
|
if [ -z "$packageFile" ]; then
|
||||||
|
Bail "Error: Must specify path to a deb/rpm package"
|
||||||
|
elif [ ! -f "$packageFile" ]; then
|
||||||
|
Bail "Error: Specified file $packageFile does not exist"
|
||||||
|
fi
|
||||||
|
if dpkg -I $packageFile > $tmpOut 2> /dev/null; then
|
||||||
|
>&2 echo "File is deb format"
|
||||||
|
pkgName=$(grep "^\s*Package:" $tmpOut | awk '{print $2}')
|
||||||
|
pkgVer=$(grep "^\s*Version:" $tmpOut | awk '{print $2}')
|
||||||
|
elif rpm -qpi $packageFile > $tmpOut 2> /dev/null; then
|
||||||
|
>&2 echo "File is rpm format"
|
||||||
|
pkgName=$(egrep "^Name" $tmpOut | tr -d ':' | awk '{print $2}')
|
||||||
|
pkgVer=$(egrep "^Version" $tmpOut | tr -d ':' | awk '{print $2}')
|
||||||
|
else
|
||||||
|
rm -f $tmpOut
|
||||||
|
Bail "File is not a valid deb/rpm package $url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f $tmpOut
|
||||||
|
if [ -z "$pkgName" ]; then
|
||||||
|
Bail "Unable to parse package name for $url"
|
||||||
|
elif [ -z "$pkgVer" ]; then
|
||||||
|
Bail "Unable to parse package version number for $url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create Package .json file
|
||||||
|
outJson=$(mktemp)
|
||||||
|
escapedUrl=$(echo "$url" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g')
|
||||||
|
cp $packageJsonTemplate $outJson
|
||||||
|
sed -i "s/PACKAGENAME/$pkgName/g" $outJson
|
||||||
|
sed -i "s/PACKAGEVERSION/$pkgVer/g" $outJson
|
||||||
|
|
||||||
|
# Return path to json file
|
||||||
|
echo $outJson
|
||||||
|
}
|
||||||
|
|
||||||
# Upload a single package by dynamically creating a JSON file using a provided URL
|
# Upload a single package by dynamically creating a JSON file using a provided URL
|
||||||
function AddPackageByUrl
|
function AddPackageByUrl
|
||||||
{
|
{
|
||||||
@@ -119,41 +229,20 @@ function AddPackageByUrl
|
|||||||
Bail "Unable to publish package because no URL was specified"
|
Bail "Unable to publish package because no URL was specified"
|
||||||
fi
|
fi
|
||||||
tmpFile=$(mktemp)
|
tmpFile=$(mktemp)
|
||||||
tmpOut=$(mktemp)
|
|
||||||
if ! wget -q "$url" -O $tmpFile; then
|
if ! wget -q "$url" -O $tmpFile; then
|
||||||
rm -f $tmpFile $tmpFile
|
rm -f $tmpFile
|
||||||
Bail "Unable to download URL $url"
|
Bail "Unable to download URL $url"
|
||||||
elif dpkg -I $tmpFile > $tmpOut 2> /dev/null; then
|
|
||||||
echo "File is deb format"
|
|
||||||
pkgName=$(grep "^\s*Package:" $tmpOut | awk '{print $2}')
|
|
||||||
pkgVer=$(grep "^\s*Version:" $tmpOut | awk '{print $2}')
|
|
||||||
elif rpm -qpi $tmpFile > $tmpOut 2> /dev/null; then
|
|
||||||
echo "File is rpm format"
|
|
||||||
pkgName=$(egrep "^Name" $tmpOut | tr -d ':' | awk '{print $2}')
|
|
||||||
pkgVer=$(egrep "^Version" $tmpOut | tr -d ':' | awk '{print $2}')
|
|
||||||
else
|
|
||||||
rm -f $tmpFile $tmpOut
|
|
||||||
Bail "File is not a valid deb/rpm package $url"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f $tmpFile $tmpOut
|
|
||||||
if [ -z "$pkgName" ]; then
|
|
||||||
Bail "Unable to parse package name for $url"
|
|
||||||
elif [ -z "$pkgVer" ]; then
|
|
||||||
Bail "Unable to parse package version number for $url"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
jsonFile=$(WritePackageInfoToFile $tmpFile)
|
||||||
# Create Package .json file
|
# Create Package .json file
|
||||||
escapedUrl=$(echo "$url" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g')
|
escapedUrl=$(echo "$url" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g')
|
||||||
cp $defaultPackageFile.template $defaultPackageFile
|
sed -i "s/PACKAGEURL/$escapedUrl/g" $jsonFile
|
||||||
sed -i "s/PACKAGENAME/$pkgName/g" $defaultPackageFile
|
sed -i "s/REPOSITORYID/$repositoryId/g" $jsonFile
|
||||||
sed -i "s/PACKAGEVERSION/$pkgVer/g" $defaultPackageFile
|
|
||||||
sed -i "s/PACKAGEURL/$escapedUrl/g" $defaultPackageFile
|
|
||||||
sed -i "s/REPOSITORYID/$repositoryId/g" $defaultPackageFile
|
|
||||||
# Perform Upload
|
# Perform Upload
|
||||||
AddPackage $defaultPackageFile
|
AddPackage $jsonFile
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -f $defaultPackageFile
|
rm -f $jsonFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Upload multiple packages by reading urls line-by-line from the specified file
|
# Upload multiple packages by reading urls line-by-line from the specified file
|
||||||
@@ -180,7 +269,7 @@ function CheckUpload {
|
|||||||
if [ -z "$id" ]; then
|
if [ -z "$id" ]; then
|
||||||
Bail "Must specify an ID"
|
Bail "Must specify an ID"
|
||||||
fi
|
fi
|
||||||
curl -k $baseurl/v1/packages/queue/$id
|
curl -s -k $baseurl/v1/packages/queue/$id | jq
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +321,20 @@ while (( "$#" )); do
|
|||||||
operation=AddPackages
|
operation=AddPackages
|
||||||
shift
|
shift
|
||||||
operand="$1"
|
operand="$1"
|
||||||
|
elif [[ "$1" == "-addfile" ]]; then
|
||||||
|
operation=AddFile
|
||||||
|
shift
|
||||||
|
operand="$1"
|
||||||
|
elif [[ "$1" == "-uploadfile" ]]; then
|
||||||
|
operation=UploadFile
|
||||||
|
shift
|
||||||
|
operand="$1"
|
||||||
|
elif [[ "$1" == "-listfiles" ]]; then
|
||||||
|
operation=ListFiles
|
||||||
|
elif [[ "$1" == "-delfile" ]]; then
|
||||||
|
operation=DeleteFile
|
||||||
|
shift
|
||||||
|
operand="$1"
|
||||||
elif [[ "$1" == "-check" ]]; then
|
elif [[ "$1" == "-check" ]]; then
|
||||||
operation=CheckUpload
|
operation=CheckUpload
|
||||||
shift
|
shift
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ Param(
|
|||||||
|
|
||||||
# Set the right architecture
|
# Set the right architecture
|
||||||
$env:npm_config_arch="$arch"
|
$env:npm_config_arch="$arch"
|
||||||
|
$env:CHILD_CONCURRENCY="1"
|
||||||
|
|
||||||
step "Install dependencies" {
|
step "Install dependencies" {
|
||||||
exec { & npm install }
|
exec { & yarn }
|
||||||
}
|
}
|
||||||
|
|
||||||
step "Hygiene" {
|
step "Hygiene" {
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ Param(
|
|||||||
|
|
||||||
# Set the right architecture
|
# Set the right architecture
|
||||||
$env:npm_config_arch="$arch"
|
$env:npm_config_arch="$arch"
|
||||||
|
$env:CHILD_CONCURRENCY="1"
|
||||||
|
|
||||||
step "Install dependencies" {
|
step "Install dependencies" {
|
||||||
exec { & npm install }
|
exec { & yarn }
|
||||||
}
|
}
|
||||||
|
|
||||||
step "Hygiene" {
|
step "Hygiene" {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ $env:HOME=$env:USERPROFILE
|
|||||||
if (Test-Path env:AGENT_WORKFOLDER) {
|
if (Test-Path env:AGENT_WORKFOLDER) {
|
||||||
$env:HOME="${env:AGENT_WORKFOLDER}\home"
|
$env:HOME="${env:AGENT_WORKFOLDER}\home"
|
||||||
$env:npm_config_cache="${env:HOME}\npm-cache"
|
$env:npm_config_cache="${env:HOME}\npm-cache"
|
||||||
|
$env:YARN_CACHE_FOLDER="${env:HOME}\yarn-cache"
|
||||||
$env:npm_config_devdir="${env:HOME}\npm-devdir"
|
$env:npm_config_devdir="${env:HOME}\npm-devdir"
|
||||||
New-Item -Path "$env:HOME" -Type directory -Force | out-null
|
New-Item -Path "$env:HOME" -Type directory -Force | out-null
|
||||||
New-Item -Path "$env:npm_config_cache" -Type directory -Force | out-null
|
New-Item -Path "$env:npm_config_cache" -Type directory -Force | out-null
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# install node
|
# install node
|
||||||
$env:Path = $env:NVM_HOME + ";" + $env:NVM_SYMLINK + ";" + $env:Path
|
$env:Path = $env:NVM_HOME + ";" + $env:NVM_SYMLINK + ";" + $env:Path
|
||||||
$NodeVersion = "7.10.0"
|
$NodeVersion = "8.9.1"
|
||||||
nvm install $NodeVersion
|
nvm install $NodeVersion
|
||||||
nvm use $NodeVersion
|
nvm use $NodeVersion
|
||||||
|
npm install -g yarn
|
||||||
$env:Path = $env:NVM_HOME + "\v" + $NodeVersion + ";" + $env:Path
|
$env:Path = $env:NVM_HOME + "\v" + $NodeVersion + ";" + $env:Path
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-expression": true,
|
"no-unused-expression": true,
|
||||||
"no-duplicate-variable": true,
|
"no-duplicate-variable": true,
|
||||||
"no-unused-variable": true,
|
|
||||||
"curly": true,
|
"curly": true,
|
||||||
"class-name": true,
|
"class-name": true,
|
||||||
"semicolon": [
|
"semicolon": [
|
||||||
|
true,
|
||||||
"always"
|
"always"
|
||||||
],
|
],
|
||||||
"triple-equals": true
|
"triple-equals": true
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ Name: "simplifiedChinese"; MessagesFile: "{#RepoDir}\build\win32\i18n\Default.zh
|
|||||||
Name: "traditionalChinese"; MessagesFile: "{#RepoDir}\build\win32\i18n\Default.zh-tw.isl,{#RepoDir}\build\win32\i18n\messages.zh-tw.isl" {#LocalizedLanguageFile("cht")}
|
Name: "traditionalChinese"; MessagesFile: "{#RepoDir}\build\win32\i18n\Default.zh-tw.isl,{#RepoDir}\build\win32\i18n\messages.zh-tw.isl" {#LocalizedLanguageFile("cht")}
|
||||||
|
|
||||||
[InstallDelete]
|
[InstallDelete]
|
||||||
Type: filesandordirs; Name: {app}\resources\app\out
|
Type: filesandordirs; Name: "{app}\resources\app\out"; Check: IsNotUpdate
|
||||||
Type: filesandordirs; Name: {app}\resources\app\plugins
|
Type: filesandordirs; Name: "{app}\resources\app\plugins"; Check: IsNotUpdate
|
||||||
Type: filesandordirs; Name: {app}\resources\app\extensions
|
Type: filesandordirs; Name: "{app}\resources\app\extensions"; Check: IsNotUpdate
|
||||||
Type: filesandordirs; Name: {app}\resources\app\node_modules
|
Type: filesandordirs; Name: "{app}\resources\app\node_modules"; Check: IsNotUpdate
|
||||||
Type: files; Name: {app}\resources\app\Credits_45.0.2454.85.html
|
Type: files; Name: "{app}\resources\app\Credits_45.0.2454.85.html"; Check: IsNotUpdate
|
||||||
|
|
||||||
[Tasks]
|
[Tasks]
|
||||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
||||||
@@ -68,14 +68,13 @@ Name: "{commondesktop}\{#NameLong}"; Filename: "{app}\{#ExeBasename}.exe"; AppUs
|
|||||||
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#NameLong}"; Filename: "{app}\{#ExeBasename}.exe"; Tasks: quicklaunchicon; AppUserModelID: "{#AppUserId}"
|
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#NameLong}"; Filename: "{app}\{#ExeBasename}.exe"; Tasks: quicklaunchicon; AppUserModelID: "{#AppUserId}"
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}\{#ExeBasename}.exe"; Description: "{cm:LaunchProgram,{#NameLong}}"; Tasks: runcode; Flags: nowait postinstall; Check: WizardSilent
|
Filename: "{app}\{#ExeBasename}.exe"; Description: "{cm:LaunchProgram,{#NameLong}}"; Tasks: runcode; Flags: nowait postinstall; Check: ShouldRunAfterUpdate
|
||||||
Filename: "{app}\{#ExeBasename}.exe"; Description: "{cm:LaunchProgram,{#NameLong}}"; Flags: nowait postinstall; Check: WizardNotSilent
|
Filename: "{app}\{#ExeBasename}.exe"; Description: "{cm:LaunchProgram,{#NameLong}}"; Flags: nowait postinstall; Check: WizardNotSilent
|
||||||
|
|
||||||
[Registry]
|
[Registry]
|
||||||
Root: HKCR; Subkey: "{#RegValueName}SourceFile"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,{#NameLong}}"; Flags: uninsdeletekey
|
Root: HKCR; Subkey: "{#RegValueName}SourceFile"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,{#NameLong}}"; Flags: uninsdeletekey
|
||||||
Root: HKCR; Subkey: "{#RegValueName}SourceFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\code_file.ico"
|
Root: HKCR; Subkey: "{#RegValueName}SourceFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\code_file.ico"
|
||||||
Root: HKCR; Subkey: "{#RegValueName}SourceFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""
|
Root: HKCR; Subkey: "{#RegValueName}SourceFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""
|
||||||
|
|
||||||
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
|
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
@@ -112,6 +111,33 @@ begin
|
|||||||
Result := not WizardSilent();
|
Result := not WizardSilent();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Updates
|
||||||
|
function IsBackgroundUpdate(): Boolean;
|
||||||
|
begin
|
||||||
|
Result := ExpandConstant('{param:update|false}') <> 'false';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function IsNotUpdate(): Boolean;
|
||||||
|
begin
|
||||||
|
Result := not IsBackgroundUpdate();
|
||||||
|
end;
|
||||||
|
|
||||||
|
// SqlOps will create a flag file before the update starts (/update=C:\foo\bar)
|
||||||
|
// - if the file exists at this point, the user quit SqlOps before the update finished, so don't start SqlOps after update
|
||||||
|
// - otherwise, the user has accepted to apply the update and SqlOps should start
|
||||||
|
function LockFileExists(): Boolean;
|
||||||
|
begin
|
||||||
|
Result := FileExists(ExpandConstant('{param:update}'))
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ShouldRunAfterUpdate(): Boolean;
|
||||||
|
begin
|
||||||
|
if IsBackgroundUpdate() then
|
||||||
|
Result := not LockFileExists()
|
||||||
|
else
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
// http://stackoverflow.com/a/23838239/261019
|
// http://stackoverflow.com/a/23838239/261019
|
||||||
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
|
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
|
||||||
var
|
var
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
AddContextMenuFiles=エクスプローラーのファイル コンテキスト メニューに [%1 で開く] アクションを追加する
|
AddContextMenuFiles=エクスプローラーのファイル コンテキスト メニューに [%1 で開く] アクションを追加する
|
||||||
AddContextMenuFolders=エクスプローラーのディレクトリ コンテキスト メニューに [%1 で開く] アクションを追加する
|
AddContextMenuFolders=エクスプローラーのディレクトリ コンテキスト メニューに [%1 で開く] アクションを追加する
|
||||||
AssociateWithFiles=サポートされているファイルの種類のエディターとして、%1 を登録する
|
AssociateWithFiles=サポートされているファイルの種類のエディターとして、%1 を登録する
|
||||||
AddToPath=PATH への追加 (再起動後に使用可能になる)
|
AddToPath=PATH への追加(再起動後に使用可能)
|
||||||
RunAfter=インストール後に %1 を実行する
|
RunAfter=インストール後に %1 を実行する
|
||||||
Other=その他:
|
Other=その他:
|
||||||
SourceFile=%1 ソース ファイル
|
SourceFile=%1 ソース ファイル
|
||||||
2198
build/yarn.lock
Normal file
2198
build/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
3
dataprotocol-client/.gitignore
vendored
Normal file
3
dataprotocol-client/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
lib
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
3
dataprotocol-client/.npmignore
Normal file
3
dataprotocol-client/.npmignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
src
|
||||||
|
.gitignore
|
||||||
|
tsfmt.json
|
||||||
25
dataprotocol-client/package.json
Normal file
25
dataprotocol-client/package.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "dataprotocol-client",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "SQL Operations Studio studio implementation of vscode-language-client",
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"typings": "./lib/main",
|
||||||
|
"scripts": {
|
||||||
|
"prepare": "node ./node_modules/vscode/bin/install && tsc -p ./src",
|
||||||
|
"compile": "tsc -p ./src",
|
||||||
|
"watch": "tsc -w -p ./src",
|
||||||
|
"update-vscode": "node ./node_modules/vscode/bin/install"
|
||||||
|
},
|
||||||
|
"author": "Microsoft",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"typescript": "2.6.2",
|
||||||
|
"vscode-languageclient": "3.5.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vscode": "1.1.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"vscode": "^1.15"
|
||||||
|
}
|
||||||
|
}
|
||||||
68
dataprotocol-client/src/codeConverter.ts
Normal file
68
dataprotocol-client/src/codeConverter.ts
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import * as data from 'data';
|
||||||
|
import * as proto from './protocol';
|
||||||
|
import * as types from './types';
|
||||||
|
|
||||||
|
export interface Ic2p {
|
||||||
|
asConnectionParams(connectionUri: string, connectionInfo: data.ConnectionInfo): proto.ConnectParams;
|
||||||
|
asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): types.ExecutionPlanOptions;
|
||||||
|
asScriptingParams(connectionUri: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): types.ScriptingParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
function asConnectionParams(ownerUri: string, connInfo: data.ConnectionInfo): proto.ConnectParams {
|
||||||
|
return {
|
||||||
|
ownerUri,
|
||||||
|
connection: {
|
||||||
|
options: connInfo.options
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): types.ExecutionPlanOptions {
|
||||||
|
return {
|
||||||
|
includeEstimatedExecutionPlanXml: planOptions ? planOptions.displayEstimatedQueryPlan : undefined,
|
||||||
|
includeActualExecutionPlanXml: planOptions ? planOptions.displayActualQueryPlan : undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function asScriptingParams(ownerURI: string, operation: data.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): types.ScriptingParams {
|
||||||
|
let scriptingObject: types.ScriptingObject = {
|
||||||
|
type: metadata.metadataTypeName,
|
||||||
|
schema: metadata.schema,
|
||||||
|
name: metadata.name
|
||||||
|
};
|
||||||
|
let targetDatabaseEngineEdition = paramDetails.targetDatabaseEngineEdition;
|
||||||
|
let targetDatabaseEngineType = paramDetails.targetDatabaseEngineType;
|
||||||
|
let scriptCompatibilityOption = paramDetails.scriptCompatibilityOption;
|
||||||
|
let scriptOptions: types.ScriptOptions = {
|
||||||
|
scriptCreateDrop: (operation === types.ScriptOperation.Delete) ? 'ScriptDrop' :
|
||||||
|
(operation === types.ScriptOperation.Select) ? 'ScriptSelect' : 'ScriptCreate',
|
||||||
|
typeOfDataToScript: 'SchemaOnly',
|
||||||
|
scriptStatistics: 'ScriptStatsNone',
|
||||||
|
targetDatabaseEngineEdition: targetDatabaseEngineEdition ? targetDatabaseEngineEdition : 'SqlServerEnterpriseEdition',
|
||||||
|
targetDatabaseEngineType: targetDatabaseEngineType ? targetDatabaseEngineType : 'SingleInstance',
|
||||||
|
scriptCompatibilityOption: scriptCompatibilityOption ? scriptCompatibilityOption : 'Script140Compat'
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
connectionString: null,
|
||||||
|
filePath: paramDetails.filePath,
|
||||||
|
scriptingObjects: [scriptingObject],
|
||||||
|
scriptDestination: 'ToEditor',
|
||||||
|
includeObjectCriteria: null,
|
||||||
|
excludeObjectCriteria: null,
|
||||||
|
includeSchemas: null,
|
||||||
|
excludeSchemas: null,
|
||||||
|
includeTypes: null,
|
||||||
|
excludeTypes: null,
|
||||||
|
scriptOptions,
|
||||||
|
connectionDetails: null,
|
||||||
|
selectScript: null,
|
||||||
|
ownerURI,
|
||||||
|
operation
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const c2p: Ic2p = {
|
||||||
|
asConnectionParams,
|
||||||
|
asExecutionPlanOptions,
|
||||||
|
asScriptingParams
|
||||||
|
};
|
||||||
1312
dataprotocol-client/src/main.ts
Normal file
1312
dataprotocol-client/src/main.ts
Normal file
File diff suppressed because it is too large
Load Diff
633
dataprotocol-client/src/protocol.ts
Normal file
633
dataprotocol-client/src/protocol.ts
Normal file
@@ -0,0 +1,633 @@
|
|||||||
|
import { ClientCapabilities as VSClientCapabilities, RequestType, NotificationType } from 'vscode-languageclient';
|
||||||
|
|
||||||
|
import * as types from './types';
|
||||||
|
import * as data from 'data';
|
||||||
|
|
||||||
|
export interface ConnectionClientCapabilities {
|
||||||
|
connection?: {
|
||||||
|
/**
|
||||||
|
* Whether the connection support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
backup?: {
|
||||||
|
/**
|
||||||
|
* Whether the backup support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
restore?: {
|
||||||
|
/**
|
||||||
|
* Whether the restore support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
query?: {
|
||||||
|
/**
|
||||||
|
* Whether the query support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
objectExplorer?: {
|
||||||
|
/**
|
||||||
|
* Whether the object explorer support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
scripting?: {
|
||||||
|
/**
|
||||||
|
* Whether the scripting support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
taskServices?: {
|
||||||
|
/**
|
||||||
|
* Whether the task services support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
fileBrowser?: {
|
||||||
|
/**
|
||||||
|
* Whether the file browser support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
profiler?: {
|
||||||
|
/**
|
||||||
|
* Whether the profiler support dynamic registration
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
capabilities?: {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
metadata?: {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
adminServices?: {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
dynamicRegistration?: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClientCapabilities extends VSClientCapabilities {
|
||||||
|
connection?: ConnectionClientCapabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---- Refresh IntelliSense ----------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification sent when the an IntelliSense cache invalidation is requested
|
||||||
|
*/
|
||||||
|
export namespace RebuildIntelliSenseNotification {
|
||||||
|
export const type = new NotificationType<RebuildIntelliSenseParams, void>('textDocument/rebuildIntelliSense');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuild IntelliSense notification parameters
|
||||||
|
*/
|
||||||
|
export class RebuildIntelliSenseParams {
|
||||||
|
/**
|
||||||
|
* URI identifying the text document
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------- < Connect Request > ----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection request message format
|
||||||
|
*/
|
||||||
|
export interface ConnectParams {
|
||||||
|
/**
|
||||||
|
* URI identifying the owner of the connection
|
||||||
|
*/
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Details for creating the connection
|
||||||
|
*/
|
||||||
|
connection: types.ConnectionDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Connection request message callback declaration
|
||||||
|
export namespace ConnectionRequest {
|
||||||
|
export const type = new RequestType<ConnectParams, boolean, void, void>('connection/connect');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Connection Complete Event > ------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
export namespace ConnectionCompleteNotification {
|
||||||
|
export const type = new NotificationType<types.ConnectionCompleteParams, void>('connection/complete');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Connection Changed Event > -------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters for the ConnectionChanged notification.
|
||||||
|
*/
|
||||||
|
export class ConnectionChangedParams {
|
||||||
|
/**
|
||||||
|
* Owner URI of the connection that changed.
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary of details containing any connection changes.
|
||||||
|
*/
|
||||||
|
public connection: types.ConnectionSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection changed event callback declaration.
|
||||||
|
*/
|
||||||
|
export namespace ConnectionChangedNotification {
|
||||||
|
export const type = new NotificationType<ConnectionChangedParams, void>('connection/connectionchanged');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Disconnect Request > -------------------------------------------
|
||||||
|
|
||||||
|
// Disconnect request message format
|
||||||
|
export class DisconnectParams {
|
||||||
|
// URI identifying the owner of the connection
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disconnect response format
|
||||||
|
export type DisconnectResult = boolean;
|
||||||
|
|
||||||
|
// Disconnect request message callback declaration
|
||||||
|
export namespace DisconnectRequest {
|
||||||
|
export const type = new RequestType<DisconnectParams, DisconnectResult, void, void>('connection/disconnect');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Cancel Connect Request > ---------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
// Cancel connect request message format
|
||||||
|
export class CancelConnectParams {
|
||||||
|
/**
|
||||||
|
* URI identifying the owner of the connection
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancel connect response format.
|
||||||
|
export type CancelConnectResult = boolean;
|
||||||
|
|
||||||
|
// Cancel connect request message callback declaration
|
||||||
|
export namespace CancelConnectRequest {
|
||||||
|
export const type = new RequestType<CancelConnectParams, CancelConnectResult, void, void>('connection/cancelconnect');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Change Database Request > -------------------------------------
|
||||||
|
|
||||||
|
export class ChangeDatabaseParams {
|
||||||
|
public ownerUri: string;
|
||||||
|
public newDatabase: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ChangeDatabaseRequest {
|
||||||
|
export const type = new RequestType<ChangeDatabaseParams, boolean, void, void>('connection/changedatabase');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < List Databases Request > ---------------------------------------
|
||||||
|
|
||||||
|
// List databases request format
|
||||||
|
export class ListDatabasesParams {
|
||||||
|
// Connection information to use for querying master
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// List databases request callback declaration
|
||||||
|
export namespace ListDatabasesRequest {
|
||||||
|
export const type = new RequestType<ListDatabasesParams, data.ListDatabasesResult, void, void>('connection/listdatabases');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Language Flavor Changed ================================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters to provide when sending a language flavor changed notification
|
||||||
|
*/
|
||||||
|
export interface DidChangeLanguageFlavorParams {
|
||||||
|
uri: string;
|
||||||
|
language: string;
|
||||||
|
flavor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Language Flavor Changed Notification > ---------------------------------------
|
||||||
|
export namespace LanguageFlavorChangedNotification {
|
||||||
|
export const type = new NotificationType<DidChangeLanguageFlavorParams, void>('connection/languageflavorchanged');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Table Metadata Request > ---------------------------------------
|
||||||
|
|
||||||
|
// Table metadata request format
|
||||||
|
export class TableMetadataParams {
|
||||||
|
// Connection information to use for querying master
|
||||||
|
public ownerUri: string;
|
||||||
|
|
||||||
|
public schema: string;
|
||||||
|
|
||||||
|
public objectName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table metadata response format
|
||||||
|
export class TableMetadataResult {
|
||||||
|
public columns: data.ColumnMetadata[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Table metadata request callback declaration
|
||||||
|
export namespace TableMetadataRequest {
|
||||||
|
export const type = new RequestType<TableMetadataParams, TableMetadataResult, void, void>('metadata/table');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < View Metadata Request > ---------------------------------------
|
||||||
|
|
||||||
|
// Table metadata request callback declaration
|
||||||
|
export namespace ViewMetadataRequest {
|
||||||
|
export const type = new RequestType<TableMetadataParams, TableMetadataResult, void, void>('metadata/view');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event sent when the language service is finished updating after a connection
|
||||||
|
*/
|
||||||
|
export namespace IntelliSenseReadyNotification {
|
||||||
|
export const type = new NotificationType<types.IntelliSenseReadyParams, void>('textDocument/intelliSenseReady');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Capabilties Discovery Event > ------------------------------------
|
||||||
|
|
||||||
|
export class CapabiltiesDiscoveryParams {
|
||||||
|
public hostName: string;
|
||||||
|
|
||||||
|
public hostVersion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace CapabiltiesDiscoveryRequest {
|
||||||
|
export const type = new RequestType<CapabiltiesDiscoveryParams, types.CapabiltiesDiscoveryResult, void, void>('capabilities/list');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query Execution ================================================================================
|
||||||
|
// ------------------------------- < Query Cancellation Request > ------------------------------------
|
||||||
|
export namespace QueryCancelRequest {
|
||||||
|
export const type = new RequestType<QueryCancelParams, data.QueryCancelResult, void, void>('query/cancel');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueryCancelParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Dispose Request > ------------------------------------
|
||||||
|
|
||||||
|
export namespace QueryDisposeRequest {
|
||||||
|
export const type = new RequestType<QueryDisposeParams, QueryDisposeResult, void, void>('query/dispose');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters to provide when disposing of a query
|
||||||
|
*/
|
||||||
|
export interface QueryDisposeParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Result received upon successful disposal of a query
|
||||||
|
*/
|
||||||
|
export interface QueryDisposeResult {
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Execution Complete Notification > ------------------------------------
|
||||||
|
export namespace QueryExecuteCompleteNotification {
|
||||||
|
export const type = new NotificationType<data.QueryExecuteCompleteNotificationResult, void>('query/complete');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Batch Start Notification > ------------------------------------
|
||||||
|
export namespace QueryExecuteBatchStartNotification {
|
||||||
|
export const type = new NotificationType<data.QueryExecuteBatchNotificationParams, void>('query/batchStart');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Batch Complete Notification > ------------------------------------
|
||||||
|
export namespace QueryExecuteBatchCompleteNotification {
|
||||||
|
export const type = new NotificationType<data.QueryExecuteBatchNotificationParams, void>('query/batchComplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query ResultSet Complete Notification > ------------------------------------
|
||||||
|
export namespace QueryExecuteResultSetCompleteNotification {
|
||||||
|
export const type = new NotificationType<data.QueryExecuteResultSetCompleteNotificationParams, void>('query/resultSetComplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Message Notification > ------------------------------------
|
||||||
|
export namespace QueryExecuteMessageNotification {
|
||||||
|
export const type = new NotificationType<data.QueryExecuteMessageParams, void>('query/message');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Query Execution Request > ------------------------------------
|
||||||
|
export namespace QueryExecuteRequest {
|
||||||
|
export const type = new RequestType<types.QueryExecuteParams, QueryExecuteResult, void, void>('query/executeDocumentSelection');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueryExecuteResult { }
|
||||||
|
|
||||||
|
// ------------------------------- < Query Results Request > ------------------------------------
|
||||||
|
export namespace QueryExecuteSubsetRequest {
|
||||||
|
export const type = new RequestType<data.QueryExecuteSubsetParams, data.QueryExecuteSubsetResult, void, void>('query/subset');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResultSetSubset {
|
||||||
|
rowCount: number;
|
||||||
|
rows: data.DbCellValue[][];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Execute Statement > ------------------------------------
|
||||||
|
export interface QueryExecuteStatementParams {
|
||||||
|
ownerUri: string;
|
||||||
|
line: number;
|
||||||
|
column: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace QueryExecuteStatementRequest {
|
||||||
|
export const type = new RequestType<QueryExecuteStatementParams, QueryExecuteResult, void, void>('query/executedocumentstatement');
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------- < Save Results as CSV Request > ------------------------------------------
|
||||||
|
|
||||||
|
// save results in csv format
|
||||||
|
export namespace SaveResultsAsCsvRequest {
|
||||||
|
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveCsv');
|
||||||
|
}
|
||||||
|
// --------------------------------- </ Save Results as CSV Request > ------------------------------------------
|
||||||
|
|
||||||
|
// --------------------------------- < Save Results as JSON Request > ------------------------------------------
|
||||||
|
// save results in json format
|
||||||
|
export namespace SaveResultsAsJsonRequest {
|
||||||
|
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveJson');
|
||||||
|
}
|
||||||
|
// --------------------------------- </ Save Results as JSON Request > ------------------------------------------
|
||||||
|
|
||||||
|
// --------------------------------- < Save Results as Excel Request > ------------------------------------------
|
||||||
|
// save results in Excel format
|
||||||
|
export namespace SaveResultsAsExcelRequest {
|
||||||
|
export const type = new RequestType<data.SaveResultsRequestParams, data.SaveResultRequestResult, void, void>('query/saveExcel');
|
||||||
|
}
|
||||||
|
// --------------------------------- </ Save Results as Excel Request > ------------------------------------------
|
||||||
|
|
||||||
|
// ------------------------------- < Execute and Return > -----------------------------------
|
||||||
|
|
||||||
|
export namespace SimpleExecuteRequest {
|
||||||
|
export const type = new RequestType<data.SimpleExecuteParams, data.SimpleExecuteResult, void, void>('query/simpleexecute');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Execute String > ------------------------------------
|
||||||
|
export interface QueryExecuteStringParams {
|
||||||
|
query: string;
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace QueryExecuteStringRequest {
|
||||||
|
export const type = new RequestType<QueryExecuteStringParams, QueryExecuteResult, void, void>('query/executeString');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Metadata Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace MetadataQueryRequest {
|
||||||
|
export const type = new RequestType<types.MetadataQueryParams, types.MetadataQueryResult, void, void>('metadata/list');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Scripting Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace ScriptingRequest {
|
||||||
|
export const type = new RequestType<types.ScriptingParams, data.ScriptingResult, void, void>('scripting/script');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Scripting Complete Event > ------------------------------------
|
||||||
|
|
||||||
|
export namespace ScriptingCompleteNotification {
|
||||||
|
export const type = new NotificationType<types.ScriptingCompleteParams, void>('scripting/scriptComplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Edit Data ======================================================================================
|
||||||
|
// Shared Interfaces --------------------------------------------------------------------------
|
||||||
|
export interface EditSessionOperationParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditRowOperationParams extends EditSessionOperationParams {
|
||||||
|
rowId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditCellResult {
|
||||||
|
cell: data.EditCell;
|
||||||
|
isRowDirty: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
// edit/commit --------------------------------------------------------------------------------
|
||||||
|
export namespace EditCommitRequest {
|
||||||
|
export const type = new RequestType<data.EditCommitParams, EditCommitResult, void, void>('edit/commit');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditCommitResult { }
|
||||||
|
|
||||||
|
// edit/createRow -----------------------------------------------------------------------------
|
||||||
|
export namespace EditCreateRowRequest {
|
||||||
|
export const type = new RequestType<data.EditCreateRowParams, data.EditCreateRowResult, void, void>('edit/createRow');
|
||||||
|
}
|
||||||
|
|
||||||
|
// edit/deleteRow -----------------------------------------------------------------------------
|
||||||
|
export namespace EditDeleteRowRequest {
|
||||||
|
export const type = new RequestType<data.EditDeleteRowParams, EditDeleteRowResult, void, void>('edit/deleteRow');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditDeleteRowResult { }
|
||||||
|
|
||||||
|
// edit/dispose -------------------------------------------------------------------------------
|
||||||
|
export namespace EditDisposeRequest {
|
||||||
|
export const type = new RequestType<data.EditDisposeParams, EditDisposeResult, void, void>('edit/dispose');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditDisposeResult { }
|
||||||
|
|
||||||
|
// edit/initialize ----------------------------------------------------------------------------
|
||||||
|
export namespace EditInitializeRequest {
|
||||||
|
export const type = new RequestType<data.EditInitializeParams, EditInitializeResult, void, void>('edit/initialize');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditInitializeResult { }
|
||||||
|
|
||||||
|
// edit/revertCell --------------------------------------------------------------------------------
|
||||||
|
export namespace EditRevertCellRequest {
|
||||||
|
export const type = new RequestType<data.EditRevertCellParams, data.EditRevertCellResult, void, void>('edit/revertCell');
|
||||||
|
}
|
||||||
|
|
||||||
|
// edit/revertRow -----------------------------------------------------------------------------
|
||||||
|
export namespace EditRevertRowRequest {
|
||||||
|
export const type = new RequestType<data.EditRevertRowParams, EditRevertRowResult, void, void>('edit/revertRow');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditRevertRowResult { }
|
||||||
|
|
||||||
|
// edit/sessionReady Event --------------------------------------------------------------------
|
||||||
|
export namespace EditSessionReadyNotification {
|
||||||
|
export const type = new NotificationType<data.EditSessionReadyParams, void>('edit/sessionReady');
|
||||||
|
}
|
||||||
|
|
||||||
|
// edit/updateCell ----------------------------------------------------------------------------
|
||||||
|
export namespace EditUpdateCellRequest {
|
||||||
|
export const type = new RequestType<data.EditUpdateCellParams, data.EditUpdateCellResult, void, void>('edit/updateCell');
|
||||||
|
}
|
||||||
|
|
||||||
|
// edit/subset ------------------------------------------------------------------------------------
|
||||||
|
export namespace EditSubsetRequest {
|
||||||
|
export const type = new RequestType<data.EditSubsetParams, data.EditSubsetResult, void, void>('edit/subset');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Object Explorer Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace ObjectExplorerCreateSessionRequest {
|
||||||
|
export const type = new RequestType<types.ConnectionDetails, types.CreateSessionResponse, void, void>('objectexplorer/createsession');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ObjectExplorerExpandRequest {
|
||||||
|
export const type = new RequestType<types.ExpandParams, boolean, void, void>('objectexplorer/expand');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ObjectExplorerRefreshRequest {
|
||||||
|
export const type = new RequestType<types.ExpandParams, boolean, void, void>('objectexplorer/refresh');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ObjectExplorerCloseSessionRequest {
|
||||||
|
export const type = new RequestType<types.CloseSessionParams, types.CloseSessionResponse, void, void>('objectexplorer/closesession');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Object Explorer Events > ------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
export namespace ObjectExplorerCreateSessionCompleteNotification {
|
||||||
|
export const type = new NotificationType<types.SessionCreatedParameters, void>('objectexplorer/sessioncreated');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ObjectExplorerExpandCompleteNotification {
|
||||||
|
export const type = new NotificationType<types.ExpandResponse, void>('objectexplorer/expandCompleted');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Task Service Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace ListTasksRequest {
|
||||||
|
export const type = new RequestType<data.ListTasksParams, data.ListTasksResponse, void, void>('tasks/listtasks');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace CancelTaskRequest {
|
||||||
|
export const type = new RequestType<data.CancelTaskParams, boolean, void, void>('tasks/canceltask');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Task Service Events > ------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
export namespace TaskStatusChangedNotification {
|
||||||
|
export const type = new NotificationType<data.TaskProgressInfo, void>('tasks/statuschanged');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace TaskCreatedNotification {
|
||||||
|
export const type = new NotificationType<data.TaskInfo, void>('tasks/newtaskcreated');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Admin Service Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace CreateDatabaseRequest {
|
||||||
|
export const type = new RequestType<types.CreateDatabaseParams, data.CreateDatabaseResponse, void, void>('admin/createdatabase');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace DefaultDatabaseInfoRequest {
|
||||||
|
export const type = new RequestType<types.DefaultDatabaseInfoParams, types.DefaultDatabaseInfoResponse, void, void>('admin/defaultdatabaseinfo');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace CreateLoginRequest {
|
||||||
|
export const type = new RequestType<types.CreateLoginParams, data.CreateLoginResponse, void, void>('admin/createlogin');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace GetDatabaseInfoRequest {
|
||||||
|
export const type = new RequestType<types.GetDatabaseInfoParams, types.GetDatabaseInfoResponse, void, void>('admin/getdatabaseinfo');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < Disaster Recovery Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace BackupRequest {
|
||||||
|
export const type = new RequestType<types.BackupParams, data.BackupResponse, void, void>('backup/backup');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace BackupConfigInfoRequest {
|
||||||
|
export const type = new RequestType<types.DefaultDatabaseInfoParams, types.BackupConfigInfoResponse, void, void>('backup/backupconfiginfo');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace RestoreRequest {
|
||||||
|
export const type = new RequestType<types.RestoreParams, data.RestoreResponse, void, void>('restore/restore');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace RestorePlanRequest {
|
||||||
|
export const type = new RequestType<types.RestoreParams, data.RestorePlanResponse, void, void>('restore/restoreplan');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace CancelRestorePlanRequest {
|
||||||
|
export const type = new RequestType<types.RestoreParams, boolean, void, void>('restore/cancelrestoreplan');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace RestoreConfigInfoRequest {
|
||||||
|
export const type = new RequestType<types.RestoreConfigInfoRequestParams, types.RestoreConfigInfoResponse, void, void>('restore/restoreconfiginfo');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------- < File Browser Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace FileBrowserOpenRequest {
|
||||||
|
export const type = new RequestType<types.FileBrowserOpenParams, boolean, void, void>('filebrowser/open');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserOpenedNotification {
|
||||||
|
export const type = new NotificationType<data.FileBrowserOpenedParams, void>('filebrowser/opencomplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserExpandRequest {
|
||||||
|
export const type = new RequestType<types.FileBrowserExpandParams, boolean, void, void>('filebrowser/expand');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserExpandedNotification {
|
||||||
|
export const type = new NotificationType<data.FileBrowserExpandedParams, void>('filebrowser/expandcomplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserValidateRequest {
|
||||||
|
export const type = new RequestType<types.FileBrowserValidateParams, boolean, void, void>('filebrowser/validate');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserValidatedNotification {
|
||||||
|
export const type = new NotificationType<data.FileBrowserValidatedParams, void>('filebrowser/validatecomplete');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace FileBrowserCloseRequest {
|
||||||
|
export const type = new RequestType<types.FileBrowserCloseParams, data.FileBrowserCloseResponse, void, void>('filebrowser/close');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------------------- < Profiler Events > ------------------------------------
|
||||||
|
|
||||||
|
export namespace StartProfilingRequest {
|
||||||
|
export const type = new RequestType<types.StartProfilingParams, types.StartProfilingResponse, void, void>('profiler/start');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace StopProfilingRequest {
|
||||||
|
export const type = new RequestType<types.StopProfilingParams, types.StopProfilingResponse, void, void>('profiler/stop');
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ProfilerEventsAvailableNotification {
|
||||||
|
export const type = new NotificationType<types.ProfilerEventsAvailableParams, void>('profiler/eventsavailable');
|
||||||
|
}
|
||||||
198
dataprotocol-client/src/protocolConverter.ts
Normal file
198
dataprotocol-client/src/protocolConverter.ts
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
import * as data from 'data';
|
||||||
|
import * as types from './types';
|
||||||
|
|
||||||
|
export interface Ip2c {
|
||||||
|
asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata;
|
||||||
|
|
||||||
|
asServerCapabilities(result: types.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
function asProviderMetadata(params: types.MetadataQueryResult): data.ProviderMetadata {
|
||||||
|
let objectMetadata: data.ObjectMetadata[] = [];
|
||||||
|
|
||||||
|
if (!params.metadata || !params.metadata.length) {
|
||||||
|
return {
|
||||||
|
objectMetadata
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < params.metadata.length; ++i) {
|
||||||
|
let metadata: data.ObjectMetadata = params.metadata[i];
|
||||||
|
|
||||||
|
let metadataTypeName: string;
|
||||||
|
if (metadata.metadataTypeName) {
|
||||||
|
// Read from the provider since it's defined
|
||||||
|
metadataTypeName = metadata.metadataTypeName;
|
||||||
|
} else if (metadata.metadataType === types.MetadataType.View) {
|
||||||
|
metadataTypeName = 'View';
|
||||||
|
} else if (metadata.metadataType === types.MetadataType.SProc) {
|
||||||
|
metadataTypeName = 'StoredProcedure';
|
||||||
|
} else if (metadata.metadataType === types.MetadataType.Function) {
|
||||||
|
metadataTypeName = 'Function';
|
||||||
|
} else {
|
||||||
|
metadataTypeName = 'Table';
|
||||||
|
}
|
||||||
|
|
||||||
|
objectMetadata.push({
|
||||||
|
metadataTypeName,
|
||||||
|
metadataType: metadata.metadataType,
|
||||||
|
name: metadata.name,
|
||||||
|
schema: metadata.schema,
|
||||||
|
urn: metadata.urn
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return <data.ProviderMetadata>{
|
||||||
|
objectMetadata
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function asServiceOptionType(val: string): data.ServiceOptionType {
|
||||||
|
if (val === 'string') {
|
||||||
|
return data.ServiceOptionType.string;
|
||||||
|
} else if (val === 'multistring') {
|
||||||
|
return data.ServiceOptionType.multistring;
|
||||||
|
} else if (val === 'password') {
|
||||||
|
return data.ServiceOptionType.password;
|
||||||
|
} else if (val === 'number') {
|
||||||
|
return data.ServiceOptionType.number;
|
||||||
|
} else if (val === 'boolean') {
|
||||||
|
return data.ServiceOptionType.boolean;
|
||||||
|
} else if (val === 'category') {
|
||||||
|
return data.ServiceOptionType.category;
|
||||||
|
} else if (val === 'object') {
|
||||||
|
return data.ServiceOptionType.object;
|
||||||
|
}
|
||||||
|
|
||||||
|
// assume string for unknown value types
|
||||||
|
return data.ServiceOptionType.string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function buildServiceOption(srcOption: types.ServiceOption): data.ServiceOption {
|
||||||
|
return {
|
||||||
|
name: srcOption.name,
|
||||||
|
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
||||||
|
description: srcOption.description,
|
||||||
|
groupName: srcOption.groupName,
|
||||||
|
defaultValue: srcOption.defaultValue,
|
||||||
|
categoryValues: srcOption.categoryValues,
|
||||||
|
isRequired: srcOption.isRequired,
|
||||||
|
isArray: srcOption.isArray,
|
||||||
|
objectType: srcOption.objectType,
|
||||||
|
valueType: asServiceOptionType(srcOption.valueType),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function asServerCapabilities(result: types.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities {
|
||||||
|
let capabilities: data.DataProtocolServerCapabilities = {
|
||||||
|
protocolVersion: result.capabilities.protocolVersion,
|
||||||
|
providerName: result.capabilities.providerName,
|
||||||
|
providerDisplayName: result.capabilities.providerDisplayName,
|
||||||
|
connectionProvider: undefined,
|
||||||
|
adminServicesProvider: undefined,
|
||||||
|
features: []
|
||||||
|
};
|
||||||
|
|
||||||
|
if (result.capabilities.adminServicesProvider) {
|
||||||
|
capabilities.adminServicesProvider = <data.AdminServicesOptions>{
|
||||||
|
databaseInfoOptions: new Array<data.ServiceOption>(),
|
||||||
|
databaseFileInfoOptions: new Array<data.ServiceOption>(),
|
||||||
|
fileGroupInfoOptions: new Array<data.ServiceOption>()
|
||||||
|
};
|
||||||
|
|
||||||
|
if (result.capabilities.adminServicesProvider.databaseInfoOptions
|
||||||
|
&& result.capabilities.adminServicesProvider.databaseInfoOptions.length > 0) {
|
||||||
|
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseInfoOptions.length; ++i) {
|
||||||
|
let srcOption: any = result.capabilities.adminServicesProvider.databaseInfoOptions[i];
|
||||||
|
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||||
|
capabilities.adminServicesProvider.databaseInfoOptions.push(descOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.capabilities.adminServicesProvider.databaseFileInfoOptions
|
||||||
|
&& result.capabilities.adminServicesProvider.databaseFileInfoOptions.length > 0) {
|
||||||
|
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseFileInfoOptions.length; ++i) {
|
||||||
|
//let srcOption: types.ServiceOption = result.capabilities.adminServicesProvider.databaseFileInfoOptions[i];
|
||||||
|
let srcOption: any = result.capabilities.adminServicesProvider.databaseFileInfoOptions[i];
|
||||||
|
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||||
|
capabilities.adminServicesProvider.databaseFileInfoOptions.push(descOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.capabilities.adminServicesProvider.fileGroupInfoOptions
|
||||||
|
&& result.capabilities.adminServicesProvider.fileGroupInfoOptions.length > 0) {
|
||||||
|
for (let i = 0; i < result.capabilities.adminServicesProvider.fileGroupInfoOptions.length; ++i) {
|
||||||
|
//let srcOption: types.ServiceOption = result.capabilities.adminServicesProvider.fileGroupInfoOptions[i];
|
||||||
|
let srcOption: any = result.capabilities.adminServicesProvider.fileGroupInfoOptions[i];
|
||||||
|
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
||||||
|
capabilities.adminServicesProvider.fileGroupInfoOptions.push(descOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.capabilities.connectionProvider
|
||||||
|
&& result.capabilities.connectionProvider.options
|
||||||
|
&& result.capabilities.connectionProvider.options.length > 0) {
|
||||||
|
capabilities.connectionProvider = <data.ConnectionProviderOptions>{
|
||||||
|
options: new Array<data.ConnectionOption>()
|
||||||
|
};
|
||||||
|
for (let i = 0; i < result.capabilities.connectionProvider.options.length; ++i) {
|
||||||
|
let srcOption: any = result.capabilities.connectionProvider.options[i];
|
||||||
|
let descOption: data.ConnectionOption = {
|
||||||
|
name: srcOption.name,
|
||||||
|
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
||||||
|
description: srcOption.description,
|
||||||
|
groupName: srcOption.groupName,
|
||||||
|
defaultValue: srcOption.defaultValue,
|
||||||
|
categoryValues: srcOption.categoryValues,
|
||||||
|
isIdentity: srcOption.isIdentity,
|
||||||
|
isRequired: srcOption.isRequired,
|
||||||
|
valueType: asServiceOptionType(srcOption.valueType),
|
||||||
|
specialValueType: undefined
|
||||||
|
};
|
||||||
|
|
||||||
|
if (srcOption.specialValueType === 'serverName') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.serverName;
|
||||||
|
} else if (srcOption.specialValueType === 'databaseName') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.databaseName;
|
||||||
|
} else if (srcOption.specialValueType === 'authType') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.authType;
|
||||||
|
} else if (srcOption.specialValueType === 'userName') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.userName;
|
||||||
|
} else if (srcOption.specialValueType === 'password') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.password;
|
||||||
|
} else if (srcOption.specialValueType === 'appName') {
|
||||||
|
descOption.specialValueType = data.ConnectionOptionSpecialType.appName;
|
||||||
|
}
|
||||||
|
|
||||||
|
capabilities.connectionProvider.options.push(descOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.capabilities.features
|
||||||
|
&& result.capabilities.features.length > 0) {
|
||||||
|
result.capabilities.features.forEach(feature => {
|
||||||
|
let descFeature: data.FeatureMetadataProvider = {
|
||||||
|
enabled: feature.enabled,
|
||||||
|
featureName: feature.featureName,
|
||||||
|
optionsMetadata: []
|
||||||
|
};
|
||||||
|
capabilities.features.push(descFeature);
|
||||||
|
if (feature.optionsMetadata) {
|
||||||
|
feature.optionsMetadata.forEach(srcOption => {
|
||||||
|
descFeature.optionsMetadata.push(buildServiceOption(<any>srcOption));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const p2c: Ip2c = {
|
||||||
|
asProviderMetadata,
|
||||||
|
asServerCapabilities
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
939
dataprotocol-client/src/types.ts
Normal file
939
dataprotocol-client/src/types.ts
Normal file
@@ -0,0 +1,939 @@
|
|||||||
|
import * as data from 'data';
|
||||||
|
|
||||||
|
export interface CreateSessionResponse {
|
||||||
|
sessionId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SessionCreatedParameters {
|
||||||
|
success: boolean;
|
||||||
|
sessionId: string;
|
||||||
|
rootNode: NodeInfo;
|
||||||
|
errorMessage: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExpandResponse {
|
||||||
|
nodePath: string;
|
||||||
|
sessionId: string;
|
||||||
|
nodes: NodeInfo[];
|
||||||
|
errorMessage: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NodeInfo {
|
||||||
|
nodePath: string;
|
||||||
|
nodeType: string;
|
||||||
|
nodeSubType: string;
|
||||||
|
nodeStatus: string;
|
||||||
|
label: string;
|
||||||
|
isLeaf: boolean;
|
||||||
|
metadata: data.ObjectMetadata;
|
||||||
|
errorMessage: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExpandParams {
|
||||||
|
sessionId: string;
|
||||||
|
nodePath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CloseSessionParams {
|
||||||
|
sessionId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CloseSessionResponse {
|
||||||
|
success: boolean;
|
||||||
|
sessionId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CategoryValue {
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServiceOption {
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
groupName: string;
|
||||||
|
|
||||||
|
valueType: string;
|
||||||
|
|
||||||
|
defaultValue: string;
|
||||||
|
|
||||||
|
objectType: string;
|
||||||
|
|
||||||
|
categoryValues: CategoryValue[];
|
||||||
|
|
||||||
|
isRequired: boolean;
|
||||||
|
|
||||||
|
isArray: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConnectionOption {
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
groupName: string;
|
||||||
|
|
||||||
|
valueType: string;
|
||||||
|
|
||||||
|
defaultValue: string;
|
||||||
|
|
||||||
|
objectType: string;
|
||||||
|
|
||||||
|
categoryValues: CategoryValue[];
|
||||||
|
|
||||||
|
specialValueType: string;
|
||||||
|
|
||||||
|
isIdentity: boolean;
|
||||||
|
|
||||||
|
isRequired: boolean;
|
||||||
|
|
||||||
|
isArray: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConnectionProviderOptions {
|
||||||
|
options: ConnectionOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminServicesProviderOptions {
|
||||||
|
databaseInfoOptions: ServiceOption[];
|
||||||
|
|
||||||
|
databaseFileInfoOptions: ServiceOption[];
|
||||||
|
|
||||||
|
fileGroupInfoOptions: ServiceOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FeatureMetadataProvider {
|
||||||
|
enabled: boolean;
|
||||||
|
featureName: string;
|
||||||
|
optionsMetadata: ServiceOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters to initialize a connection to a database
|
||||||
|
*/
|
||||||
|
export interface ConnectionDetails {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* connection options
|
||||||
|
*/
|
||||||
|
options: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary that identifies a unique database connection.
|
||||||
|
*/
|
||||||
|
export class ConnectionSummary {
|
||||||
|
/**
|
||||||
|
* server name
|
||||||
|
*/
|
||||||
|
public serverName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* database name
|
||||||
|
*/
|
||||||
|
public databaseName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* user name
|
||||||
|
*/
|
||||||
|
public userName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection response format.
|
||||||
|
*/
|
||||||
|
export class ConnectionCompleteParams {
|
||||||
|
/**
|
||||||
|
* URI identifying the owner of the connection
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* connection id returned from service host.
|
||||||
|
*/
|
||||||
|
public connectionId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* any diagnostic messages return from the service host.
|
||||||
|
*/
|
||||||
|
public messages: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error message returned from the engine, if any.
|
||||||
|
*/
|
||||||
|
public errorMessage: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error number returned from the engine, if any.
|
||||||
|
*/
|
||||||
|
public errorNumber: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the connected server.
|
||||||
|
*/
|
||||||
|
public serverInfo: ServerInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* information about the actual connection established
|
||||||
|
*/
|
||||||
|
public connectionSummary: ConnectionSummary;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update event parameters
|
||||||
|
*/
|
||||||
|
export class IntelliSenseReadyParams {
|
||||||
|
/**
|
||||||
|
* URI identifying the text document
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about a SQL Server instance.
|
||||||
|
*/
|
||||||
|
export class ServerInfo {
|
||||||
|
/**
|
||||||
|
* The major version of the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public serverMajorVersion: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minor version of the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public serverMinorVersion: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The build of the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public serverReleaseVersion: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the engine edition of the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public engineEditionId: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String containing the full server version text.
|
||||||
|
*/
|
||||||
|
public serverVersion: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String describing the product level of the server.
|
||||||
|
*/
|
||||||
|
public serverLevel: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The edition of the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public serverEdition: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the SQL Server instance is running in the cloud (Azure) or not.
|
||||||
|
*/
|
||||||
|
public isCloud: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of Azure that the SQL Server instance is running on, if applicable.
|
||||||
|
*/
|
||||||
|
public azureVersion: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Operating System version string of the machine running the SQL Server instance.
|
||||||
|
*/
|
||||||
|
public osVersion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CapabiltiesDiscoveryResult {
|
||||||
|
public capabilities: data.DataProtocolServerCapabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task Services types
|
||||||
|
|
||||||
|
export enum TaskStatus {
|
||||||
|
notStarted = 0,
|
||||||
|
inProgress = 1,
|
||||||
|
succeeded = 2,
|
||||||
|
succeededWithWarning = 3,
|
||||||
|
failed = 4,
|
||||||
|
canceled = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
// Admin Services types
|
||||||
|
|
||||||
|
export interface CreateDatabaseParams {
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
databaseInfo: data.DatabaseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultDatabaseInfoParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DefaultDatabaseInfoResponse {
|
||||||
|
defaultDatabaseInfo: data.DatabaseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetDatabaseInfoResponse {
|
||||||
|
databaseInfo: data.DatabaseInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetDatabaseInfoParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BackupConfigInfoResponse {
|
||||||
|
backupConfigInfo: data.BackupConfigInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateLoginParams {
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
loginInfo: data.LoginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disaster Recovery types
|
||||||
|
|
||||||
|
export interface BackupInfo {
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
databaseName: string;
|
||||||
|
|
||||||
|
backupType: number;
|
||||||
|
|
||||||
|
backupComponent: number;
|
||||||
|
|
||||||
|
backupDeviceType: number;
|
||||||
|
|
||||||
|
selectedFiles: string;
|
||||||
|
|
||||||
|
backupsetName: string;
|
||||||
|
|
||||||
|
selectedFileGroup: { [path: string]: string };
|
||||||
|
|
||||||
|
// List of {key: backup path, value: device type}
|
||||||
|
backupPathDevices: { [path: string]: number };
|
||||||
|
|
||||||
|
backupPathList: [string];
|
||||||
|
|
||||||
|
isCopyOnly: boolean;
|
||||||
|
|
||||||
|
formatMedia: boolean;
|
||||||
|
|
||||||
|
initialize: boolean;
|
||||||
|
|
||||||
|
skipTapeHeader: boolean;
|
||||||
|
|
||||||
|
mediaName: string;
|
||||||
|
|
||||||
|
mediaDescription: string;
|
||||||
|
|
||||||
|
checksum: boolean;
|
||||||
|
|
||||||
|
continueAfterError: boolean;
|
||||||
|
|
||||||
|
logTruncation: boolean;
|
||||||
|
|
||||||
|
tailLogBackup: boolean;
|
||||||
|
|
||||||
|
retainDays: number;
|
||||||
|
|
||||||
|
compressionOption: number;
|
||||||
|
|
||||||
|
verifyBackupRequired: boolean;
|
||||||
|
|
||||||
|
encryptionAlgorithm: number;
|
||||||
|
|
||||||
|
encryptorType: number;
|
||||||
|
|
||||||
|
encryptorName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BackupParams {
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
backupInfo: BackupInfo;
|
||||||
|
|
||||||
|
taskExecutionMode: data.TaskExecutionMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestoreParams {
|
||||||
|
ownerUri: string;
|
||||||
|
options: {};
|
||||||
|
taskExecutionMode: data.TaskExecutionMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestoreConfigInfoRequestParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestoreConfigInfoResponse {
|
||||||
|
configInfo: { [key: string]: any };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestoreDatabaseFileInfo {
|
||||||
|
fileType: string;
|
||||||
|
|
||||||
|
logicalFileName: string;
|
||||||
|
|
||||||
|
originalFileName: string;
|
||||||
|
|
||||||
|
restoreAsFileName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileBrowserOpenParams {
|
||||||
|
ownerUri: string;
|
||||||
|
expandPath: string;
|
||||||
|
fileFilters: string[];
|
||||||
|
changeFilter: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileTreeNode {
|
||||||
|
children: FileTreeNode[];
|
||||||
|
isExpanded: boolean;
|
||||||
|
isFile: boolean;
|
||||||
|
name: string;
|
||||||
|
fullPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileTree {
|
||||||
|
rootNode: FileTreeNode;
|
||||||
|
selectedNode: FileTreeNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileBrowserExpandParams {
|
||||||
|
ownerUri: string;
|
||||||
|
expandPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileBrowserValidateParams {
|
||||||
|
ownerUri: string;
|
||||||
|
serviceType: string;
|
||||||
|
selectedFiles: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FileBrowserCloseParams {
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DatabaseFileInfo {
|
||||||
|
properties: LocalizedPropertyInfo[];
|
||||||
|
id: string;
|
||||||
|
isSelected: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LocalizedPropertyInfo {
|
||||||
|
propertyName: string;
|
||||||
|
propertyValue: string;
|
||||||
|
propertyDisplayName: string;
|
||||||
|
propertyValueDisplayName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestorePlanDetailInfo {
|
||||||
|
name: string;
|
||||||
|
currentValue: any;
|
||||||
|
isReadOnly: boolean;
|
||||||
|
isVisible: boolean;
|
||||||
|
defaultValue: any;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query Execution types
|
||||||
|
export interface ResultSetSummary {
|
||||||
|
id: number;
|
||||||
|
batchId: number;
|
||||||
|
rowCount: number;
|
||||||
|
columnInfo: IDbColumn[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BatchSummary {
|
||||||
|
hasError: boolean;
|
||||||
|
id: number;
|
||||||
|
selection: data.ISelectionData;
|
||||||
|
resultSetSummaries: ResultSetSummary[];
|
||||||
|
executionElapsed: string;
|
||||||
|
executionEnd: string;
|
||||||
|
executionStart: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDbColumn {
|
||||||
|
allowDBNull?: boolean;
|
||||||
|
baseCatalogName: string;
|
||||||
|
baseColumnName: string;
|
||||||
|
baseSchemaName: string;
|
||||||
|
baseServerName: string;
|
||||||
|
baseTableName: string;
|
||||||
|
columnName: string;
|
||||||
|
columnOrdinal?: number;
|
||||||
|
columnSize?: number;
|
||||||
|
isAliased?: boolean;
|
||||||
|
isAutoIncrement?: boolean;
|
||||||
|
isExpression?: boolean;
|
||||||
|
isHidden?: boolean;
|
||||||
|
isIdentity?: boolean;
|
||||||
|
isKey?: boolean;
|
||||||
|
isBytes?: boolean;
|
||||||
|
isChars?: boolean;
|
||||||
|
isSqlVariant?: boolean;
|
||||||
|
isUdt?: boolean;
|
||||||
|
dataType: string;
|
||||||
|
isXml?: boolean;
|
||||||
|
isJson?: boolean;
|
||||||
|
isLong?: boolean;
|
||||||
|
isReadOnly?: boolean;
|
||||||
|
isUnique?: boolean;
|
||||||
|
numericPrecision?: number;
|
||||||
|
numericScale?: number;
|
||||||
|
udtAssemblyQualifiedName: string;
|
||||||
|
dataTypeName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IGridResultSet {
|
||||||
|
columns: IDbColumn[];
|
||||||
|
rowsUri: string;
|
||||||
|
numberOfRows: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IResultMessage {
|
||||||
|
batchId?: number;
|
||||||
|
isError: boolean;
|
||||||
|
time: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExecutionPlanOptions {
|
||||||
|
includeEstimatedExecutionPlanXml?: boolean;
|
||||||
|
includeActualExecutionPlanXml?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QueryExecuteParams {
|
||||||
|
ownerUri: string;
|
||||||
|
querySelection: data.ISelectionData;
|
||||||
|
executionPlanOptions?: ExecutionPlanOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum EditRowState {
|
||||||
|
clean = 0,
|
||||||
|
dirtyInsert = 1,
|
||||||
|
dirtyDelete = 2,
|
||||||
|
dirtyUpdate = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EditRow {
|
||||||
|
cells: data.DbCellValue[];
|
||||||
|
id: number;
|
||||||
|
isDirty: boolean;
|
||||||
|
state: EditRowState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MetadataQueryParams {
|
||||||
|
/**
|
||||||
|
* Owner URI of the connection that changed.
|
||||||
|
*/
|
||||||
|
public ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used as value version of data.MetadataType THESE SHOULD MIRROR
|
||||||
|
*/
|
||||||
|
export enum MetadataType {
|
||||||
|
Table = 0,
|
||||||
|
View = 1,
|
||||||
|
SProc = 2,
|
||||||
|
Function = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MetadataQueryResult {
|
||||||
|
public metadata: data.ObjectMetadata[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScriptOptions {
|
||||||
|
/**
|
||||||
|
* Generate ANSI padding statements
|
||||||
|
*/
|
||||||
|
scriptANSIPadding?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append the generated script to a file
|
||||||
|
*/
|
||||||
|
appendToFile?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue to script if an error occurs. Otherwise, stop.
|
||||||
|
*/
|
||||||
|
continueScriptingOnError?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert user-defined data types to base types.
|
||||||
|
*/
|
||||||
|
convertUDDTToBaseType?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate script for dependent objects for each object scripted.
|
||||||
|
*/
|
||||||
|
generateScriptForDependentObjects?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include descriptive headers for each object generated.
|
||||||
|
*/
|
||||||
|
includeDescriptiveHeaders?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that an object with the given name exists before dropping or altering or that an object with the given name does not exist before creating.
|
||||||
|
*/
|
||||||
|
includeIfNotExists?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script options to set vardecimal storage format.
|
||||||
|
*/
|
||||||
|
includeVarDecimal?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include system generated constraint names to enforce declarative referential integrity.
|
||||||
|
*/
|
||||||
|
scriptDRIIncludeSystemNames?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include statements in the script that are not supported on the specified SQL Server database engine type.
|
||||||
|
*/
|
||||||
|
includeUnsupportedStatements?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix object names with the object schema.
|
||||||
|
*/
|
||||||
|
schemaQualify?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script options to set bindings option.
|
||||||
|
*/
|
||||||
|
bindings?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the objects that use collation.
|
||||||
|
*/
|
||||||
|
collation?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the default values.
|
||||||
|
*/
|
||||||
|
default?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script Object CREATE/DROP statements.
|
||||||
|
*/
|
||||||
|
scriptCreateDrop: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the Extended Properties for each object scripted.
|
||||||
|
*/
|
||||||
|
scriptExtendedProperties?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script only features compatible with the specified version of SQL Server.
|
||||||
|
*/
|
||||||
|
scriptCompatibilityOption: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script only features compatible with the specified SQL Server database engine type.
|
||||||
|
*/
|
||||||
|
targetDatabaseEngineType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script only features compatible with the specified SQL Server database engine edition.
|
||||||
|
*/
|
||||||
|
targetDatabaseEngineEdition: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script all logins available on the server. Passwords will not be scripted.
|
||||||
|
*/
|
||||||
|
scriptLogins?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate object-level permissions.
|
||||||
|
*/
|
||||||
|
scriptObjectLevelPermissions?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script owner for the objects.
|
||||||
|
*/
|
||||||
|
scriptOwner?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script statistics, and optionally include histograms, for each selected table or view.
|
||||||
|
*/
|
||||||
|
scriptStatistics: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate USE DATABASE statement.
|
||||||
|
*/
|
||||||
|
scripUseDatabase?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate script that contains schema only or schema and data.
|
||||||
|
*/
|
||||||
|
typeOfDataToScript: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scripts the change tracking information.
|
||||||
|
*/
|
||||||
|
scriptChangeTracking?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the check constraints for each table or view scripted.
|
||||||
|
*/
|
||||||
|
scriptCheckConstraints?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scripts the data compression information.
|
||||||
|
*/
|
||||||
|
scriptDataCompressionOptions?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the foreign keys for each table scripted.
|
||||||
|
*/
|
||||||
|
scriptForeignKeys?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the full-text indexes for each table or indexed view scripted.
|
||||||
|
*/
|
||||||
|
scriptFullTextIndexes?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the indexes (including XML and clustered indexes) for each table or indexed view scripted.
|
||||||
|
*/
|
||||||
|
scriptIndexes?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the primary keys for each table or view scripted
|
||||||
|
*/
|
||||||
|
scriptPrimaryKeys?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the triggers for each table or view scripted
|
||||||
|
*/
|
||||||
|
scriptTriggers?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Script the unique keys for each table or view scripted.
|
||||||
|
*/
|
||||||
|
uniqueKeys?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScriptingObject {
|
||||||
|
/**
|
||||||
|
* The database object type
|
||||||
|
*/
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The schema of the database object
|
||||||
|
*/
|
||||||
|
schema: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The database object name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScriptingParams {
|
||||||
|
/**
|
||||||
|
* File path used when writing out the script.
|
||||||
|
*/
|
||||||
|
filePath: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether scripting to a single file or file per object.
|
||||||
|
*/
|
||||||
|
scriptDestination: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection string of the target database the scripting operation will run against.
|
||||||
|
*/
|
||||||
|
connectionString: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of scripting objects to script
|
||||||
|
*/
|
||||||
|
scriptingObjects: ScriptingObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of scripting object which specify the include criteria of objects to script.
|
||||||
|
*/
|
||||||
|
includeObjectCriteria: ScriptingObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of scripting object which specify the exclude criteria of objects to not script.
|
||||||
|
*/
|
||||||
|
excludeObjectCriteria: ScriptingObject[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of schema name of objects to script.
|
||||||
|
*/
|
||||||
|
includeSchemas: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of schema name of objects to not script.
|
||||||
|
*/
|
||||||
|
excludeSchemas: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of type name of objects to script.
|
||||||
|
*/
|
||||||
|
includeTypes: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of type name of objects to not script.
|
||||||
|
*/
|
||||||
|
excludeTypes: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scripting options for the ScriptingParams
|
||||||
|
*/
|
||||||
|
scriptOptions: ScriptOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection details for the ScriptingParams
|
||||||
|
*/
|
||||||
|
connectionDetails: ConnectionDetails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Owner URI of the connection
|
||||||
|
*/
|
||||||
|
ownerURI: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the scripting operation is for
|
||||||
|
* select script statements
|
||||||
|
*/
|
||||||
|
selectScript: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Operation associated with the script request
|
||||||
|
*/
|
||||||
|
operation: data.ScriptOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScriptingCompleteParams {
|
||||||
|
/**
|
||||||
|
* The error details for an error that occurred during the scripting operation.
|
||||||
|
*/
|
||||||
|
errorDetails: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error message for an error that occurred during the scripting operation.
|
||||||
|
*/
|
||||||
|
errorMessage: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A value to indicate an error occurred during the scripting operation.
|
||||||
|
*/
|
||||||
|
hasError: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A value to indicate the scripting operation was canceled.
|
||||||
|
*/
|
||||||
|
canceled: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A value to indicate the scripting operation successfully completed.
|
||||||
|
*/
|
||||||
|
success: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TableMetadata {
|
||||||
|
|
||||||
|
columns: data.ColumnMetadata[];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters to start a profiler session
|
||||||
|
*/
|
||||||
|
export interface StartProfilingParams {
|
||||||
|
/**
|
||||||
|
* Session Owner URI
|
||||||
|
*/
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session options
|
||||||
|
*/
|
||||||
|
options: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartProfilingResponse {
|
||||||
|
succeeded: string;
|
||||||
|
errorMessage: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters to start a profiler session
|
||||||
|
*/
|
||||||
|
export interface StopProfilingParams {
|
||||||
|
/**
|
||||||
|
* Session Owner URI
|
||||||
|
*/
|
||||||
|
ownerUri: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StopProfilingResponse {
|
||||||
|
succeeded: string;
|
||||||
|
errorMessage: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profiler Event
|
||||||
|
*/
|
||||||
|
export interface ProfilerEvent {
|
||||||
|
/**
|
||||||
|
* Event class name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event timestamp
|
||||||
|
*/
|
||||||
|
timestamp: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event values
|
||||||
|
*/
|
||||||
|
values: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profiler events available notification parameters
|
||||||
|
*/
|
||||||
|
export interface ProfilerEventsAvailableParams {
|
||||||
|
/**
|
||||||
|
* Session owner URI
|
||||||
|
*/
|
||||||
|
ownerUri: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New profiler events available
|
||||||
|
*/
|
||||||
|
events: ProfilerEvent[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used as value version of data.ScriptOperation THESE SHOULD BE THE SAME
|
||||||
|
*/
|
||||||
|
export enum ScriptOperation {
|
||||||
|
Select = 0,
|
||||||
|
Create = 1,
|
||||||
|
Insert = 2,
|
||||||
|
Update = 3,
|
||||||
|
Delete = 4,
|
||||||
|
Execute = 5,
|
||||||
|
Alter = 6
|
||||||
|
}
|
||||||
2
dataprotocol-client/src/typings/ref.d.ts
vendored
Normal file
2
dataprotocol-client/src/typings/ref.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
/// <reference path='../../../src/sql/data.d.ts'/>
|
||||||
17
dataprotocol-client/tsfmt.json
Normal file
17
dataprotocol-client/tsfmt.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"tabSize": 4,
|
||||||
|
"indentSize": 4,
|
||||||
|
"newLineCharacter": "\n",
|
||||||
|
"convertTabsToSpaces": false,
|
||||||
|
"insertSpaceAfterCommaDelimiter": true,
|
||||||
|
"insertSpaceAfterSemicolonInForStatements": true,
|
||||||
|
"insertSpaceBeforeAndAfterBinaryOperators": true,
|
||||||
|
"insertSpaceAfterKeywordsInControlFlowStatements": true,
|
||||||
|
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
|
||||||
|
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
|
||||||
|
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
|
||||||
|
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
|
||||||
|
"insertSpaceBeforeFunctionParenthesis": false,
|
||||||
|
"placeOpenBraceOnNewLineForFunctions": false,
|
||||||
|
"placeOpenBraceOnNewLineForControlBlocks": false
|
||||||
|
}
|
||||||
1748
dataprotocol-client/yarn.lock
Normal file
1748
dataprotocol-client/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
29
dataprotocol-node/.gitignore
vendored
29
dataprotocol-node/.gitignore
vendored
@@ -1,29 +0,0 @@
|
|||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
lib/
|
|
||||||
out/
|
|
||||||
|
|
||||||
# Dependency directory
|
|
||||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
|
||||||
node_modules
|
|
||||||
|
|
||||||
# Debug log from npm
|
|
||||||
npm-debug.log
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
|
|
||||||
Copyright (c) Microsoft Corporation
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Source EULA
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
|
|
||||||
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
|
|
||||||
is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
|
||||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Microsoft Data Management Protocol - Node
|
|
||||||
|
|
||||||
## License
|
|
||||||
[MIT](https://github.com/Microsoft/carbon/blob/dev/license.txt)
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"rules": {
|
|
||||||
"indent": [
|
|
||||||
2,
|
|
||||||
"tab"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
2,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
2,
|
|
||||||
"windows"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
2,
|
|
||||||
"always"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
.vscode/
|
|
||||||
lib/test/
|
|
||||||
lib/*.map
|
|
||||||
src/
|
|
||||||
test/
|
|
||||||
.eslintrc
|
|
||||||
.gitignore
|
|
||||||
gulpfile.js
|
|
||||||
tsd.json
|
|
||||||
32
dataprotocol-node/client/.vscode/launch.json
vendored
32
dataprotocol-node/client/.vscode/launch.json
vendored
@@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.1.0",
|
|
||||||
// List of configurations. Add new configurations or edit existing ones.
|
|
||||||
// ONLY "node" and "mono" are supported, change "type" to switch.
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"request": "launch",
|
|
||||||
// Name of configuration; appears in the launch configuration drop down menu.
|
|
||||||
"name": "Mocha",
|
|
||||||
// Type of configuration. Possible values: "node", "mono".
|
|
||||||
"type": "node",
|
|
||||||
// Workspace relative or absolute path to the program.
|
|
||||||
"program": "node_modules/mocha/bin/_mocha",
|
|
||||||
// Automatically stop program after launch.
|
|
||||||
"stopOnEntry": false,
|
|
||||||
// Command line arguments passed to the program.
|
|
||||||
"args": ["--timeout", "999999"],
|
|
||||||
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
|
|
||||||
"cwd": ".",
|
|
||||||
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
|
|
||||||
"runtimeExecutable": null,
|
|
||||||
// Optional arguments passed to the runtime executable.
|
|
||||||
"runtimeArgs": [],
|
|
||||||
// Environment variables passed to the program.
|
|
||||||
"env": { },
|
|
||||||
// Use JavaScript source maps (if they exist).
|
|
||||||
"sourceMaps": true,
|
|
||||||
// If JavaScript source maps are enabled, the generated code is expected in this directory.
|
|
||||||
"outDir": "lib"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
11
dataprotocol-node/client/.vscode/settings.json
vendored
11
dataprotocol-node/client/.vscode/settings.json
vendored
@@ -1,11 +0,0 @@
|
|||||||
// Place your settings in this file to overwrite default and user settings.
|
|
||||||
{
|
|
||||||
"javascript.validate.enable": false,
|
|
||||||
"files.trimTrailingWhitespace": true,
|
|
||||||
"eslint.enable": false,
|
|
||||||
"editor.insertSpaces": false,
|
|
||||||
"editor.tabSize": 4,
|
|
||||||
"tslint.enable": false,
|
|
||||||
"typescript.tsdk": "./node_modules/typescript/lib",
|
|
||||||
"typescript.tsserver.trace": "off"
|
|
||||||
}
|
|
||||||
9
dataprotocol-node/client/.vscode/tasks.json
vendored
9
dataprotocol-node/client/.vscode/tasks.json
vendored
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.1.0",
|
|
||||||
"command": "npm",
|
|
||||||
"isShellCommand": true,
|
|
||||||
"args": ["run", "watch"],
|
|
||||||
"showOutput": "silent",
|
|
||||||
"isWatching": true,
|
|
||||||
"problemMatcher": "$tsc-watch"
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
# Microsoft Data Management Protocol - Node
|
|
||||||
|
|
||||||
## License
|
|
||||||
[MIT](https://github.com/Microsoft/carbon/blob/dev/license.txt)
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "dataprotocol-client",
|
|
||||||
"description": "VSCode Language client implementation",
|
|
||||||
"version": "2.6.3",
|
|
||||||
"author": "Microsoft Corporation",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"vscode": "^1.5.0"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/Microsoft/vscode-languageserver-node.git"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/Microsoft/vscode-languageserver-node/issues"
|
|
||||||
},
|
|
||||||
"main": "./lib/main.js",
|
|
||||||
"typings": "./lib/main",
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "2.0.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"dataprotocol-jsonrpc": "file:../jsonrpc",
|
|
||||||
"dataprotocol-languageserver-types": "file:../types"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prepublish": "tsc -p ./src",
|
|
||||||
"compile": "tsc -p ./src",
|
|
||||||
"watch": "tsc -w -p ./src",
|
|
||||||
"update-vscode": "node ./node_modules/vscode/bin/install"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,526 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as code from 'vscode';
|
|
||||||
import * as data from 'data';
|
|
||||||
import * as ls from 'dataprotocol-languageserver-types';
|
|
||||||
import * as proto from './protocol';
|
|
||||||
import * as is from './utils/is';
|
|
||||||
import ProtocolCompletionItem from './protocolCompletionItem';
|
|
||||||
import ProtocolCodeLens from './protocolCodeLens';
|
|
||||||
import os = require('os');
|
|
||||||
import path = require('path');
|
|
||||||
|
|
||||||
export interface Converter {
|
|
||||||
|
|
||||||
asUri(uri: code.Uri): string;
|
|
||||||
|
|
||||||
asTextDocumentIdentifier(textDocument: code.TextDocument): ls.TextDocumentIdentifier;
|
|
||||||
|
|
||||||
asOpenTextDocumentParams(textDocument: code.TextDocument): proto.DidOpenTextDocumentParams;
|
|
||||||
|
|
||||||
asChangeTextDocumentParams(textDocument: code.TextDocument): proto.DidChangeTextDocumentParams;
|
|
||||||
asChangeTextDocumentParams(event: code.TextDocumentChangeEvent): proto.DidChangeTextDocumentParams;
|
|
||||||
|
|
||||||
asCloseTextDocumentParams(textDocument: code.TextDocument): proto.DidCloseTextDocumentParams;
|
|
||||||
|
|
||||||
asSaveTextDocumentParams(textDocument: code.TextDocument): proto.DidSaveTextDocumentParams;
|
|
||||||
|
|
||||||
asTextDocumentPositionParams(textDocument: code.TextDocument, position: code.Position): proto.TextDocumentPositionParams;
|
|
||||||
|
|
||||||
asWorkerPosition(position: code.Position): ls.Position;
|
|
||||||
|
|
||||||
asRange(value: code.Range): ls.Range;
|
|
||||||
|
|
||||||
asPosition(value: code.Position): ls.Position;
|
|
||||||
|
|
||||||
asDiagnosticSeverity(value: code.DiagnosticSeverity): ls.DiagnosticSeverity;
|
|
||||||
|
|
||||||
asDiagnostic(item: code.Diagnostic): ls.Diagnostic;
|
|
||||||
asDiagnostics(items: code.Diagnostic[]): ls.Diagnostic[];
|
|
||||||
|
|
||||||
asCompletionItem(item: code.CompletionItem): ls.CompletionItem;
|
|
||||||
|
|
||||||
asTextEdit(edit: code.TextEdit): ls.TextEdit;
|
|
||||||
|
|
||||||
asReferenceParams(textDocument: code.TextDocument, position: code.Position, options: { includeDeclaration: boolean; }): proto.ReferenceParams;
|
|
||||||
|
|
||||||
asCodeActionContext(context: code.CodeActionContext): ls.CodeActionContext;
|
|
||||||
|
|
||||||
asCommand(item: code.Command): ls.Command;
|
|
||||||
|
|
||||||
asCodeLens(item: code.CodeLens): ls.CodeLens;
|
|
||||||
|
|
||||||
asFormattingOptions(item: code.FormattingOptions): ls.FormattingOptions;
|
|
||||||
|
|
||||||
asDocumentSymbolParams(textDocument: code.TextDocument): proto.DocumentSymbolParams;
|
|
||||||
|
|
||||||
asCodeLensParams(textDocument: code.TextDocument): proto.CodeLensParams;
|
|
||||||
|
|
||||||
asDocumentLink(item: code.DocumentLink): ls.DocumentLink;
|
|
||||||
|
|
||||||
asDocumentLinkParams(textDocument: code.TextDocument): proto.DocumentLinkParams;
|
|
||||||
|
|
||||||
asConnectionParams(connectionUri: string, connectionInfo: data.ConnectionInfo): proto.ConnectParams;
|
|
||||||
|
|
||||||
asCapabilitiesParams(client: data.DataProtocolClientCapabilities): proto.CapabiltiesDiscoveryParams;
|
|
||||||
|
|
||||||
asMetadataQueryParams(connectionUri: string): ls.MetadataQueryParams;
|
|
||||||
|
|
||||||
asListDatabasesParams(connectionUri: string): proto.ListDatabasesParams;
|
|
||||||
|
|
||||||
asTableMetadataParams(connectionUri: string, metadata: data.ObjectMetadata): proto.TableMetadataParams;
|
|
||||||
|
|
||||||
asScriptingParams(connectionUri: string, operation: ls.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): ls.ScriptingParams;
|
|
||||||
|
|
||||||
asConnectionDetail(connInfo: data.ConnectionInfo): ls.ConnectionDetails;
|
|
||||||
|
|
||||||
asExpandInfo(nodeInfo: data.ExpandNodeInfo): ls.ExpandParams;
|
|
||||||
|
|
||||||
asCloseSessionInfo(nodeInfo: data.ObjectExplorerCloseSessionInfo): ls.CloseSessionParams;
|
|
||||||
|
|
||||||
asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): proto.ExecutionPlanOptions;
|
|
||||||
|
|
||||||
asListTasksParams(params: data.ListTasksParams): ls.ListTasksParams;
|
|
||||||
|
|
||||||
asCancelTaskParams(params: data.CancelTaskParams): ls.CancelTaskParams;
|
|
||||||
|
|
||||||
asRestoreParams(ownerUri: string, params: data.RestoreInfo): ls.RestoreParams;
|
|
||||||
|
|
||||||
asRestoreConfigInfoParams(ownerUri: string): ls.RestoreConfigInfoRequestParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface URIConverter {
|
|
||||||
(value: code.Uri): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createConverter(uriConverter?: URIConverter): Converter {
|
|
||||||
|
|
||||||
const nullConverter = (value: code.Uri) => value.toString();
|
|
||||||
|
|
||||||
const _uriConverter: URIConverter = uriConverter || nullConverter;
|
|
||||||
|
|
||||||
function asUri(value: code.Uri): string {
|
|
||||||
return _uriConverter(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextDocumentIdentifier(textDocument: code.TextDocument): ls.TextDocumentIdentifier {
|
|
||||||
return {
|
|
||||||
uri: _uriConverter(textDocument.uri)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asOpenTextDocumentParams(textDocument: code.TextDocument): proto.DidOpenTextDocumentParams {
|
|
||||||
return {
|
|
||||||
textDocument: {
|
|
||||||
uri: _uriConverter(textDocument.uri),
|
|
||||||
languageId: textDocument.languageId,
|
|
||||||
version: textDocument.version,
|
|
||||||
text: textDocument.getText()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTextDocumentChangeEvent(value: any): value is code.TextDocumentChangeEvent {
|
|
||||||
let candidate = <code.TextDocumentChangeEvent>value;
|
|
||||||
return is.defined(candidate.document) && is.defined(candidate.contentChanges);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTextDocument(value: any): value is code.TextDocument {
|
|
||||||
let candidate = <code.TextDocument>value;
|
|
||||||
return is.defined(candidate.uri) && is.defined(candidate.version);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asChangeTextDocumentParams(textDocument: code.TextDocument): proto.DidChangeTextDocumentParams;
|
|
||||||
function asChangeTextDocumentParams(event: code.TextDocumentChangeEvent): proto.DidChangeTextDocumentParams;
|
|
||||||
function asChangeTextDocumentParams(arg: code.TextDocumentChangeEvent | code.TextDocument): proto.DidChangeTextDocumentParams {
|
|
||||||
if (isTextDocument(arg)) {
|
|
||||||
let result: proto.DidChangeTextDocumentParams = {
|
|
||||||
textDocument: {
|
|
||||||
uri: _uriConverter(arg.uri),
|
|
||||||
version: arg.version
|
|
||||||
},
|
|
||||||
contentChanges: [{ text: arg.getText() }]
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} else if (isTextDocumentChangeEvent(arg)) {
|
|
||||||
let document = arg.document;
|
|
||||||
let result: proto.DidChangeTextDocumentParams = {
|
|
||||||
textDocument: {
|
|
||||||
uri: _uriConverter(document.uri),
|
|
||||||
version: document.version
|
|
||||||
},
|
|
||||||
contentChanges: arg.contentChanges.map((change): proto.TextDocumentContentChangeEvent => {
|
|
||||||
let range = change.range;
|
|
||||||
return {
|
|
||||||
range: {
|
|
||||||
start: { line: range.start.line, character: range.start.character },
|
|
||||||
end: { line: range.end.line, character: range.end.character }
|
|
||||||
},
|
|
||||||
rangeLength: change.rangeLength,
|
|
||||||
text: change.text
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} else {
|
|
||||||
throw Error('Unsupported text document change parameter');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCloseTextDocumentParams(textDocument: code.TextDocument): proto.DidCloseTextDocumentParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSaveTextDocumentParams(textDocument: code.TextDocument): proto.DidSaveTextDocumentParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextDocumentPositionParams(textDocument: code.TextDocument, position: code.Position): proto.TextDocumentPositionParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument),
|
|
||||||
position: asWorkerPosition(position)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asWorkerPosition(position: code.Position): ls.Position {
|
|
||||||
return { line: position.line, character: position.character };
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRange(value: code.Range): ls.Range {
|
|
||||||
if (is.undefined(value)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(value)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return { start: asPosition(value.start), end: asPosition(value.end) };
|
|
||||||
}
|
|
||||||
|
|
||||||
function asPosition(value: code.Position): ls.Position {
|
|
||||||
if (is.undefined(value)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(value)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return { line: value.line, character: value.character };
|
|
||||||
}
|
|
||||||
|
|
||||||
function set(value, func: () => void): void {
|
|
||||||
if (is.defined(value)) {
|
|
||||||
func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnosticSeverity(value: code.DiagnosticSeverity): ls.DiagnosticSeverity {
|
|
||||||
switch (value) {
|
|
||||||
case code.DiagnosticSeverity.Error:
|
|
||||||
return ls.DiagnosticSeverity.Error;
|
|
||||||
case code.DiagnosticSeverity.Warning:
|
|
||||||
return ls.DiagnosticSeverity.Warning;
|
|
||||||
case code.DiagnosticSeverity.Information:
|
|
||||||
return ls.DiagnosticSeverity.Information;
|
|
||||||
case code.DiagnosticSeverity.Hint:
|
|
||||||
return ls.DiagnosticSeverity.Hint;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnostic(item: code.Diagnostic): ls.Diagnostic {
|
|
||||||
let result: ls.Diagnostic = ls.Diagnostic.create(asRange(item.range), item.message);
|
|
||||||
set(item.severity, () => result.severity = asDiagnosticSeverity(item.severity));
|
|
||||||
set(item.code, () => result.code = item.code);
|
|
||||||
set(item.source, () => result.source = item.source);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnostics(items: code.Diagnostic[]): ls.Diagnostic[] {
|
|
||||||
if (is.undefined(items) || is.nil(items)) {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
return items.map(asDiagnostic);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCompletionItem(item: code.CompletionItem): ls.CompletionItem {
|
|
||||||
let result: ls.CompletionItem = { label: item.label };
|
|
||||||
set(item.detail, () => result.detail = item.detail);
|
|
||||||
set(item.documentation, () => result.documentation = item.documentation);
|
|
||||||
set(item.filterText, () => result.filterText = item.filterText);
|
|
||||||
set(item.insertText, () => result.insertText = String(item.insertText));
|
|
||||||
// Protocol item kind is 1 based, codes item kind is zero based.
|
|
||||||
set(item.kind, () => result.kind = item.kind + 1);
|
|
||||||
set(item.sortText, () => result.sortText = item.sortText);
|
|
||||||
set(item.textEdit, () => result.textEdit = asTextEdit(item.textEdit));
|
|
||||||
set(item.additionalTextEdits, () => result.additionalTextEdits = asTextEdits(item.additionalTextEdits));
|
|
||||||
set(item.command, () => result.command = asCommand(item.command));
|
|
||||||
if (item instanceof ProtocolCompletionItem) {
|
|
||||||
set(item.data, () => result.data = item.data);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextEdit(edit: code.TextEdit): ls.TextEdit {
|
|
||||||
return { range: asRange(edit.range), newText: edit.newText };
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextEdits(edits: code.TextEdit[]): ls.TextEdit[] {
|
|
||||||
if (is.undefined(edits) || is.nil(edits)) {
|
|
||||||
return edits;
|
|
||||||
}
|
|
||||||
return edits.map(asTextEdit);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asReferenceParams(textDocument: code.TextDocument, position: code.Position, options: { includeDeclaration: boolean; }): proto.ReferenceParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument),
|
|
||||||
position: asWorkerPosition(position),
|
|
||||||
context: { includeDeclaration: options.includeDeclaration }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCodeActionContext(context: code.CodeActionContext): ls.CodeActionContext {
|
|
||||||
if (is.undefined(context) || is.nil(context)) {
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
return ls.CodeActionContext.create(asDiagnostics(context.diagnostics));
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCommand(item: code.Command): ls.Command {
|
|
||||||
let result = ls.Command.create(item.title, item.command);
|
|
||||||
if (is.defined(item.arguments)) result.arguments = item.arguments;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCodeLens(item: code.CodeLens): ls.CodeLens {
|
|
||||||
let result = ls.CodeLens.create(asRange(item.range));
|
|
||||||
if (is.defined(item.command)) result.command = asCommand(item.command);
|
|
||||||
if (item instanceof ProtocolCodeLens) {
|
|
||||||
if (is.defined(item.data)) result.data = item.data;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asFormattingOptions(item: code.FormattingOptions): ls.FormattingOptions {
|
|
||||||
return { tabSize: item.tabSize, insertSpaces: item.insertSpaces };
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentSymbolParams(textDocument: code.TextDocument): proto.DocumentSymbolParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCodeLensParams(textDocument: code.TextDocument): proto.CodeLensParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentLink(item: code.DocumentLink): ls.DocumentLink {
|
|
||||||
let result = ls.DocumentLink.create(asRange(item.range));
|
|
||||||
if (is.defined(item.target)) result.target = asUri(item.target);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentLinkParams(textDocument: code.TextDocument): proto.DocumentLinkParams {
|
|
||||||
return {
|
|
||||||
textDocument: asTextDocumentIdentifier(textDocument)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCapabilitiesParams(client: data.DataProtocolClientCapabilities): proto.CapabiltiesDiscoveryParams {
|
|
||||||
let params: proto.CapabiltiesDiscoveryParams = {
|
|
||||||
hostName: client.hostName,
|
|
||||||
hostVersion: client.hostVersion
|
|
||||||
};
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asConnectionParams(connUri: string, connInfo: data.ConnectionInfo): proto.ConnectParams {
|
|
||||||
return {
|
|
||||||
ownerUri: connUri,
|
|
||||||
connection: {
|
|
||||||
options: connInfo.options
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asMetadataQueryParams(connectionUri: string): ls.MetadataQueryParams {
|
|
||||||
return <ls.MetadataQueryParams>{
|
|
||||||
ownerUri: connectionUri
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asListDatabasesParams(connectionUri: string): proto.ListDatabasesParams {
|
|
||||||
return <proto.ListDatabasesParams>{
|
|
||||||
ownerUri: connectionUri
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTableMetadataParams(connectionUri: string, metadata: data.ObjectMetadata): proto.TableMetadataParams {
|
|
||||||
return <proto.TableMetadataParams>{
|
|
||||||
ownerUri: connectionUri,
|
|
||||||
schema: metadata.schema,
|
|
||||||
objectName: metadata.name
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asScriptingParams(connectionUri: string, operation: ls.ScriptOperation, metadata: data.ObjectMetadata, paramDetails: data.ScriptingParamDetails): ls.ScriptingParams {
|
|
||||||
let scriptingObject: ls.ScriptingObject = {
|
|
||||||
type: metadata.metadataTypeName,
|
|
||||||
schema: metadata.schema,
|
|
||||||
name: metadata.name
|
|
||||||
}
|
|
||||||
let targetDatabaseEngineEdition = paramDetails.targetDatabaseEngineEdition;
|
|
||||||
let targetDatabaseEngineType = paramDetails.targetDatabaseEngineType;
|
|
||||||
let scriptCompatibilityOption = paramDetails.scriptCompatibilityOption;
|
|
||||||
let options: ls.ScriptOptions = {
|
|
||||||
scriptCreateDrop: (operation === ls.ScriptOperation.Delete) ? "ScriptDrop" :
|
|
||||||
(operation === ls.ScriptOperation.Select) ? "ScriptSelect" : "ScriptCreate",
|
|
||||||
typeOfDataToScript: "SchemaOnly",
|
|
||||||
scriptStatistics: "ScriptStatsNone",
|
|
||||||
targetDatabaseEngineEdition: targetDatabaseEngineEdition ? targetDatabaseEngineEdition : "SqlServerEnterpriseEdition",
|
|
||||||
targetDatabaseEngineType: targetDatabaseEngineType ? targetDatabaseEngineType : "SingleInstance",
|
|
||||||
scriptCompatibilityOption: scriptCompatibilityOption ? scriptCompatibilityOption : "Script140Compat"
|
|
||||||
}
|
|
||||||
return <ls.ScriptingParams> {
|
|
||||||
connectionString: null,
|
|
||||||
filePath: paramDetails.filePath,
|
|
||||||
scriptingObjects: [scriptingObject],
|
|
||||||
scriptDestination: "ToEditor",
|
|
||||||
includeObjectCriteria: null,
|
|
||||||
excludeObjectCriteria: null,
|
|
||||||
includeSchemas: null,
|
|
||||||
excludeSchemas: null,
|
|
||||||
includeTypes: null,
|
|
||||||
excludeTypes: null,
|
|
||||||
scriptOptions: options,
|
|
||||||
connectionDetails: null,
|
|
||||||
ownerURI: connectionUri,
|
|
||||||
operation: operation
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asConnectionDetail(connInfo: data.ConnectionInfo): ls.ConnectionDetails {
|
|
||||||
return <ls.ConnectionDetails>{
|
|
||||||
options: connInfo.options
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asExpandInfo(nodeInfo: data.ExpandNodeInfo): ls.ExpandParams {
|
|
||||||
return <ls.ExpandParams>{
|
|
||||||
sessionId: nodeInfo.sessionId,
|
|
||||||
nodePath: nodeInfo.nodePath
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCloseSessionInfo(nodeInfo: data.ObjectExplorerCloseSessionInfo): ls.CloseSessionParams {
|
|
||||||
return <ls.CloseSessionParams>{
|
|
||||||
sessionId: nodeInfo.sessionId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asExecutionPlanOptions(planOptions: data.ExecutionPlanOptions): proto.ExecutionPlanOptions {
|
|
||||||
return <proto.ExecutionPlanOptions>{
|
|
||||||
includeEstimatedExecutionPlanXml: planOptions ? planOptions.displayEstimatedQueryPlan : undefined,
|
|
||||||
includeActualExecutionPlanXml: planOptions ? planOptions.displayActualQueryPlan : undefined
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asListTasksParams(params: data.ListTasksParams): ls.ListTasksParams {
|
|
||||||
return <ls.ListTasksParams>{
|
|
||||||
listActiveTasksOnly: params.listActiveTasksOnly
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCancelTaskParams(params: data.CancelTaskParams): ls.CancelTaskParams {
|
|
||||||
return <ls.CancelTaskParams>{
|
|
||||||
taskId: params.taskId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRestoreParams(ownerUri: string, params: data.RestoreInfo): ls.RestoreParams {
|
|
||||||
return <ls.RestoreParams>{
|
|
||||||
ownerUri: ownerUri,
|
|
||||||
options: params.options,
|
|
||||||
taskExecutionMode: params.taskExecutionMode
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRestoreConfigInfoParams(ownerUri: string): ls.RestoreConfigInfoRequestParams {
|
|
||||||
return <ls.RestoreConfigInfoRequestParams>{
|
|
||||||
ownerUri: ownerUri
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
asUri,
|
|
||||||
asTextDocumentIdentifier,
|
|
||||||
asOpenTextDocumentParams,
|
|
||||||
asChangeTextDocumentParams,
|
|
||||||
asCloseTextDocumentParams,
|
|
||||||
asSaveTextDocumentParams,
|
|
||||||
asTextDocumentPositionParams,
|
|
||||||
asWorkerPosition,
|
|
||||||
asRange,
|
|
||||||
asPosition,
|
|
||||||
asDiagnosticSeverity,
|
|
||||||
asDiagnostic,
|
|
||||||
asDiagnostics,
|
|
||||||
asCompletionItem,
|
|
||||||
asTextEdit,
|
|
||||||
asReferenceParams,
|
|
||||||
asCodeActionContext,
|
|
||||||
asCommand,
|
|
||||||
asCodeLens,
|
|
||||||
asFormattingOptions,
|
|
||||||
asDocumentSymbolParams,
|
|
||||||
asCodeLensParams,
|
|
||||||
asDocumentLink,
|
|
||||||
asDocumentLinkParams,
|
|
||||||
asCapabilitiesParams,
|
|
||||||
asConnectionParams,
|
|
||||||
asMetadataQueryParams,
|
|
||||||
asTableMetadataParams,
|
|
||||||
asListDatabasesParams,
|
|
||||||
asScriptingParams,
|
|
||||||
asConnectionDetail,
|
|
||||||
asExpandInfo,
|
|
||||||
asCloseSessionInfo,
|
|
||||||
asExecutionPlanOptions,
|
|
||||||
asListTasksParams,
|
|
||||||
asCancelTaskParams,
|
|
||||||
asRestoreParams,
|
|
||||||
asRestoreConfigInfoParams
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// This for backward compatibility since we exported the converter functions as API.
|
|
||||||
let defaultConverter = createConverter();
|
|
||||||
|
|
||||||
export const asTextDocumentIdentifier: (textDocument: code.TextDocument) => ls.TextDocumentIdentifier = defaultConverter.asTextDocumentIdentifier;
|
|
||||||
export const asOpenTextDocumentParams: (textDocument: code.TextDocument) => proto.DidOpenTextDocumentParams = defaultConverter.asOpenTextDocumentParams;
|
|
||||||
export const asChangeTextDocumentParams: (arg: code.TextDocumentChangeEvent | code.TextDocument) => proto.DidChangeTextDocumentParams = defaultConverter.asChangeTextDocumentParams;
|
|
||||||
export const asCloseTextDocumentParams: (textDocument: code.TextDocument) => proto.DidCloseTextDocumentParams = defaultConverter.asCloseTextDocumentParams;
|
|
||||||
export const asSaveTextDocumentParams: (textDocument: code.TextDocument) => proto.DidSaveTextDocumentParams = defaultConverter.asSaveTextDocumentParams;
|
|
||||||
export const asTextDocumentPositionParams: (textDocument: code.TextDocument, position: code.Position) => proto.TextDocumentPositionParams = defaultConverter.asTextDocumentPositionParams;
|
|
||||||
export const asWorkerPosition: (position: code.Position) => ls.Position = defaultConverter.asWorkerPosition;
|
|
||||||
export const asRange: (value: code.Range) => ls.Range = defaultConverter.asRange;
|
|
||||||
export const asPosition: (value: code.Position) => ls.Position = defaultConverter.asPosition;
|
|
||||||
export const asDiagnosticSeverity: (value: code.DiagnosticSeverity) => ls.DiagnosticSeverity = defaultConverter.asDiagnosticSeverity;
|
|
||||||
export const asDiagnostic: (item: code.Diagnostic) => ls.Diagnostic = defaultConverter.asDiagnostic;
|
|
||||||
export const asDiagnostics: (items: code.Diagnostic[]) => ls.Diagnostic[] = defaultConverter.asDiagnostics;
|
|
||||||
export const asCompletionItem: (item: code.CompletionItem) => ls.CompletionItem = defaultConverter.asCompletionItem;
|
|
||||||
export const asTextEdit: (edit: code.TextEdit) => ls.TextEdit = defaultConverter.asTextEdit;
|
|
||||||
export const asReferenceParams: (textDocument: code.TextDocument, position: code.Position, options: { includeDeclaration: boolean; }) => proto.ReferenceParams = defaultConverter.asReferenceParams;
|
|
||||||
export const asCodeActionContext: (context: code.CodeActionContext) => ls.CodeActionContext = defaultConverter.asCodeActionContext;
|
|
||||||
export const asCommand: (item: code.Command) => ls.Command = defaultConverter.asCommand;
|
|
||||||
export const asCodeLens: (item: code.CodeLens) => ls.CodeLens = defaultConverter.asCodeLens;
|
|
||||||
export const asFormattingOptions: (item: code.FormattingOptions) => ls.FormattingOptions = defaultConverter.asFormattingOptions;
|
|
||||||
export const asDocumentSymbolParams: (textDocument: code.TextDocument) => proto.DocumentSymbolParams = defaultConverter.asDocumentSymbolParams;
|
|
||||||
export const asCodeLensParams: (textDocument: code.TextDocument) => proto.CodeLensParams = defaultConverter.asCodeLensParams;
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as code from 'vscode';
|
|
||||||
|
|
||||||
export default class ProtocolCodeLens extends code.CodeLens {
|
|
||||||
|
|
||||||
public data: any;
|
|
||||||
|
|
||||||
constructor(range: code.Range) {
|
|
||||||
super(range);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as code from 'vscode';
|
|
||||||
|
|
||||||
export default class ProtocolCompletionItem extends code.CompletionItem {
|
|
||||||
|
|
||||||
public data: any;
|
|
||||||
|
|
||||||
constructor(label: string) {
|
|
||||||
super(label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,769 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as code from 'vscode';
|
|
||||||
import * as data from 'data';
|
|
||||||
import * as ls from 'dataprotocol-languageserver-types';
|
|
||||||
import * as is from './utils/is';
|
|
||||||
import ProtocolCompletionItem from './protocolCompletionItem';
|
|
||||||
import ProtocolCodeLens from './protocolCodeLens';
|
|
||||||
|
|
||||||
export interface Converter {
|
|
||||||
|
|
||||||
asUri(value: string): code.Uri;
|
|
||||||
|
|
||||||
asDiagnostics(diagnostics: ls.Diagnostic[]): code.Diagnostic[];
|
|
||||||
|
|
||||||
asDiagnostic(diagnostic: ls.Diagnostic): code.Diagnostic;
|
|
||||||
|
|
||||||
asRange(value: ls.Range): code.Range;
|
|
||||||
|
|
||||||
asPosition(value: ls.Position): code.Position;
|
|
||||||
|
|
||||||
asDiagnosticSeverity(value: number): code.DiagnosticSeverity;
|
|
||||||
|
|
||||||
asHover(hover: ls.Hover): code.Hover;
|
|
||||||
|
|
||||||
asCompletionResult(result: ls.CompletionItem[] | ls.CompletionList): code.CompletionItem[] | code.CompletionList
|
|
||||||
|
|
||||||
asCompletionItem(item: ls.CompletionItem): ProtocolCompletionItem;
|
|
||||||
|
|
||||||
asTextEdit(edit: ls.TextEdit): code.TextEdit;
|
|
||||||
|
|
||||||
asTextEdits(items: ls.TextEdit[]): code.TextEdit[];
|
|
||||||
|
|
||||||
asSignatureHelp(item: ls.SignatureHelp): code.SignatureHelp;
|
|
||||||
|
|
||||||
asSignatureInformations(items: ls.SignatureInformation[]): code.SignatureInformation[];
|
|
||||||
|
|
||||||
asSignatureInformation(item: ls.SignatureInformation): code.SignatureInformation;
|
|
||||||
|
|
||||||
asParameterInformations(item: ls.ParameterInformation[]): code.ParameterInformation[];
|
|
||||||
|
|
||||||
asParameterInformation(item: ls.ParameterInformation): code.ParameterInformation;
|
|
||||||
|
|
||||||
asDefinitionResult(item: ls.Definition): code.Definition;
|
|
||||||
|
|
||||||
asLocation(item: ls.Location): code.Location;
|
|
||||||
|
|
||||||
asReferences(values: ls.Location[]): code.Location[];
|
|
||||||
|
|
||||||
asDocumentHighlights(values: ls.DocumentHighlight[]): code.DocumentHighlight[];
|
|
||||||
|
|
||||||
asDocumentHighlight(item: ls.DocumentHighlight): code.DocumentHighlight;
|
|
||||||
|
|
||||||
asDocumentHighlightKind(item: ls.DocumentHighlightKind): code.DocumentHighlightKind;
|
|
||||||
|
|
||||||
asSymbolInformations(values: ls.SymbolInformation[], uri?: code.Uri): code.SymbolInformation[];
|
|
||||||
|
|
||||||
asSymbolInformation(item: ls.SymbolInformation, uri?: code.Uri): code.SymbolInformation;
|
|
||||||
|
|
||||||
asCommand(item: ls.Command): code.Command;
|
|
||||||
|
|
||||||
asCommands(items: ls.Command[]): code.Command[];
|
|
||||||
|
|
||||||
asCodeLens(item: ls.CodeLens): code.CodeLens;
|
|
||||||
|
|
||||||
asCodeLenses(items: ls.CodeLens[]): code.CodeLens[];
|
|
||||||
|
|
||||||
asWorkspaceEdit(item: ls.WorkspaceEdit): code.WorkspaceEdit;
|
|
||||||
|
|
||||||
asDocumentLink(item: ls.DocumentLink): code.DocumentLink;
|
|
||||||
|
|
||||||
asDocumentLinks(items: ls.DocumentLink[]): code.DocumentLink[];
|
|
||||||
|
|
||||||
asConnectionSummary(params: ls.ConnectionCompleteParams): data.ConnectionInfoSummary;
|
|
||||||
|
|
||||||
asServerCapabilities(params: ls.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities;
|
|
||||||
|
|
||||||
asProviderMetadata(params: ls.MetadataQueryResult): data.ProviderMetadata;
|
|
||||||
|
|
||||||
asScriptingResult(params: ls.ScriptingResult): data.ScriptingResult;
|
|
||||||
|
|
||||||
asObjectExplorerSession(params: ls.SessionCreatedParameters): data.ObjectExplorerSession;
|
|
||||||
|
|
||||||
asObjectExplorerCreateSessionResponse(params: ls.CreateSessionResponse): data.ObjectExplorerSessionResponse;
|
|
||||||
|
|
||||||
asObjectExplorerNodeInfo(params: ls.ExpandResponse): data.ObjectExplorerExpandInfo;
|
|
||||||
|
|
||||||
asObjectExplorerCloseSessionResponse(params: ls.CloseSessionResponse): data.ObjectExplorerCloseSessionResponse;
|
|
||||||
|
|
||||||
asListTasksResponse(response: ls.ListTasksResponse): data.ListTasksResponse;
|
|
||||||
|
|
||||||
asTaskInfo(params: ls.TaskInfo): data.TaskInfo;
|
|
||||||
|
|
||||||
asRestorePlanResponse(params: ls.RestorePlanResponse): data.RestorePlanResponse;
|
|
||||||
|
|
||||||
asRestoreResponse(params: ls.RestoreResponse): data.RestoreResponse;
|
|
||||||
|
|
||||||
asRestoreConfigInfo(params: ls.RestoreConfigInfoResponse): data.RestoreConfigInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface URIConverter {
|
|
||||||
(value: string): code.Uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createConverter(uriConverter?: URIConverter): Converter {
|
|
||||||
|
|
||||||
const nullConverter = (value: string) => code.Uri.parse(value);
|
|
||||||
|
|
||||||
const _uriConverter: URIConverter = uriConverter || nullConverter;
|
|
||||||
|
|
||||||
function asUri(value: string): code.Uri {
|
|
||||||
return _uriConverter(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnostics(diagnostics: ls.Diagnostic[]): code.Diagnostic[] {
|
|
||||||
return diagnostics.map(asDiagnostic);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnostic(diagnostic: ls.Diagnostic): code.Diagnostic {
|
|
||||||
let result = new code.Diagnostic(asRange(diagnostic.range), diagnostic.message, asDiagnosticSeverity(diagnostic.severity));
|
|
||||||
if (is.defined(diagnostic.code)) {
|
|
||||||
result.code = diagnostic.code;
|
|
||||||
}
|
|
||||||
if (is.defined(diagnostic.source)) {
|
|
||||||
result.source = diagnostic.source;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRange(value: ls.Range): code.Range {
|
|
||||||
if (is.undefined(value)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(value)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new code.Range(asPosition(value.start), asPosition(value.end));
|
|
||||||
}
|
|
||||||
|
|
||||||
function asPosition(value: ls.Position): code.Position {
|
|
||||||
if (is.undefined(value)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(value)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new code.Position(value.line, value.character);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDiagnosticSeverity(value: number): code.DiagnosticSeverity {
|
|
||||||
if (is.undefined(value) || is.nil(value)) {
|
|
||||||
return code.DiagnosticSeverity.Error;
|
|
||||||
}
|
|
||||||
switch (value) {
|
|
||||||
case ls.DiagnosticSeverity.Error:
|
|
||||||
return code.DiagnosticSeverity.Error;
|
|
||||||
case ls.DiagnosticSeverity.Warning:
|
|
||||||
return code.DiagnosticSeverity.Warning;
|
|
||||||
case ls.DiagnosticSeverity.Information:
|
|
||||||
return code.DiagnosticSeverity.Information;
|
|
||||||
case ls.DiagnosticSeverity.Hint:
|
|
||||||
return code.DiagnosticSeverity.Hint;
|
|
||||||
}
|
|
||||||
return code.DiagnosticSeverity.Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asHover(hover: ls.Hover): code.Hover {
|
|
||||||
if (is.undefined(hover)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(hover)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (is.nil(hover.contents) || is.undefined(hover.contents)) {
|
|
||||||
// Contents must be defined or hover will throw
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new code.Hover(hover.contents, is.defined(hover.range) ? asRange(hover.range) : undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCompletionResult(result: ls.CompletionItem[] | ls.CompletionList): code.CompletionItem[] | code.CompletionList {
|
|
||||||
if (is.undefined(result)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(result)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (Array.isArray(result)) {
|
|
||||||
let items = <ls.CompletionItem[]>result;
|
|
||||||
return items.map(asCompletionItem);
|
|
||||||
}
|
|
||||||
let list = <ls.CompletionList>result;
|
|
||||||
return new code.CompletionList(list.items.map(asCompletionItem), list.isIncomplete);
|
|
||||||
}
|
|
||||||
|
|
||||||
function set<T>(value: T, func: () => void): void {
|
|
||||||
if (is.defined(value)) {
|
|
||||||
func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCompletionItem(item: ls.CompletionItem): ProtocolCompletionItem {
|
|
||||||
let result = new ProtocolCompletionItem(item.label);
|
|
||||||
set(item.detail, () => result.detail = item.detail);
|
|
||||||
set(item.documentation, () => result.documentation = item.documentation);
|
|
||||||
set(item.filterText, () => result.filterText = item.filterText);
|
|
||||||
set(item.insertText, () => result.insertText = item.insertText);
|
|
||||||
// Protocol item kind is 1 based, codes item kind is zero based.
|
|
||||||
set(item.kind, () => result.kind = item.kind - 1);
|
|
||||||
set(item.sortText, () => result.sortText = item.sortText);
|
|
||||||
set(item.textEdit, () => result.textEdit = asTextEdit(item.textEdit));
|
|
||||||
set(item.additionalTextEdits, () => result.additionalTextEdits = asTextEdits(item.additionalTextEdits));
|
|
||||||
set(item.command, () => result.command = asCommand(item.command));
|
|
||||||
set(item.data, () => result.data = item.data);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextEdit(edit: ls.TextEdit): code.TextEdit {
|
|
||||||
return new code.TextEdit(asRange(edit.range), edit.newText);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTextEdits(items: ls.TextEdit[]): code.TextEdit[] {
|
|
||||||
if (is.undefined(items)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(items)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return items.map(asTextEdit);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSignatureHelp(item: ls.SignatureHelp): code.SignatureHelp {
|
|
||||||
if (is.undefined(item)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(item)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let result = new code.SignatureHelp();
|
|
||||||
set(item.activeParameter, () => result.activeParameter = item.activeParameter);
|
|
||||||
set(item.activeSignature, () => result.activeSignature = item.activeSignature);
|
|
||||||
set(item.signatures, () => result.signatures = asSignatureInformations(item.signatures));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSignatureInformations(items: ls.SignatureInformation[]): code.SignatureInformation[] {
|
|
||||||
return items ? items.map(asSignatureInformation) : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSignatureInformation(item: ls.SignatureInformation): code.SignatureInformation {
|
|
||||||
if (!item) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
let result = new code.SignatureInformation(item.label);
|
|
||||||
set(item.documentation, () => result.documentation = item.documentation);
|
|
||||||
set(item.parameters, () => result.parameters = asParameterInformations(item.parameters));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asParameterInformations(item: ls.ParameterInformation[]): code.ParameterInformation[] {
|
|
||||||
return item.map(asParameterInformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asParameterInformation(item: ls.ParameterInformation): code.ParameterInformation {
|
|
||||||
let result = new code.ParameterInformation(item.label);
|
|
||||||
set(item.documentation, () => result.documentation = item.documentation);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDefinitionResult(item: ls.Definition): code.Definition {
|
|
||||||
if (is.undefined(item)) {
|
|
||||||
return undefined;
|
|
||||||
} else if (is.nil(item)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (is.array(item)) {
|
|
||||||
return item.map(asLocation);
|
|
||||||
} else {
|
|
||||||
return asLocation(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function asLocation(item: ls.Location): code.Location {
|
|
||||||
if (is.undefined(item)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(item)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new code.Location(_uriConverter(item.uri), asRange(item.range));
|
|
||||||
}
|
|
||||||
|
|
||||||
function asReferences(values: ls.Location[]): code.Location[] {
|
|
||||||
if (is.undefined(values)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(values)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return values.map(asLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentHighlights(values: ls.DocumentHighlight[]): code.DocumentHighlight[] {
|
|
||||||
if (is.undefined(values)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(values)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return values.map(asDocumentHighlight);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentHighlight(item: ls.DocumentHighlight): code.DocumentHighlight {
|
|
||||||
let result = new code.DocumentHighlight(asRange(item.range));
|
|
||||||
set(item.kind, () => result.kind = asDocumentHighlightKind(item.kind));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentHighlightKind(item: ls.DocumentHighlightKind): code.DocumentHighlightKind {
|
|
||||||
switch (item) {
|
|
||||||
case ls.DocumentHighlightKind.Text:
|
|
||||||
return code.DocumentHighlightKind.Text;
|
|
||||||
case ls.DocumentHighlightKind.Read:
|
|
||||||
return code.DocumentHighlightKind.Read;
|
|
||||||
case ls.DocumentHighlightKind.Write:
|
|
||||||
return code.DocumentHighlightKind.Write;
|
|
||||||
}
|
|
||||||
return code.DocumentHighlightKind.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSymbolInformations(values: ls.SymbolInformation[], uri?: code.Uri): code.SymbolInformation[] {
|
|
||||||
if (is.undefined(values)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(values)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return values.map(information => asSymbolInformation(information, uri));
|
|
||||||
}
|
|
||||||
|
|
||||||
function asSymbolInformation(item: ls.SymbolInformation, uri?: code.Uri): code.SymbolInformation {
|
|
||||||
// Symbol kind is one based in the protocol and zero based in code.
|
|
||||||
let result = new code.SymbolInformation(
|
|
||||||
item.name, item.kind - 1,
|
|
||||||
asRange(item.location.range),
|
|
||||||
item.location.uri ? _uriConverter(item.location.uri) : uri);
|
|
||||||
set(item.containerName, () => result.containerName = item.containerName);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCommand(item: ls.Command): code.Command {
|
|
||||||
let result: code.Command = { title: item.title, command: item.command };
|
|
||||||
set(item.arguments, () => result.arguments = item.arguments);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCommands(items: ls.Command[]): code.Command[] {
|
|
||||||
if (is.undefined(items)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(items)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return items.map(asCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCodeLens(item: ls.CodeLens): code.CodeLens {
|
|
||||||
let result: ProtocolCodeLens = new ProtocolCodeLens(asRange(item.range));
|
|
||||||
if (is.defined(item.command)) { result.command = asCommand(item.command); }
|
|
||||||
if (is.defined(item.data)) { result.data = item.data; }
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asCodeLenses(items: ls.CodeLens[]): code.CodeLens[] {
|
|
||||||
if (is.undefined(items)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(items)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return items.map(asCodeLens);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asWorkspaceEdit(item: ls.WorkspaceEdit): code.WorkspaceEdit {
|
|
||||||
if (is.undefined(item)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(item)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let result = new code.WorkspaceEdit();
|
|
||||||
let keys = Object.keys(item.changes);
|
|
||||||
keys.forEach(key => result.set(_uriConverter(key), asTextEdits(item.changes[key])));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentLink(item: ls.DocumentLink): code.DocumentLink {
|
|
||||||
let range = asRange(item.range);
|
|
||||||
let target = is.defined(item.target) && asUri(item.target);
|
|
||||||
return new code.DocumentLink(range, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asDocumentLinks(items: ls.DocumentLink[]): code.DocumentLink[] {
|
|
||||||
if (is.undefined(items)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
if (is.nil(items)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return items.map(asDocumentLink);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asConnectionSummary(params: ls.ConnectionCompleteParams): data.ConnectionInfoSummary {
|
|
||||||
let connSummary: data.ConnectionInfoSummary = {
|
|
||||||
ownerUri: params.ownerUri,
|
|
||||||
connectionId: params.connectionId,
|
|
||||||
messages: params.messages,
|
|
||||||
errorMessage: params.errorMessage,
|
|
||||||
errorNumber: params.errorNumber,
|
|
||||||
serverInfo: params.serverInfo,
|
|
||||||
connectionSummary: params.connectionSummary
|
|
||||||
};
|
|
||||||
return connSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asServiceOptionType(val: string): data.ServiceOptionType {
|
|
||||||
if (val === 'string') {
|
|
||||||
return data.ServiceOptionType.string;
|
|
||||||
} else if (val === 'multistring') {
|
|
||||||
return data.ServiceOptionType.multistring;
|
|
||||||
} else if (val === 'password') {
|
|
||||||
return data.ServiceOptionType.password;
|
|
||||||
} else if (val === 'number') {
|
|
||||||
return data.ServiceOptionType.number;
|
|
||||||
} else if (val === 'boolean') {
|
|
||||||
return data.ServiceOptionType.boolean;
|
|
||||||
} else if (val === 'category') {
|
|
||||||
return data.ServiceOptionType.category;
|
|
||||||
} else if (val === 'object') {
|
|
||||||
return data.ServiceOptionType.object;
|
|
||||||
}
|
|
||||||
|
|
||||||
// assume string for unknown value types
|
|
||||||
return data.ServiceOptionType.string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function asServerCapabilities(result: ls.CapabiltiesDiscoveryResult): data.DataProtocolServerCapabilities {
|
|
||||||
let capabilities: data.DataProtocolServerCapabilities = {
|
|
||||||
protocolVersion: result.capabilities.protocolVersion,
|
|
||||||
providerName: result.capabilities.providerName,
|
|
||||||
providerDisplayName: result.capabilities.providerDisplayName,
|
|
||||||
connectionProvider: undefined,
|
|
||||||
adminServicesProvider: undefined,
|
|
||||||
features: []
|
|
||||||
};
|
|
||||||
|
|
||||||
if (result.capabilities.adminServicesProvider) {
|
|
||||||
capabilities.adminServicesProvider = <data.AdminServicesOptions>{
|
|
||||||
databaseInfoOptions: new Array<data.ServiceOption>(),
|
|
||||||
databaseFileInfoOptions: new Array<data.ServiceOption>(),
|
|
||||||
fileGroupInfoOptions: new Array<data.ServiceOption>()
|
|
||||||
};
|
|
||||||
|
|
||||||
if (result.capabilities.adminServicesProvider.databaseInfoOptions
|
|
||||||
&& result.capabilities.adminServicesProvider.databaseInfoOptions.length > 0) {
|
|
||||||
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseInfoOptions.length; ++i) {
|
|
||||||
let srcOption: ls.ServiceOption = result.capabilities.adminServicesProvider.databaseInfoOptions[i];
|
|
||||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
|
||||||
capabilities.adminServicesProvider.databaseInfoOptions.push(descOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.capabilities.adminServicesProvider.databaseFileInfoOptions
|
|
||||||
&& result.capabilities.adminServicesProvider.databaseFileInfoOptions.length > 0) {
|
|
||||||
for (let i = 0; i < result.capabilities.adminServicesProvider.databaseFileInfoOptions.length; ++i) {
|
|
||||||
let srcOption: ls.ServiceOption = result.capabilities.adminServicesProvider.databaseFileInfoOptions[i];
|
|
||||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
|
||||||
capabilities.adminServicesProvider.databaseFileInfoOptions.push(descOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.capabilities.adminServicesProvider.fileGroupInfoOptions
|
|
||||||
&& result.capabilities.adminServicesProvider.fileGroupInfoOptions.length > 0) {
|
|
||||||
for (let i = 0; i < result.capabilities.adminServicesProvider.fileGroupInfoOptions.length; ++i) {
|
|
||||||
let srcOption: ls.ServiceOption = result.capabilities.adminServicesProvider.fileGroupInfoOptions[i];
|
|
||||||
let descOption: data.ServiceOption = buildServiceOption(srcOption);
|
|
||||||
capabilities.adminServicesProvider.fileGroupInfoOptions.push(descOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.capabilities.connectionProvider
|
|
||||||
&& result.capabilities.connectionProvider.options
|
|
||||||
&& result.capabilities.connectionProvider.options.length > 0) {
|
|
||||||
capabilities.connectionProvider = <data.ConnectionProviderOptions>{
|
|
||||||
options: new Array<data.ConnectionOption>()
|
|
||||||
};
|
|
||||||
for (let i = 0; i < result.capabilities.connectionProvider.options.length; ++i) {
|
|
||||||
let srcOption: ls.ConnectionOption = result.capabilities.connectionProvider.options[i];
|
|
||||||
let descOption: data.ConnectionOption = {
|
|
||||||
name: srcOption.name,
|
|
||||||
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
|
||||||
description: srcOption.description,
|
|
||||||
groupName: srcOption.groupName,
|
|
||||||
defaultValue: srcOption.defaultValue,
|
|
||||||
categoryValues: srcOption.categoryValues,
|
|
||||||
isIdentity: srcOption.isIdentity,
|
|
||||||
isRequired: srcOption.isRequired,
|
|
||||||
valueType: asServiceOptionType(srcOption.valueType),
|
|
||||||
specialValueType: undefined
|
|
||||||
};
|
|
||||||
|
|
||||||
if (srcOption.specialValueType === 'serverName') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.serverName;
|
|
||||||
} else if (srcOption.specialValueType === 'databaseName') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.databaseName;
|
|
||||||
} else if (srcOption.specialValueType === 'authType') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.authType;
|
|
||||||
} else if (srcOption.specialValueType === 'userName') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.userName;
|
|
||||||
} else if (srcOption.specialValueType === 'password') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.password;
|
|
||||||
} else if (srcOption.specialValueType === 'appName') {
|
|
||||||
descOption.specialValueType = data.ConnectionOptionSpecialType.appName;
|
|
||||||
}
|
|
||||||
|
|
||||||
capabilities.connectionProvider.options.push(descOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.capabilities.features
|
|
||||||
&& result.capabilities.features.length > 0) {
|
|
||||||
result.capabilities.features.forEach(feature => {
|
|
||||||
let descFeature: data.FeatureMetadataProvider = {
|
|
||||||
enabled: feature.enabled,
|
|
||||||
featureName: feature.featureName,
|
|
||||||
optionsMetadata: []
|
|
||||||
};
|
|
||||||
capabilities.features.push(descFeature);
|
|
||||||
if (feature.optionsMetadata) {
|
|
||||||
feature.optionsMetadata.forEach(srcOption => {
|
|
||||||
descFeature.optionsMetadata.push(buildServiceOption(srcOption));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return capabilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildServiceOption(srcOption: ls.ServiceOption): data.ServiceOption {
|
|
||||||
return {
|
|
||||||
name: srcOption.name,
|
|
||||||
displayName: srcOption.displayName ? srcOption.displayName : srcOption.name,
|
|
||||||
description: srcOption.description,
|
|
||||||
groupName: srcOption.groupName,
|
|
||||||
defaultValue: srcOption.defaultValue,
|
|
||||||
categoryValues: srcOption.categoryValues,
|
|
||||||
isRequired: srcOption.isRequired,
|
|
||||||
isArray: srcOption.isArray,
|
|
||||||
objectType: srcOption.objectType,
|
|
||||||
valueType: asServiceOptionType(srcOption.valueType),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asProviderMetadata(params: ls.MetadataQueryResult): data.ProviderMetadata {
|
|
||||||
let objectMetadata: data.ObjectMetadata[] = [];
|
|
||||||
|
|
||||||
if (!params.metadata || !params.metadata.length) {
|
|
||||||
return {
|
|
||||||
objectMetadata: objectMetadata
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < params.metadata.length; ++i) {
|
|
||||||
let metadata: ls.ObjectMetadata = params.metadata[i];
|
|
||||||
|
|
||||||
let metadataTypeName: string;
|
|
||||||
if (metadata.metadataTypeName) {
|
|
||||||
// Read from the provider since it's defined
|
|
||||||
metadataTypeName = metadata.metadataTypeName;
|
|
||||||
} else if (metadata.metadataType === ls.MetadataType.View) {
|
|
||||||
metadataTypeName = 'View';
|
|
||||||
} else if (metadata.metadataType === ls.MetadataType.SProc) {
|
|
||||||
metadataTypeName = 'StoredProcedure';
|
|
||||||
} else if (metadata.metadataType === ls.MetadataType.Function) {
|
|
||||||
metadataTypeName = 'Function';
|
|
||||||
} else {
|
|
||||||
metadataTypeName = 'Table';
|
|
||||||
}
|
|
||||||
|
|
||||||
objectMetadata.push({
|
|
||||||
metadataTypeName: metadataTypeName,
|
|
||||||
metadataType: metadata.metadataType,
|
|
||||||
name: metadata.name,
|
|
||||||
schema: metadata.schema,
|
|
||||||
urn: metadata.urn
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return <data.ProviderMetadata>{
|
|
||||||
objectMetadata: objectMetadata
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asObjectExplorerSession(params: ls.SessionCreatedParameters): data.ObjectExplorerSession {
|
|
||||||
return <data.ObjectExplorerSession>{
|
|
||||||
success: params.success,
|
|
||||||
sessionId: params.sessionId,
|
|
||||||
rootNode: params.rootNode,
|
|
||||||
errorMessage: params.errorMessage
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asObjectExplorerCreateSessionResponse(params: ls.CreateSessionResponse): data.ObjectExplorerSessionResponse {
|
|
||||||
return <data.ObjectExplorerSessionResponse>{
|
|
||||||
sessionId: params.sessionId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asObjectExplorerNodeInfo(params: ls.ExpandResponse): data.ObjectExplorerExpandInfo {
|
|
||||||
return <data.ObjectExplorerExpandInfo>{
|
|
||||||
sessionId: params.sessionId,
|
|
||||||
nodes: params.nodes,
|
|
||||||
errorMessage: params.errorMessage,
|
|
||||||
nodePath: params.nodePath
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asObjectExplorerCloseSessionResponse(params: ls.CloseSessionResponse): data.ObjectExplorerCloseSessionResponse {
|
|
||||||
return <data.ObjectExplorerCloseSessionResponse>{
|
|
||||||
sessionId: params.sessionId,
|
|
||||||
success: params.success
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asScriptingResult(params: ls.ScriptingResult): data.ScriptingResult {
|
|
||||||
return <data.ScriptingResult>{
|
|
||||||
operationId: params.operationId,
|
|
||||||
script: params.script
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asListTasksResponse(response: ls.ListTasksResponse): data.ListTasksResponse {
|
|
||||||
return <data.ListTasksResponse>{
|
|
||||||
tasks: response.tasks
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asTaskInfo(params: ls.TaskInfo): data.TaskInfo {
|
|
||||||
return <data.TaskInfo>{
|
|
||||||
taskId: params.taskId,
|
|
||||||
status: params.status,
|
|
||||||
taskExecutionMode: params.taskExecutionMode,
|
|
||||||
serverName: params.serverName,
|
|
||||||
name: params.name,
|
|
||||||
databaseName: params.databaseName,
|
|
||||||
description: params.description,
|
|
||||||
providerName: params.providerName,
|
|
||||||
isCancelable: params.isCancelable,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRestorePlanResponse(params: ls.RestorePlanResponse): data.RestorePlanResponse {
|
|
||||||
return <data.RestorePlanResponse>{
|
|
||||||
backupSetsToRestore: params.backupSetsToRestore,
|
|
||||||
canRestore: params.canRestore,
|
|
||||||
databaseNamesFromBackupSets: params.databaseNamesFromBackupSets,
|
|
||||||
dbFiles: params.dbFiles,
|
|
||||||
errorMessage: params.errorMessage,
|
|
||||||
planDetails: params.planDetails,
|
|
||||||
sessionId: params.sessionId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRestoreResponse(params: ls.RestoreResponse): data.RestoreResponse {
|
|
||||||
return <data.RestoreResponse>{
|
|
||||||
result: params.result,
|
|
||||||
errorMessage: params.errorMessage,
|
|
||||||
taskId: params.taskId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function asRestoreConfigInfo(params: ls.RestoreConfigInfoResponse): data.RestoreConfigInfo {
|
|
||||||
return <data.RestoreConfigInfo>{
|
|
||||||
configInfo: params.configInfo
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
asUri,
|
|
||||||
asDiagnostics,
|
|
||||||
asDiagnostic,
|
|
||||||
asRange,
|
|
||||||
asPosition,
|
|
||||||
asDiagnosticSeverity,
|
|
||||||
asHover,
|
|
||||||
asCompletionResult,
|
|
||||||
asCompletionItem,
|
|
||||||
asTextEdit,
|
|
||||||
asTextEdits,
|
|
||||||
asSignatureHelp,
|
|
||||||
asSignatureInformations,
|
|
||||||
asSignatureInformation,
|
|
||||||
asParameterInformations,
|
|
||||||
asParameterInformation,
|
|
||||||
asDefinitionResult,
|
|
||||||
asLocation,
|
|
||||||
asReferences,
|
|
||||||
asDocumentHighlights,
|
|
||||||
asDocumentHighlight,
|
|
||||||
asDocumentHighlightKind,
|
|
||||||
asSymbolInformations,
|
|
||||||
asSymbolInformation,
|
|
||||||
asCommand,
|
|
||||||
asCommands,
|
|
||||||
asCodeLens,
|
|
||||||
asCodeLenses,
|
|
||||||
asWorkspaceEdit,
|
|
||||||
asDocumentLink,
|
|
||||||
asDocumentLinks,
|
|
||||||
asConnectionSummary,
|
|
||||||
asServerCapabilities,
|
|
||||||
asProviderMetadata,
|
|
||||||
asScriptingResult,
|
|
||||||
asObjectExplorerSession,
|
|
||||||
asObjectExplorerCreateSessionResponse,
|
|
||||||
asObjectExplorerNodeInfo,
|
|
||||||
asObjectExplorerCloseSessionResponse,
|
|
||||||
asListTasksResponse,
|
|
||||||
asTaskInfo,
|
|
||||||
asRestorePlanResponse,
|
|
||||||
asRestoreResponse,
|
|
||||||
asRestoreConfigInfo
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// This for backward compatibility since we exported the converter functions as API.
|
|
||||||
const defaultConverter = createConverter();
|
|
||||||
|
|
||||||
export const asDiagnostics: (diagnostics: ls.Diagnostic[]) => code.Diagnostic[] = defaultConverter.asDiagnostics;
|
|
||||||
export const asDiagnostic: (diagnostic: ls.Diagnostic) => code.Diagnostic = defaultConverter.asDiagnostic;
|
|
||||||
export const asRange: (value: ls.Range) => code.Range = defaultConverter.asRange;
|
|
||||||
export const asPosition: (value: ls.Position) => code.Position = defaultConverter.asPosition;
|
|
||||||
export const asDiagnosticSeverity: (value: number) => code.DiagnosticSeverity = defaultConverter.asDiagnosticSeverity;
|
|
||||||
export const asHover: (hover: ls.Hover) => code.Hover = defaultConverter.asHover;
|
|
||||||
export const asCompletionResult: (result: ls.CompletionItem[] | ls.CompletionList) => code.CompletionItem[] | code.CompletionList = defaultConverter.asCompletionResult;
|
|
||||||
export const asCompletionItem: (item: ls.CompletionItem) => ProtocolCompletionItem = defaultConverter.asCompletionItem;
|
|
||||||
export const asTextEdit: (edit: ls.TextEdit) => code.TextEdit = defaultConverter.asTextEdit;
|
|
||||||
export const asTextEdits: (items: ls.TextEdit[]) => code.TextEdit[] = defaultConverter.asTextEdits;
|
|
||||||
export const asSignatureHelp: (item: ls.SignatureHelp) => code.SignatureHelp = defaultConverter.asSignatureHelp;
|
|
||||||
export const asSignatureInformations: (items: ls.SignatureInformation[]) => code.SignatureInformation[] = defaultConverter.asSignatureInformations;
|
|
||||||
export const asSignatureInformation: (item: ls.SignatureInformation) => code.SignatureInformation = defaultConverter.asSignatureInformation;
|
|
||||||
export const asParameterInformations: (item: ls.ParameterInformation[]) => code.ParameterInformation[] = defaultConverter.asParameterInformations;
|
|
||||||
export const asParameterInformation: (item: ls.ParameterInformation) => code.ParameterInformation = defaultConverter.asParameterInformation;
|
|
||||||
export const asDefinitionResult: (item: ls.Definition) => code.Definition = defaultConverter.asDefinitionResult;
|
|
||||||
export const asLocation: (item: ls.Location) => code.Location = defaultConverter.asLocation;
|
|
||||||
export const asReferences: (values: ls.Location[]) => code.Location[] = defaultConverter.asReferences;
|
|
||||||
export const asDocumentHighlights: (values: ls.DocumentHighlight[]) => code.DocumentHighlight[] = defaultConverter.asDocumentHighlights;
|
|
||||||
export const asDocumentHighlight: (item: ls.DocumentHighlight) => code.DocumentHighlight = defaultConverter.asDocumentHighlight;
|
|
||||||
export const asDocumentHighlightKind: (item: ls.DocumentHighlightKind) => code.DocumentHighlightKind = defaultConverter.asDocumentHighlightKind;
|
|
||||||
export const asSymbolInformations: (values: ls.SymbolInformation[], uri?: code.Uri) => code.SymbolInformation[] = defaultConverter.asSymbolInformations;
|
|
||||||
export const asSymbolInformation: (item: ls.SymbolInformation, uri?: code.Uri) => code.SymbolInformation = defaultConverter.asSymbolInformation;
|
|
||||||
export const asCommand: (item: ls.Command) => code.Command = defaultConverter.asCommand;
|
|
||||||
export const asCommands: (items: ls.Command[]) => code.Command[] = defaultConverter.asCommands;
|
|
||||||
export const asCodeLens: (item: ls.CodeLens) => code.CodeLens = defaultConverter.asCodeLens;
|
|
||||||
export const asCodeLenses: (items: ls.CodeLens[]) => code.CodeLens[] = defaultConverter.asCodeLenses;
|
|
||||||
export const asWorkspaceEdit: (item: ls.WorkspaceEdit) => code.WorkspaceEdit = defaultConverter.asWorkspaceEdit;
|
|
||||||
export const asDocumentLink: (item: ls.DocumentLink) => code.DocumentLink = defaultConverter.asDocumentLink;
|
|
||||||
export const asDocumentLinks: (item: ls.DocumentLink[]) => code.DocumentLink[] = defaultConverter.asDocumentLinks;
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
// Type definitions for es6-promise
|
|
||||||
// Project: https://github.com/jakearchibald/ES6-Promise
|
|
||||||
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
interface Thenable<T> {
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Promise<T> implements Thenable<T> {
|
|
||||||
/**
|
|
||||||
* If you call resolve in the body of the callback passed to the constructor,
|
|
||||||
* your promise is fulfilled with result object passed to resolve.
|
|
||||||
* If you call reject your promise is rejected with the object passed to reject.
|
|
||||||
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
|
|
||||||
* Any errors thrown in the constructor callback will be implicitly passed to reject().
|
|
||||||
*/
|
|
||||||
constructor(callback: (resolve : (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
|
|
||||||
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
|
|
||||||
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
|
|
||||||
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
|
|
||||||
* If an error is thrown in the callback, the returned promise rejects with that error.
|
|
||||||
*
|
|
||||||
* @param onFulfilled called when/if "promise" resolves
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sugar for promise.then(undefined, onRejected)
|
|
||||||
*
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace Promise {
|
|
||||||
/**
|
|
||||||
* Make a new promise from the thenable.
|
|
||||||
* A thenable is promise-like in as far as it has a "then" method.
|
|
||||||
*/
|
|
||||||
function resolve<T>(value?: T | Thenable<T>): Promise<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
|
|
||||||
*/
|
|
||||||
function reject(error: any): Promise<any>;
|
|
||||||
function reject<T>(error: T): Promise<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
|
|
||||||
* the array passed to all can be a mixture of promise-like objects and other objects.
|
|
||||||
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
|
|
||||||
*/
|
|
||||||
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
|
||||||
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
|
||||||
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
|
||||||
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
|
||||||
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
|
||||||
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
|
||||||
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
|
|
||||||
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
|
|
||||||
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
|
|
||||||
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
|
|
||||||
*/
|
|
||||||
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'es6-promise' {
|
|
||||||
var foo: typeof Promise; // Temp variable to reference Promise in local context
|
|
||||||
namespace rsvp {
|
|
||||||
export var Promise: typeof foo;
|
|
||||||
export function polyfill(): void;
|
|
||||||
}
|
|
||||||
export = rsvp;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"lib": [
|
|
||||||
"es5",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"noImplicitAny": true,
|
|
||||||
"noImplicitThis": true,
|
|
||||||
"strictNullChecks": false,
|
|
||||||
"baseUrl": "../",
|
|
||||||
"typeRoots": [
|
|
||||||
"../"
|
|
||||||
],
|
|
||||||
"types": [],
|
|
||||||
"noEmit": true,
|
|
||||||
"forceConsistentCasingInFileNames": true
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"index.d.ts",
|
|
||||||
"es6-promise-tests.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export interface ITask<T> {
|
|
||||||
(): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Delayer<T> {
|
|
||||||
|
|
||||||
public defaultDelay: number;
|
|
||||||
private timeout: NodeJS.Timer;
|
|
||||||
private completionPromise: Promise<T>;
|
|
||||||
private onSuccess: (value?: T | Thenable<T>) => void;
|
|
||||||
private task: ITask<T>;
|
|
||||||
|
|
||||||
constructor(defaultDelay: number) {
|
|
||||||
this.defaultDelay = defaultDelay;
|
|
||||||
this.timeout = null;
|
|
||||||
this.completionPromise = null;
|
|
||||||
this.onSuccess = null;
|
|
||||||
this.task = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T> {
|
|
||||||
this.task = task;
|
|
||||||
if (delay >= 0) {
|
|
||||||
this.cancelTimeout();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.completionPromise) {
|
|
||||||
this.completionPromise = new Promise<T>((resolve) => {
|
|
||||||
this.onSuccess = resolve
|
|
||||||
}).then(() => {
|
|
||||||
this.completionPromise = null;
|
|
||||||
this.onSuccess = null;
|
|
||||||
var result = this.task();
|
|
||||||
this.task = null;
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (delay >= 0 || this.timeout === null) {
|
|
||||||
this.timeout = setTimeout(() => {
|
|
||||||
this.timeout = null;
|
|
||||||
this.onSuccess(null);
|
|
||||||
}, delay >= 0 ? delay : this.defaultDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.completionPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
public forceDelivery(): T {
|
|
||||||
if (!this.completionPromise) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
this.cancelTimeout();
|
|
||||||
let result: T = this.task();
|
|
||||||
this.completionPromise = null;
|
|
||||||
this.onSuccess = null;
|
|
||||||
this.task = null;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public isTriggered(): boolean {
|
|
||||||
return this.timeout !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public cancel(): void {
|
|
||||||
this.cancelTimeout();
|
|
||||||
this.completionPromise = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private cancelTimeout(): void {
|
|
||||||
if (this.timeout !== null) {
|
|
||||||
clearTimeout(this.timeout);
|
|
||||||
this.timeout = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import path = require('path');
|
|
||||||
import os = require('os');
|
|
||||||
import net = require('net');
|
|
||||||
import cp = require('child_process');
|
|
||||||
|
|
||||||
export interface IForkOptions {
|
|
||||||
cwd?: string;
|
|
||||||
env?: any;
|
|
||||||
encoding?: string;
|
|
||||||
execArgv?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeRandomHexString(length: number): string {
|
|
||||||
let chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
|
||||||
let result = '';
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
let idx = Math.floor(chars.length * Math.random());
|
|
||||||
result += chars[idx];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function generatePipeName(): string {
|
|
||||||
var randomName = 'vscode-' + makeRandomHexString(40);
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
return '\\\\.\\pipe\\' + randomName + '-sock';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mac/Unix: use socket file
|
|
||||||
return path.join(os.tmpdir(), randomName + '.sock');
|
|
||||||
}
|
|
||||||
|
|
||||||
function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: string): any {
|
|
||||||
// Set the two unique pipe names and the electron flag as process env
|
|
||||||
|
|
||||||
var newEnv: any = {};
|
|
||||||
for (var key in env) {
|
|
||||||
newEnv[key] = env[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
newEnv['STDIN_PIPE_NAME'] = stdInPipeName;
|
|
||||||
newEnv['STDOUT_PIPE_NAME'] = stdOutPipeName;
|
|
||||||
newEnv['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = '1';
|
|
||||||
|
|
||||||
return newEnv;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function fork(modulePath: string, args: string[], options: IForkOptions, callback: (error: any, cp: cp.ChildProcess) => void): void {
|
|
||||||
|
|
||||||
var callbackCalled = false;
|
|
||||||
var resolve = (result: cp.ChildProcess) => {
|
|
||||||
if (callbackCalled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callbackCalled = true;
|
|
||||||
callback(null, result);
|
|
||||||
};
|
|
||||||
var reject = (err: any) => {
|
|
||||||
if (callbackCalled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
callbackCalled = true;
|
|
||||||
callback(err, null);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Generate two unique pipe names
|
|
||||||
var stdInPipeName = generatePipeName();
|
|
||||||
var stdOutPipeName = generatePipeName();
|
|
||||||
|
|
||||||
var newEnv = generatePatchedEnv(options.env || process.env, stdInPipeName, stdOutPipeName);
|
|
||||||
|
|
||||||
var childProcess: cp.ChildProcess;
|
|
||||||
|
|
||||||
// Begin listening to stdout pipe
|
|
||||||
var server = net.createServer((stream) => {
|
|
||||||
// The child process will write exactly one chunk with content `ready` when it has installed a listener to the stdin pipe
|
|
||||||
|
|
||||||
stream.once('data', (chunk: Buffer) => {
|
|
||||||
// The child process is sending me the `ready` chunk, time to connect to the stdin pipe
|
|
||||||
childProcess.stdin = <any>net.connect(stdInPipeName);
|
|
||||||
|
|
||||||
// From now on the childProcess.stdout is available for reading
|
|
||||||
childProcess.stdout = stream;
|
|
||||||
|
|
||||||
resolve(childProcess);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
server.listen(stdOutPipeName);
|
|
||||||
|
|
||||||
var serverClosed = false;
|
|
||||||
var closeServer = () => {
|
|
||||||
if (serverClosed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
serverClosed = true;
|
|
||||||
server.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the process
|
|
||||||
let bootstrapperPath = path.join(__dirname, 'electronForkStart');
|
|
||||||
childProcess = cp.fork(bootstrapperPath, [modulePath].concat(args), <any>{
|
|
||||||
silent: true,
|
|
||||||
cwd: options.cwd,
|
|
||||||
env: newEnv,
|
|
||||||
execArgv: options.execArgv
|
|
||||||
});
|
|
||||||
|
|
||||||
childProcess.once('error', (err: Error) => {
|
|
||||||
closeServer();
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
childProcess.once('exit', (err: Error) => {
|
|
||||||
closeServer();
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,183 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
var net = require('net'),
|
|
||||||
fs = require('fs'),
|
|
||||||
stream = require('stream'),
|
|
||||||
util = require('util');
|
|
||||||
|
|
||||||
var ENABLE_LOGGING = false;
|
|
||||||
|
|
||||||
var log = (function () {
|
|
||||||
if (!ENABLE_LOGGING) {
|
|
||||||
return function () { };
|
|
||||||
}
|
|
||||||
var isFirst = true;
|
|
||||||
var LOG_LOCATION = 'C:\\stdFork.log';
|
|
||||||
return function log(str) {
|
|
||||||
if (isFirst) {
|
|
||||||
isFirst = false;
|
|
||||||
fs.writeFileSync(LOG_LOCATION, str + '\n');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fs.appendFileSync(LOG_LOCATION, str + '\n');
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
var stdInPipeName = process.env['STDIN_PIPE_NAME'];
|
|
||||||
var stdOutPipeName = process.env['STDOUT_PIPE_NAME'];
|
|
||||||
|
|
||||||
log('STDIN_PIPE_NAME: ' + stdInPipeName);
|
|
||||||
log('STDOUT_PIPE_NAME: ' + stdOutPipeName);
|
|
||||||
log('ATOM_SHELL_INTERNAL_RUN_AS_NODE: ' + process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE']);
|
|
||||||
|
|
||||||
// stdout redirection to named pipe
|
|
||||||
(function () {
|
|
||||||
log('Beginning stdout redirection...');
|
|
||||||
|
|
||||||
// Create a writing stream to the stdout pipe
|
|
||||||
var stdOutStream = net.connect(stdOutPipeName);
|
|
||||||
|
|
||||||
// unref stdOutStream to behave like a normal standard out
|
|
||||||
stdOutStream.unref();
|
|
||||||
|
|
||||||
// handle process.stdout
|
|
||||||
(<any>process).__defineGetter__('stdout', function () { return stdOutStream; });
|
|
||||||
|
|
||||||
// handle process.stderr
|
|
||||||
(<any>process).__defineGetter__('stderr', function () { return stdOutStream; });
|
|
||||||
|
|
||||||
var fsWriteSyncString = function (fd, str, position, encoding) {
|
|
||||||
// fs.writeSync(fd, string[, position[, encoding]]);
|
|
||||||
var buf = new Buffer(str, encoding || 'utf8');
|
|
||||||
return fsWriteSyncBuffer(fd, buf, 0, buf.length);
|
|
||||||
};
|
|
||||||
|
|
||||||
var fsWriteSyncBuffer = function (fd, buffer, off, len) {
|
|
||||||
off = Math.abs(off | 0);
|
|
||||||
len = Math.abs(len | 0);
|
|
||||||
|
|
||||||
// fs.writeSync(fd, buffer, offset, length[, position]);
|
|
||||||
var buffer_length = buffer.length;
|
|
||||||
|
|
||||||
if (off > buffer_length) {
|
|
||||||
throw new Error('offset out of bounds');
|
|
||||||
}
|
|
||||||
if (len > buffer_length) {
|
|
||||||
throw new Error('length out of bounds');
|
|
||||||
}
|
|
||||||
if (((off + len) | 0) < off) {
|
|
||||||
throw new Error('off + len overflow');
|
|
||||||
}
|
|
||||||
if (buffer_length - off < len) {
|
|
||||||
// Asking for more than is left over in the buffer
|
|
||||||
throw new Error('off + len > buffer.length');
|
|
||||||
}
|
|
||||||
|
|
||||||
var slicedBuffer = buffer;
|
|
||||||
if (off !== 0 || len !== buffer_length) {
|
|
||||||
slicedBuffer = buffer.slice(off, off + len);
|
|
||||||
}
|
|
||||||
|
|
||||||
stdOutStream.write(slicedBuffer);
|
|
||||||
return slicedBuffer.length;
|
|
||||||
};
|
|
||||||
|
|
||||||
// handle fs.writeSync(1, ...)
|
|
||||||
var originalWriteSync = fs.writeSync;
|
|
||||||
fs.writeSync = function (fd, data, position, encoding) {
|
|
||||||
if (fd !== 1) {
|
|
||||||
return originalWriteSync.apply(fs, arguments);
|
|
||||||
}
|
|
||||||
// usage:
|
|
||||||
// fs.writeSync(fd, buffer, offset, length[, position]);
|
|
||||||
// OR
|
|
||||||
// fs.writeSync(fd, string[, position[, encoding]]);
|
|
||||||
|
|
||||||
if (data instanceof Buffer) {
|
|
||||||
return fsWriteSyncBuffer.apply(null, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For compatibility reasons with fs.writeSync, writing null will write "null", etc
|
|
||||||
if (typeof data !== 'string') {
|
|
||||||
data += '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return fsWriteSyncString.apply(null, arguments);
|
|
||||||
};
|
|
||||||
|
|
||||||
log('Finished defining process.stdout, process.stderr and fs.writeSync');
|
|
||||||
})();
|
|
||||||
|
|
||||||
// stdin redirection to named pipe
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
// Begin listening to stdin pipe
|
|
||||||
var server = net.createServer(function (stream) {
|
|
||||||
// Stop accepting new connections, keep the existing one alive
|
|
||||||
server.close();
|
|
||||||
|
|
||||||
log('Parent process has connected to my stdin. All should be good now.');
|
|
||||||
|
|
||||||
// handle process.stdin
|
|
||||||
(<any>process).__defineGetter__('stdin', function () {
|
|
||||||
return stream;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove myself from process.argv
|
|
||||||
process.argv.splice(1, 1);
|
|
||||||
|
|
||||||
// Load the actual program
|
|
||||||
var program = process.argv[1];
|
|
||||||
log('Loading program: ' + program);
|
|
||||||
|
|
||||||
// Unset the custom environmental variables that should not get inherited
|
|
||||||
delete process.env['STDIN_PIPE_NAME'];
|
|
||||||
delete process.env['STDOUT_PIPE_NAME'];
|
|
||||||
delete process.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
|
|
||||||
|
|
||||||
require(program);
|
|
||||||
|
|
||||||
log('Finished loading program.');
|
|
||||||
|
|
||||||
var stdinIsReferenced = true;
|
|
||||||
var timer = setInterval(function () {
|
|
||||||
var listenerCount = (
|
|
||||||
stream.listeners('data').length +
|
|
||||||
stream.listeners('end').length +
|
|
||||||
stream.listeners('close').length +
|
|
||||||
stream.listeners('error').length
|
|
||||||
);
|
|
||||||
// log('listenerCount: ' + listenerCount);
|
|
||||||
if (listenerCount <= 1) {
|
|
||||||
// No more "actual" listeners, only internal node
|
|
||||||
if (stdinIsReferenced) {
|
|
||||||
stdinIsReferenced = false;
|
|
||||||
// log('unreferencing stream!!!');
|
|
||||||
stream.unref();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// There are "actual" listeners
|
|
||||||
if (!stdinIsReferenced) {
|
|
||||||
stdinIsReferenced = true;
|
|
||||||
stream.ref();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// log(
|
|
||||||
// '' + stream.listeners('data').length +
|
|
||||||
// ' ' + stream.listeners('end').length +
|
|
||||||
// ' ' + stream.listeners('close').length +
|
|
||||||
// ' ' + stream.listeners('error').length
|
|
||||||
// );
|
|
||||||
}, 1000);
|
|
||||||
timer.unref();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
server.listen(stdInPipeName, function () {
|
|
||||||
// signal via stdout that the parent process can now begin writing to stdin pipe
|
|
||||||
process.stdout.write('ready');
|
|
||||||
});
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const toString = Object.prototype.toString;
|
|
||||||
|
|
||||||
export function defined(value: any): boolean {
|
|
||||||
return typeof value !== 'undefined';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function undefined(value: any): boolean {
|
|
||||||
return typeof value === 'undefined';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function nil(value: any): boolean {
|
|
||||||
return value === null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function boolean(value: any): value is boolean {
|
|
||||||
return value === true || value === false;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function string(value: any): value is string {
|
|
||||||
return toString.call(value) === '[object String]';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function number(value: any): value is number {
|
|
||||||
return toString.call(value) === '[object Number]';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function error(value: any): value is Error {
|
|
||||||
return toString.call(value) === '[object Error]';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function func(value: any): value is Function {
|
|
||||||
return toString.call(value) === '[object Function]';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function array<T>(value: any): value is T[] {
|
|
||||||
return Array.isArray(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function stringArray(value: any): value is string[] {
|
|
||||||
return array(value) && (<any[]>value).every(elem => string(elem));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function typedArray<T>(value: any, check: (value: any) => boolean): value is T[] {
|
|
||||||
return Array.isArray(value) && (<any[]>value).every(check);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function thenable<T>(value: any): value is Thenable<T> {
|
|
||||||
return value && func(value.then);
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
* ------------------------------------------------------------------------------------------ */
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as cp from 'child_process';
|
|
||||||
import ChildProcess = cp.ChildProcess;
|
|
||||||
|
|
||||||
import { join } from 'path';
|
|
||||||
|
|
||||||
const isWindows = (process.platform === 'win32');
|
|
||||||
const isMacintosh = (process.platform === 'darwin');
|
|
||||||
const isLinux = (process.platform === 'linux');
|
|
||||||
export function terminate(process: ChildProcess, cwd?: string): boolean {
|
|
||||||
if (isWindows) {
|
|
||||||
try {
|
|
||||||
// This we run in Atom execFileSync is available.
|
|
||||||
// Ignore stderr since this is otherwise piped to parent.stderr
|
|
||||||
// which might be already closed.
|
|
||||||
let options: any = {
|
|
||||||
stdio: ['pipe', 'pipe', 'ignore']
|
|
||||||
};
|
|
||||||
if (cwd) {
|
|
||||||
options.cwd = cwd
|
|
||||||
}
|
|
||||||
(<any>cp).execFileSync('taskkill', ['/T', '/F', '/PID', process.pid.toString()], options);
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (isLinux || isMacintosh) {
|
|
||||||
try {
|
|
||||||
var cmd = join(__dirname, 'terminateProcess.sh');
|
|
||||||
var result = (<any>cp).spawnSync(cmd, [process.pid.toString()]);
|
|
||||||
return result.error ? false : true;
|
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
process.kill('SIGKILL');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# --------------------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
# Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
# --------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
terminateTree() {
|
|
||||||
for cpid in $(pgrep -P $1); do
|
|
||||||
terminateTree $cpid
|
|
||||||
done
|
|
||||||
kill -9 $1 > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
for pid in $*; do
|
|
||||||
terminateTree $pid
|
|
||||||
done
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
|
||||||
For Microsoft vscode-languageclient
|
|
||||||
|
|
||||||
This project incorporates material from the project(s) listed below (collectively, “Third Party Code”).
|
|
||||||
Microsoft is not the original author of the Third Party Code. The original copyright notice and license
|
|
||||||
under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed
|
|
||||||
to you under their original license terms set forth below. Microsoft reserves all other rights not expressly
|
|
||||||
granted, whether by implication, estoppel or otherwise.
|
|
||||||
|
|
||||||
1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped)
|
|
||||||
|
|
||||||
This project is licensed under the MIT license.
|
|
||||||
Copyrights are respective of each contributor listed at the beginning of each definition file.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"rules": {
|
|
||||||
"indent": [
|
|
||||||
2,
|
|
||||||
"tab"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
2,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
2,
|
|
||||||
"windows"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
2,
|
|
||||||
"always"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": "eslint:recommended"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
.vscode/
|
|
||||||
lib/test/
|
|
||||||
lib/*.map
|
|
||||||
src/
|
|
||||||
test/
|
|
||||||
.eslintrc
|
|
||||||
.gitignore
|
|
||||||
gulpfile.js
|
|
||||||
tsd.json
|
|
||||||
32
dataprotocol-node/jsonrpc/.vscode/launch.json
vendored
32
dataprotocol-node/jsonrpc/.vscode/launch.json
vendored
@@ -1,32 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.1.0",
|
|
||||||
// List of configurations. Add new configurations or edit existing ones.
|
|
||||||
// ONLY "node" and "mono" are supported, change "type" to switch.
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"request": "launch",
|
|
||||||
// Name of configuration; appears in the launch configuration drop down menu.
|
|
||||||
"name": "Mocha",
|
|
||||||
// Type of configuration. Possible values: "node", "mono".
|
|
||||||
"type": "node",
|
|
||||||
// Workspace relative or absolute path to the program.
|
|
||||||
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
|
|
||||||
// Automatically stop program after launch.
|
|
||||||
"stopOnEntry": false,
|
|
||||||
// Command line arguments passed to the program.
|
|
||||||
"args": ["--timeout", "999999"],
|
|
||||||
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
|
|
||||||
"runtimeExecutable": null,
|
|
||||||
// Optional arguments passed to the runtime executable.
|
|
||||||
"runtimeArgs": [],
|
|
||||||
// Environment variables passed to the program.
|
|
||||||
"env": { },
|
|
||||||
// Use JavaScript source maps (if they exist).
|
|
||||||
"sourceMaps": true,
|
|
||||||
// If JavaScript source maps are enabled, the generated code is expected in this directory.
|
|
||||||
"outDir": "${workspaceRoot}/lib"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
// Place your settings in this file to overwrite default and user settings.
|
|
||||||
{
|
|
||||||
"javascript.validate.enable": false,
|
|
||||||
"files.trimTrailingWhitespace": true,
|
|
||||||
"eslint.enable": false,
|
|
||||||
"editor.insertSpaces": false,
|
|
||||||
"editor.tabSize": 4,
|
|
||||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user