Renable Strict TSLint (#5018)

* removes more builder references

* remove builder from profiler

* formatting

* fix profiler dailog

* remove builder from oatuhdialog

* remove the rest of builder references

* formatting

* add more strict null checks to base

* enable strict tslint rules

* fix formatting

* fix compile error

* fix the rest of the hygeny issues and add pipeline step

* fix pipeline files
This commit is contained in:
Anthony Dresser
2019-04-18 00:34:53 -07:00
committed by GitHub
parent b852f032d3
commit ddd89fc52a
431 changed files with 3147 additions and 3789 deletions
+18 -11
View File
@@ -27,9 +27,24 @@ steps:
displayName: 'Install' displayName: 'Install'
- script: | - script: |
node_modules/.bin/gulp electron yarn gulp electron-x64
node_modules/.bin/gulp compile --max_old_space_size=4096 displayName: Download Electron
displayName: 'Scripts'
- script: |
yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
yarn tslint
displayName: 'Run TSLint'
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
- script: |
yarn compile
displayName: 'Compile'
- script: | - script: |
DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter DISPLAY=:10 ./scripts/test.sh --reporter mocha-junit-reporter
@@ -39,11 +54,3 @@ steps:
inputs: inputs:
testResultsFiles: '**/test-results.xml' testResultsFiles: '**/test-results.xml'
condition: succeededOrFailed() condition: succeededOrFailed()
- script: |
yarn tslint
displayName: 'Run TSLint'
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
+14 -10
View File
@@ -9,11 +9,23 @@ steps:
displayName: 'Yarn Install' displayName: 'Yarn Install'
- script: | - script: |
.\node_modules\.bin\gulp electron yarn gulp electron-x64
displayName: 'Electron' displayName: 'Electron'
- script: | - script: |
npm run compile yarn gulp hygiene
displayName: Run Hygiene Checks
- script: |
yarn tslint
displayName: 'Run TSLint'
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
- script: |
yarn compile
displayName: 'Compile' displayName: 'Compile'
- script: | - script: |
@@ -24,11 +36,3 @@ steps:
inputs: inputs:
testResultsFiles: 'test-results.xml' testResultsFiles: 'test-results.xml'
condition: succeededOrFailed() condition: succeededOrFailed()
- script: |
yarn tslint
displayName: 'Run TSLint'
- script: |
yarn strict-null-check
displayName: 'Run Strict Null Check'
@@ -1,6 +1,6 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
+67 -11
View File
@@ -90,7 +90,13 @@ const indentationFilter = [
'!**/Dockerfile.*', '!**/Dockerfile.*',
'!**/*.Dockerfile', '!**/*.Dockerfile',
'!**/*.dockerfile', '!**/*.dockerfile',
'!extensions/markdown-language-features/media/*.js' '!extensions/markdown-language-features/media/*.js',
// {{SQL CARBON EDIT}}
'!**/*.xlf',
'!**/*.docx',
'!**/*.sql',
'!extensions/mssql/sqltoolsservice/**',
'!extensions/import/flatfileimportservice/**',
]; ];
const copyrightFilter = [ const copyrightFilter = [
@@ -119,7 +125,36 @@ const copyrightFilter = [
'!resources/completions/**', '!resources/completions/**',
'!extensions/markdown-language-features/media/highlight.css', '!extensions/markdown-language-features/media/highlight.css',
'!extensions/html-language-features/server/src/modes/typescript/*', '!extensions/html-language-features/server/src/modes/typescript/*',
'!extensions/*/server/bin/*' '!extensions/*/server/bin/*',
// {{SQL CARBON EDIT}}
'!extensions/notebook/src/intellisense/text.ts',
'!extensions/mssql/src/objectExplorerNodeProvider/webhdfs.ts',
'!src/sql/workbench/parts/notebook/outputs/tableRenderers.ts',
'!src/sql/workbench/parts/notebook/outputs/common/url.ts',
'!src/sql/workbench/parts/notebook/outputs/common/renderMimeInterfaces.ts',
'!src/sql/workbench/parts/notebook/outputs/common/outputProcessor.ts',
'!src/sql/workbench/parts/notebook/outputs/common/mimemodel.ts',
'!src/sql/workbench/parts/notebook/cellViews/media/output.css',
'!src/sql/base/browser/ui/table/plugins/rowSelectionModel.plugin.ts',
'!src/sql/base/browser/ui/table/plugins/rowDetailView.ts',
'!src/sql/base/browser/ui/table/plugins/headerFilter.plugin.ts',
'!src/sql/base/browser/ui/table/plugins/checkboxSelectColumn.plugin.ts',
'!src/sql/base/browser/ui/table/plugins/cellSelectionModel.plugin.ts',
'!src/sql/base/browser/ui/table/plugins/autoSizeColumns.plugin.ts',
'!src/sql/workbench/parts/notebook/outputs/sanitizer.ts',
'!src/sql/workbench/parts/notebook/outputs/renderers.ts',
'!src/sql/workbench/parts/notebook/outputs/registry.ts',
'!src/sql/workbench/parts/notebook/outputs/factories.ts',
'!src/sql/workbench/parts/notebook/models/nbformat.ts',
'!extensions/markdown-language-features/media/tomorrow.css',
'!src/sql/parts/modelComponents/highlight.css',
'!extensions/mssql/sqltoolsservice/**',
'!extensions/import/flatfileimportservice/**',
'!extensions/notebook/src/prompts/**',
'!extensions/mssql/src/prompts/**',
'!extensions/notebook/resources/jupyter_config/**',
'!**/*.gif',
'!**/*.xlf'
]; ];
const eslintFilter = [ const eslintFilter = [
@@ -165,8 +200,7 @@ gulp.task('eslint', () => {
}); });
gulp.task('tslint', () => { gulp.task('tslint', () => {
// {{SQL CARBON EDIT}} const options = { emitError: 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))
@@ -264,9 +298,8 @@ function hygiene(some) {
.pipe(filter(f => !f.stat.isDirectory())) .pipe(filter(f => !f.stat.isDirectory()))
.pipe(filter(indentationFilter)) .pipe(filter(indentationFilter))
.pipe(indentation) .pipe(indentation)
.pipe(filter(copyrightFilter)); .pipe(filter(copyrightFilter))
// {{SQL CARBON EDIT}} .pipe(copyrights);
// .pipe(copyrights);
const typescript = result const typescript = result
.pipe(filter(tslintFilter)) .pipe(filter(tslintFilter))
@@ -276,15 +309,38 @@ function hygiene(some) {
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}} .pipe(gulpeslint.failAfterError());
// .pipe(gulpeslint.failAfterError());
let count = 0; let count = 0;
return es.merge(typescript, javascript) return es.merge(typescript, javascript)
.pipe(es.through(function (data) { .pipe(es.through(function (data) {
// {{SQL CARBON EDIT}} count++;
if (process.env['TRAVIS'] && count % 10 === 0) {
process.stdout.write('.');
}
this.emit('data', data);
}, function () {
process.stdout.write('\n');
const tslintResult = tsLinter.getResult();
if (tslintResult.failures.length > 0) {
for (const failure of tslintResult.failures) {
const name = failure.getFileName();
const position = failure.getStartPosition();
const line = position.getLineAndCharacter().line;
const character = position.getLineAndCharacter().character;
console.error(`${name}:${line + 1}:${character + 1}:${failure.getFailure()}`);
}
errorCount += tslintResult.failures.length;
}
if (errorCount > 0) {
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
} else {
this.emit('end'); this.emit('end');
}
})); }));
} }
-9
View File
@@ -6,15 +6,6 @@
'use strict'; 'use strict';
const gulp = require('gulp'); const gulp = require('gulp');
const json = require('gulp-json-editor');
const buffer = require('gulp-buffer');
const filter = require('gulp-filter');
const es = require('event-stream');
const vfs = require('vinyl-fs');
const pkg = require('../package.json');
const cp = require('child_process');
const fancyLog = require('fancy-log');
const ansiColors = require('ansi-colors');
// {{SQL CARBON EDIT}} // {{SQL CARBON EDIT}}
const jeditor = require('gulp-json-editor'); const jeditor = require('gulp-json-editor');
+2 -3
View File
@@ -28,7 +28,6 @@ const formatFiles = (some) => {
console.info('ran formatting on file ' + file.path + ' result: ' + result.message); console.info('ran formatting on file ' + file.path + ' result: ' + result.message);
if (result.error) { if (result.error) {
console.error(result.message); console.error(result.message);
errorCount++;
} }
cb(null, file); cb(null, file);
@@ -40,7 +39,7 @@ const formatFiles = (some) => {
.pipe(filter(f => !f.stat.isDirectory())) .pipe(filter(f => !f.stat.isDirectory()))
.pipe(formatting); .pipe(formatting);
} };
const formatStagedFiles = () => { const formatStagedFiles = () => {
const cp = require('child_process'); const cp = require('child_process');
@@ -81,4 +80,4 @@ const formatStagedFiles = () => {
process.exit(1); process.exit(1);
}); });
}); });
} };
+1 -1
View File
@@ -27,7 +27,7 @@ const zipPath = arch => path.join(zipDir(arch), `VSCode-win32-${arch}.zip`);
const setupDir = (arch, target) => path.join(repoPath, '.build', `win32-${arch}`, `${target}-setup`); const setupDir = (arch, target) => path.join(repoPath, '.build', `win32-${arch}`, `${target}-setup`);
const issPath = path.join(__dirname, 'win32', 'code.iss'); const issPath = path.join(__dirname, 'win32', 'code.iss');
const innoSetupPath = path.join(path.dirname(path.dirname(require.resolve('innosetup-compiler'))), 'bin', 'ISCC.exe'); const innoSetupPath = path.join(path.dirname(path.dirname(require.resolve('innosetup-compiler'))), 'bin', 'ISCC.exe');
const signPS1 = path.join(repoPath, 'build', 'azure-pipelines', 'win32', 'sign.ps1'); // const signPS1 = path.join(repoPath, 'build', 'azure-pipelines', 'win32', 'sign.ps1');
function packageInnoSetup(iss, options, cb) { function packageInnoSetup(iss, options, cb) {
options = options || {}; options = options || {};
+2 -5
View File
@@ -2,8 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
///
'use strict';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import * as path from 'path'; import * as path from 'path';
@@ -12,8 +10,7 @@ import * as vscode from 'vscode';
import { IConfig, ServerProvider } from 'service-downloader'; import { IConfig, ServerProvider } from 'service-downloader';
import { Telemetry } from './telemetry'; import { Telemetry } from './telemetry';
import * as utils from './utils'; import * as utils from './utils';
import { ChildProcess, exec, ExecException } from 'child_process'; import { ChildProcess, exec } from 'child_process';
import { stringify } from 'querystring';
const baseConfig = require('./config.json'); const baseConfig = require('./config.json');
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
@@ -116,7 +113,7 @@ function launchSsmsDialog(action: string, connectionProfile: azdata.IConnectionP
let args = buildSsmsMinCommandArgs(params); let args = buildSsmsMinCommandArgs(params);
// This will be an async call since we pass in the callback // This will be an async call since we pass in the callback
var proc: ChildProcess = exec( let proc: ChildProcess = exec(
/*command*/`"${exePath}" ${args}`, /*command*/`"${exePath}" ${args}`,
/*options*/undefined, /*options*/undefined,
(execException, stdout, stderr) => { (execException, stdout, stderr) => {
+5
View File
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
-2
View File
@@ -3,7 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as data from 'azdata'; import * as data from 'azdata';
@@ -12,7 +11,6 @@ import * as data from 'azdata';
* this API from our code * this API from our code
* *
* @export * @export
* @class ApiWrapper
*/ */
export class ApiWrapper { export class ApiWrapper {
// Data APIs // Data APIs
+2 -1
View File
@@ -610,7 +610,8 @@ export class JobDialog extends AgentDialog<JobData> {
{ {
component: deleteJobContainer, component: deleteJobContainer,
title: '' title: ''
}], title: this.NotificationsTabTopLabelString}]).withLayout({ width: '100%' }).component(); }], title: this.NotificationsTabTopLabelString
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel); await view.initializeModel(formModel);
this.emailConditionDropdown.values = this.model.JobCompletionActionConditions; this.emailConditionDropdown.values = this.model.JobCompletionActionConditions;
+1 -2
View File
@@ -10,8 +10,7 @@
"sourceMap": true, "sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node"
"declaration": true
}, },
"exclude": [ "exclude": [
"node_modules" "node_modules"
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as adal from 'adal-node'; import * as adal from 'adal-node';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as request from 'request'; import * as request from 'request';
@@ -54,8 +52,8 @@ export class AzureAccountProvider implements azdata.AccountProvider {
/** /**
* Clears all tokens that belong to the given account from the token cache * Clears all tokens that belong to the given account from the token cache
* @param {"data".AccountKey} accountKey Key identifying the account to delete tokens for * @param accountKey Key identifying the account to delete tokens for
* @returns {Thenable<void>} Promise to clear requested tokens from the token cache * @returns Promise to clear requested tokens from the token cache
*/ */
public clear(accountKey: azdata.AccountKey): Thenable<void> { public clear(accountKey: azdata.AccountKey): Thenable<void> {
return this.doIfInitialized(() => this.clearAccountTokens(accountKey)); return this.doIfInitialized(() => this.clearAccountTokens(accountKey));
@@ -63,7 +61,7 @@ export class AzureAccountProvider implements azdata.AccountProvider {
/** /**
* Clears the entire token cache. Invoked by command palette action. * Clears the entire token cache. Invoked by command palette action.
* @returns {Thenable<void>} Promise to clear the token cache * @returns Promise to clear the token cache
*/ */
public clearTokenCache(): Thenable<void> { public clearTokenCache(): Thenable<void> {
return this._tokenCache.clear(); return this._tokenCache.clear();
@@ -321,10 +319,10 @@ export class AzureAccountProvider implements azdata.AccountProvider {
* Retrieves a token for the given user ID for the specific tenant ID. If the token can, it * Retrieves a token for the given user ID for the specific tenant ID. If the token can, it
* will be retrieved from the cache as per the ADAL API. AFAIK, the ADAL API will also utilize * will be retrieved from the cache as per the ADAL API. AFAIK, the ADAL API will also utilize
* the refresh token if there aren't any unexpired tokens to use. * the refresh token if there aren't any unexpired tokens to use.
* @param {string} userId ID of the user to get a token for * @param userId ID of the user to get a token for
* @param {string} tenantId Tenant to get the token for * @param tenantId Tenant to get the token for
* @param {string} resourceId ID of the resource the token will be good for * @param resourceId ID of the resource the token will be good for
* @returns {Thenable<TokenResponse>} Promise to return a token. Rejected if retrieving the token fails. * @returns Promise to return a token. Rejected if retrieving the token fails.
*/ */
private getToken(userId: string, tenantId: string, resourceId: string): Thenable<adal.TokenResponse> { private getToken(userId: string, tenantId: string, resourceId: string): Thenable<adal.TokenResponse> {
let self = this; let self = this;
@@ -346,9 +344,9 @@ export class AzureAccountProvider implements azdata.AccountProvider {
/** /**
* Performs a web request using the provided bearer token * Performs a web request using the provided bearer token
* @param {TokenResponse} accessToken Bearer token for accessing the provided URI * @param accessToken Bearer token for accessing the provided URI
* @param {string} uri URI to access * @param uri URI to access
* @returns {Thenable<any>} Promise to return the deserialized body of the request. Rejected if error occurred. * @returns Promise to return the deserialized body of the request. Rejected if error occurred.
*/ */
private makeWebRequest(accessToken: adal.TokenResponse, uri: string): Thenable<any> { private makeWebRequest(accessToken: adal.TokenResponse, uri: string): Thenable<any> {
return new Promise<any>((resolve, reject) => { return new Promise<any>((resolve, reject) => {
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as adal from 'adal-node'; import * as adal from 'adal-node';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as crypto from 'crypto'; import * as crypto from 'crypto';
@@ -79,7 +77,7 @@ export default class TokenCache implements adal.TokenCache {
/** /**
* Wrapper to make callback-based find method into a thenable method * Wrapper to make callback-based find method into a thenable method
* @param query Partial object to use to look up tokens. Ideally should be partial of adal.TokenResponse * @param query Partial object to use to look up tokens. Ideally should be partial of adal.TokenResponse
* @returns {Thenable<any[]>} Promise to return the matching adal.TokenResponse objects. * @returns Promise to return the matching adal.TokenResponse objects.
* Rejected if an error was sent in the callback * Rejected if an error was sent in the callback
*/ */
public findThenable(query: any): Thenable<any[]> { public findThenable(query: any): Thenable<any[]> {
@@ -112,8 +110,8 @@ export default class TokenCache implements adal.TokenCache {
/** /**
* Wrapper to make callback-based remove method into a thenable method * Wrapper to make callback-based remove method into a thenable method
* @param {TokenResponse[]} entries Array of entries to remove from the token cache * @param entries Array of entries to remove from the token cache
* @returns {Thenable<void>} Promise to remove the given tokens from the token cache * @returns Promise to remove the given tokens from the token cache
* Rejected if an error was sent in the callback * Rejected if an error was sent in the callback
*/ */
public removeThenable(entries: adal.TokenResponse[]): Thenable<void> { public removeThenable(entries: adal.TokenResponse[]): Thenable<void> {
@@ -186,8 +184,8 @@ export default class TokenCache implements adal.TokenCache {
if (splitValues.length === 2 && splitValues[0] && splitValues[1]) { if (splitValues.length === 2 && splitValues[0] && splitValues[1]) {
try { try {
return <EncryptionParams>{ return <EncryptionParams>{
key: new Buffer(splitValues[0], 'hex'), key: Buffer.from(splitValues[0], 'hex'),
initializationVector: new Buffer(splitValues[1], 'hex') initializationVector: Buffer.from(splitValues[1], 'hex')
}; };
} catch (e) { } catch (e) {
// Swallow the error and fall through to generate new params // Swallow the error and fall through to generate new params
-3
View File
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
@@ -15,7 +13,6 @@ import * as constants from './constants';
* this API from our code * this API from our code
* *
* @export * @export
* @class ApiWrapper
*/ */
export class ApiWrapper { export class ApiWrapper {
// Data APIs // Data APIs
@@ -16,8 +16,7 @@ import { AzureResourceResourceTreeNode } from '../../resourceTreeNode';
export function registerAzureResourceDatabaseCommands(appContext: AppContext): void { export function registerAzureResourceDatabaseCommands(appContext: AppContext): void {
appContext.apiWrapper.registerCommand('azure.resource.connectsqldb', async (node?: TreeNode) => { appContext.apiWrapper.registerCommand('azure.resource.connectsqldb', async (node?: TreeNode) => {
if (!node) if (!node) {
{
return; return;
} }
@@ -16,8 +16,7 @@ import { AzureResourceResourceTreeNode } from '../../resourceTreeNode';
export function registerAzureResourceDatabaseServerCommands(appContext: AppContext): void { export function registerAzureResourceDatabaseServerCommands(appContext: AppContext): void {
appContext.apiWrapper.registerCommand('azure.resource.connectsqlserver', async (node?: TreeNode) => { appContext.apiWrapper.registerCommand('azure.resource.connectsqlserver', async (node?: TreeNode) => {
if (!node) if (!node) {
{
return; return;
} }
+5
View File
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
@@ -13,7 +13,8 @@ import {
IAzureResourceAccountService, IAzureResourceAccountService,
IAzureResourceSubscriptionService, IAzureResourceSubscriptionService,
IAzureResourceSubscriptionFilterService, IAzureResourceSubscriptionFilterService,
IAzureResourceTenantService } from '../azureResource/interfaces'; IAzureResourceTenantService
} from '../azureResource/interfaces';
import { AzureResourceServiceNames } from '../azureResource/constants'; import { AzureResourceServiceNames } from '../azureResource/constants';
import { AzureResourceTreeProvider } from '../azureResource/tree/treeProvider'; import { AzureResourceTreeProvider } from '../azureResource/tree/treeProvider';
import { registerAzureResourceCommands } from '../azureResource/commands'; import { registerAzureResourceCommands } from '../azureResource/commands';
+5 -2
View File
@@ -1,4 +1,7 @@
'use strict'; /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as fs from 'fs'; import * as fs from 'fs';
@@ -23,7 +26,7 @@ let controllers: ControllerBase[] = [];
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't // The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
// work for now because the extension is running in different process. // work for now because the extension is running in different process.
export function getAppDataPath() { export function getAppDataPath() {
var platform = process.platform; let platform = process.platform;
switch (platform) { switch (platform) {
case 'win32': return process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming'); case 'win32': return process.env['APPDATA'] || path.join(process.env['USERPROFILE'], 'AppData', 'Roaming');
case 'darwin': return path.join(os.homedir(), 'Library', 'Application Support'); case 'darwin': return path.join(os.homedir(), 'Library', 'Application Support');
@@ -2,10 +2,8 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { WizardPageBase } from '../../wizardPageBase'; import { WizardPageBase } from '../../wizardPageBase';
import { CreateClusterWizard } from '../createClusterWizard'; import { CreateClusterWizard } from '../createClusterWizard';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
@@ -347,7 +345,7 @@ export class ClusterProfilePage extends WizardPageBase<CreateClusterWizard> {
case ClusterPoolType.Spark: case ClusterPoolType.Spark:
return localize('bdc-create.SparkPoolDisplayName', 'Spark pool'); return localize('bdc-create.SparkPoolDisplayName', 'Spark pool');
default: default:
throw 'unknown pool type'; throw new Error('unknown pool type');
} }
} }
@@ -364,7 +362,7 @@ export class ClusterProfilePage extends WizardPageBase<CreateClusterWizard> {
case ClusterPoolType.Spark: case ClusterPoolType.Spark:
return localize('bdc-create.SparkPoolDescription', 'TODO: Add description'); return localize('bdc-create.SparkPoolDescription', 'TODO: Add description');
default: default:
throw 'unknown pool type'; throw new Error('unknown pool type');
} }
} }
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { WizardPageBase } from '../../wizardPageBase'; import { WizardPageBase } from '../../wizardPageBase';
@@ -1,4 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { DacFxDataModel } from './models'; import { DacFxDataModel } from './models';
@@ -15,19 +14,16 @@ export abstract class BasePage {
/** /**
* This method constructs all the elements of the page. * This method constructs all the elements of the page.
* @returns {Promise<boolean>}
*/ */
public async abstract start(): Promise<boolean>; public async abstract start(): Promise<boolean>;
/** /**
* This method is called when the user is entering the page. * This method is called when the user is entering the page.
* @returns {Promise<boolean>}
*/ */
public async abstract onPageEnter(): Promise<boolean>; public async abstract onPageEnter(): Promise<boolean>;
/** /**
* This method is called when the user is leaving the page. * This method is called when the user is leaving the page.
* @returns {Promise<boolean>}
*/ */
async onPageLeave(): Promise<boolean> { async onPageLeave(): Promise<boolean> {
return true; return true;
@@ -35,7 +31,6 @@ export abstract class BasePage {
/** /**
* Override this method to cleanup what you don't need cached in the page. * Override this method to cleanup what you don't need cached in the page.
* @returns {Promise<boolean>}
*/ */
public async cleanup(): Promise<boolean> { public async cleanup(): Promise<boolean> {
return true; return true;
@@ -136,4 +131,3 @@ export abstract class BasePage {
return; return;
} }
} }
@@ -1,4 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
@@ -2,13 +2,9 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { RequestType, NotificationType } from 'vscode-languageclient'; import { RequestType, NotificationType } from 'vscode-languageclient';
/**
* @interface IMessage
*/
export interface IMessage { export interface IMessage {
jsonrpc: string; jsonrpc: string;
} }
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as path from 'path'; import * as path from 'path';
import * as crypto from 'crypto'; import * as crypto from 'crypto';
@@ -97,7 +96,7 @@ export function generateGuid(): string {
} }
export function verifyPlatform(): Thenable<boolean> { export function verifyPlatform(): Thenable<boolean> {
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16.0) { if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
return Promise.resolve(false); return Promise.resolve(false);
} else { } else {
return Promise.resolve(true); return Promise.resolve(true);
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { ErrorAction, CloseAction } from 'vscode-languageclient'; import { ErrorAction, CloseAction } from 'vscode-languageclient';
import TelemetryReporter from 'vscode-extension-telemetry'; import TelemetryReporter from 'vscode-extension-telemetry';
import { PlatformInformation } from 'service-downloader/out/platform'; import { PlatformInformation } from 'service-downloader/out/platform';
@@ -20,7 +18,6 @@ import { IMessage, ITelemetryEventProperties, ITelemetryEventMeasures } from './
/** /**
* Handle Language Service client errors * Handle Language Service client errors
* @class LanguageClientErrorHandler
*/ */
export class LanguageClientErrorHandler { export class LanguageClientErrorHandler {
@@ -53,11 +50,6 @@ export class LanguageClientErrorHandler {
/** /**
* Callback for language service client error * Callback for language service client error
* *
* @param {Error} error
* @param {Message} message
* @param {number} count
* @returns {ErrorAction}
*
* @memberOf LanguageClientErrorHandler * @memberOf LanguageClientErrorHandler
*/ */
error(error: Error, message: IMessage, count: number): ErrorAction { error(error: Error, message: IMessage, count: number): ErrorAction {
@@ -71,8 +63,6 @@ export class LanguageClientErrorHandler {
/** /**
* Callback for language service client closed * Callback for language service client closed
* *
* @returns {CloseAction}
*
* @memberOf LanguageClientErrorHandler * @memberOf LanguageClientErrorHandler
*/ */
closed(): CloseAction { closed(): CloseAction {
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { ImportDataModel } from './models'; import { ImportDataModel } from './models';
@@ -15,19 +14,16 @@ export abstract class BasePage {
/** /**
* This method constructs all the elements of the page. * This method constructs all the elements of the page.
* @returns {Promise<boolean>}
*/ */
public async abstract start(): Promise<boolean>; public async abstract start(): Promise<boolean>;
/** /**
* This method is called when the user is entering the page. * This method is called when the user is entering the page.
* @returns {Promise<boolean>}
*/ */
public async abstract onPageEnter(): Promise<boolean>; public async abstract onPageEnter(): Promise<boolean>;
/** /**
* This method is called when the user is leaving the page. * This method is called when the user is leaving the page.
* @returns {Promise<boolean>}
*/ */
async onPageLeave(): Promise<boolean> { async onPageLeave(): Promise<boolean> {
return true; return true;
@@ -35,7 +31,6 @@ export abstract class BasePage {
/** /**
* Override this method to cleanup what you don't need cached in the page. * Override this method to cleanup what you don't need cached in the page.
* @returns {Promise<boolean>}
*/ */
public async cleanup(): Promise<boolean> { public async cleanup(): Promise<boolean> {
return true; return true;
@@ -136,4 +131,3 @@ export abstract class BasePage {
return; return;
} }
} }
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
@@ -133,7 +131,6 @@ export class SummaryPage extends ImportPage {
/** /**
* Gets the connection string to send to the middleware * Gets the connection string to send to the middleware
* @returns {Promise<string>}
*/ */
private async getConnectionString(): Promise<string> { private async getConnectionString(): Promise<string> {
let options = this.model.server.options; let options = this.model.server.options;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path'); const path = require('path');
const os = require('os'); const os = require('os');
const fs = require('fs'); const fs = require('fs');
+3 -3
View File
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { normalize, join } from 'path'; import { normalize, join } from 'path';
@@ -12,10 +12,10 @@ const TEST_SETUP_COMPLETED_TEXT: string = 'Test Setup Completed';
const EXTENSION_LOADED_TEXT: string = 'Test Extension Loaded'; const EXTENSION_LOADED_TEXT: string = 'Test Extension Loaded';
const ALL_EXTENSION_LOADED_TEXT: string = 'All Extensions Loaded'; const ALL_EXTENSION_LOADED_TEXT: string = 'All Extensions Loaded';
var statusBarItemTimer: NodeJS.Timer; let statusBarItemTimer: NodeJS.Timer;
export function activate(context: vscode.ExtensionContext) { export function activate(context: vscode.ExtensionContext) {
var statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); let statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
vscode.commands.registerCommand('test.setupIntegrationTest', async () => { vscode.commands.registerCommand('test.setupIntegrationTest', async () => {
let extensionInstallersFolder = normalize(join(__dirname, '../extensionInstallers')); let extensionInstallersFolder = normalize(join(__dirname, '../extensionInstallers'));
let installers = fs.readdirSync(extensionInstallersFolder); let installers = fs.readdirSync(extensionInstallersFolder);
@@ -41,8 +41,8 @@ export enum EngineType {
BigDataCluster BigDataCluster
} }
var connectionProviderMapping = {}; let connectionProviderMapping = {};
var authenticationTypeMapping = {}; let authenticationTypeMapping = {};
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' }; connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' }; authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
@@ -80,7 +80,7 @@ export class TestServerProfile {
public get engineType(): EngineType { return this._profile.engineType; } public get engineType(): EngineType { return this._profile.engineType; }
} }
var TestingServers: TestServerProfile[] = [ let TestingServers: TestServerProfile[] = [
new TestServerProfile( new TestServerProfile(
{ {
serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER), serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER),
@@ -121,7 +121,7 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair
if (entry) { if (entry) {
return entry; return entry;
} else { } else {
throw `Unknown enum type: ${enumValue.toString()}`; throw new Error(`Unknown enum type: ${enumValue.toString()}`);
} }
} }
@@ -3,6 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
export var context = { export let context = {
RunTest: true RunTest: true
}; };
-54
View File
@@ -10,24 +10,17 @@ import * as vscode from 'vscode';
/** /**
* The APIs provided by Mssql extension * The APIs provided by Mssql extension
*
* @export
* @interface MssqlExtensionApi
*/ */
export interface MssqlExtensionApi { export interface MssqlExtensionApi {
/** /**
* Gets the object explorer API that supports querying over the connections supported by this extension * Gets the object explorer API that supports querying over the connections supported by this extension
* *
* @returns {IMssqlObjectExplorerBrowser}
* @memberof IMssqlExtensionApi
*/ */
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser; getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser;
/** /**
* Get the Cms Service APIs to communicate with CMS connections supported by this extension * Get the Cms Service APIs to communicate with CMS connections supported by this extension
* *
* @returns {Promise<CmsService>}
* @memberof IMssqlExtensionApi
*/ */
getCmsServiceProvider(): Promise<CmsService>; getCmsServiceProvider(): Promise<CmsService>;
} }
@@ -35,25 +28,16 @@ export interface MssqlExtensionApi {
/** /**
* A browser supporting actions over the object explorer connections provided by this extension. * A browser supporting actions over the object explorer connections provided by this extension.
* Currently this is the * Currently this is the
*
* @export
* @interface MssqlObjectExplorerBrowser
*/ */
export interface MssqlObjectExplorerBrowser { export interface MssqlObjectExplorerBrowser {
/** /**
* Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer * Gets the matching node given a context object, e.g. one from a right-click on a node in Object Explorer
*
* @param {azdata.ObjectExplorerContext} objectExplorerContext
* @returns {Promise<T>}
*/ */
getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Promise<T>; getNode<T extends ITreeNode>(objectExplorerContext: azdata.ObjectExplorerContext): Promise<T>;
} }
/** /**
* A tree node in the object explorer tree * A tree node in the object explorer tree
*
* @export
* @interface ITreeNode
*/ */
export interface ITreeNode { export interface ITreeNode {
getNodeInfo(): azdata.NodeInfo; getNodeInfo(): azdata.NodeInfo;
@@ -63,10 +47,6 @@ export interface ITreeNode {
/** /**
* A HDFS file node. This is a leaf node in the object explorer tree, and its contents * A HDFS file node. This is a leaf node in the object explorer tree, and its contents
* can be queried * can be queried
*
* @export
* @interface IFileNode
* @extends {ITreeNode}
*/ */
export interface IFileNode extends ITreeNode { export interface IFileNode extends ITreeNode {
getFileContentsAsString(maxBytes?: number): Promise<string>; getFileContentsAsString(maxBytes?: number): Promise<string>;
@@ -79,64 +59,31 @@ export interface IFileNode extends ITreeNode {
export interface CmsService { export interface CmsService {
/** /**
* Connects to or creates a Central management Server * Connects to or creates a Central management Server
*
* @param {string} name
* @param {string} description
* @param {azdata.ConnectionInfo} connectiondetails
* @param {string} ownerUri
* @returns {Thenable<azdata.ListRegisteredServersResult>}
*/ */
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>; createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
/** /**
* gets all Registered Servers inside a CMS on a particular level * gets all Registered Servers inside a CMS on a particular level
*
* @param {string} ownerUri
* @param {string} relativePath
* @returns {Thenable<azdata.ListRegisteredServersResult>}
*/ */
getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>; getRegisteredServers(ownerUri: string, relativePath: string): Thenable<ListRegisteredServersResult>;
/** /**
* Adds a Registered Server inside a CMS on a particular level * Adds a Registered Server inside a CMS on a particular level
*
* @param {string} ownerUri
* @param {string} relativePath
* @param {string} registeredServerName
* @param {string} registeredServerDescription
* @param {azdata.ConnectionInfo} connectiondetails
* @returns {Thenable<boolean>>}
*/ */
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>; addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
/** /**
* Removes a Registered Server inside a CMS on a particular level * Removes a Registered Server inside a CMS on a particular level
*
* @param {string} ownerUri
* @param {string} relativePath
* @param {string} registeredServerName
* @returns {Thenable<boolean>}
*/ */
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>; removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
/** /**
* Adds a Server Group inside a CMS on a particular level * Adds a Server Group inside a CMS on a particular level
*
* @param {string} ownerUri
* @param {string} relativePath
* @param {string} groupName
* @param {string} groupDescription
* @param {azdata.ConnectionInfo} connectiondetails
*/ */
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>; addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
/** /**
* Removes a Server Group inside a CMS on a particular level * Removes a Server Group inside a CMS on a particular level
*
* @param {string} ownerUri
* @param {string} relativePath
* @param {string} groupName
* @param {string} groupDescription
*/ */
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>; removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
} }
@@ -162,4 +109,3 @@ export interface ListRegisteredServersResult {
registeredServersList: Array<RegisteredServerResult>; registeredServersList: Array<RegisteredServerResult>;
registeredServerGroups: Array<RegisteredServerGroup>; registeredServerGroups: Array<RegisteredServerGroup>;
} }
-3
View File
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
@@ -13,7 +11,6 @@ import * as azdata from 'azdata';
* this API from our code * this API from our code
* *
* @export * @export
* @class ApiWrapper
*/ */
export class ApiWrapper { export class ApiWrapper {
// Data APIs // Data APIs
-1
View File
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { NotificationType, RequestType } from 'vscode-languageclient'; import { NotificationType, RequestType } from 'vscode-languageclient';
import { ITelemetryEventProperties, ITelemetryEventMeasures } from './telemetry'; import { ITelemetryEventProperties, ITelemetryEventMeasures } from './telemetry';
+4
View File
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
export default require('error-ex')('EscapeException'); export default require('error-ex')('EscapeException');
-2
View File
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client'; import { SqlOpsDataClient, SqlOpsFeature } from 'dataprotocol-client';
import { ClientCapabilities, StaticFeature, RPCMessageType, ServerCapabilities } from 'vscode-languageclient'; import { ClientCapabilities, StaticFeature, RPCMessageType, ServerCapabilities } from 'vscode-languageclient';
@@ -12,7 +11,6 @@ import * as contracts from './contracts';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as Utils from './utils'; import * as Utils from './utils';
import * as UUID from 'vscode-languageclient/lib/utils/uuid'; import * as UUID from 'vscode-languageclient/lib/utils/uuid';
import { ConnectParams } from 'dataprotocol-client/lib/protocol';
export class TelemetryFeature implements StaticFeature { export class TelemetryFeature implements StaticFeature {
@@ -3,7 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
@@ -74,7 +73,9 @@ export abstract class Command extends vscode.Disposable {
} }
dispose(): void { dispose(): void {
this.disposable && this.disposable.dispose(); if (this.disposable) {
this.disposable.dispose();
}
} }
protected get apiWrapper(): ApiWrapper { protected get apiWrapper(): ApiWrapper {
@@ -1,5 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
@@ -10,7 +10,6 @@ import * as azdata from 'azdata';
* A tree node in the object explorer tree * A tree node in the object explorer tree
* *
* @export * @export
* @interface ITreeNode
*/ */
export interface ITreeNode { export interface ITreeNode {
getNodeInfo(): azdata.NodeInfo; getNodeInfo(): azdata.NodeInfo;
@@ -22,7 +21,6 @@ export interface ITreeNode {
* can be queried * can be queried
* *
* @export * @export
* @interface IFileNode
* @extends {ITreeNode} * @extends {ITreeNode}
*/ */
export interface IFileNode extends ITreeNode { export interface IFileNode extends ITreeNode {
@@ -1,8 +1,6 @@
// This code is originally from https://github.com/harrisiirak/webhdfs // This code is originally from https://github.com/harrisiirak/webhdfs
// License: https://github.com/harrisiirak/webhdfs/blob/master/LICENSE // License: https://github.com/harrisiirak/webhdfs/blob/master/LICENSE
'use strict';
import * as url from 'url'; import * as url from 'url';
import * as fs from 'fs'; import * as fs from 'fs';
import * as querystring from 'querystring'; import * as querystring from 'querystring';
@@ -53,10 +51,8 @@ export class WebHDFS {
/** /**
* Generate WebHDFS REST API endpoint URL for given operation * Generate WebHDFS REST API endpoint URL for given operation
* *
* @param {string} operation WebHDFS operation name * @param operation WebHDFS operation name
* @param {string} path * @returns WebHDFS REST API endpoint URL
* @param {object} params
* @returns {string} WebHDFS REST API endpoint URL
*/ */
private getOperationEndpoint(operation: string, path: string, params?: object): string { private getOperationEndpoint(operation: string, path: string, params?: object): string {
let endpoint = this._url; let endpoint = this._url;
@@ -73,8 +69,8 @@ export class WebHDFS {
/** /**
* Gets localized status message for given status code * Gets localized status message for given status code
* *
* @param {number} statusCode Http status code * @param statusCode Http status code
* @returns {string} status message * @returns status message
*/ */
private toStatusMessage(statusCode: number): string { private toStatusMessage(statusCode: number): string {
let statusMessage: string = undefined; let statusMessage: string = undefined;
@@ -93,9 +89,9 @@ export class WebHDFS {
/** /**
* Gets status message from response * Gets status message from response
* *
* @param {request.Response} response response object * @param response response object
* @param {boolean} strict If set true then RemoteException must be present in the body * @param strict If set true then RemoteException must be present in the body
* @returns {string} Error message interpreted by status code * @returns Error message interpreted by status code
*/ */
private getStatusMessage(response: request.Response): string { private getStatusMessage(response: request.Response): string {
if (!response) { return undefined; } if (!response) { return undefined; }
@@ -107,8 +103,8 @@ export class WebHDFS {
/** /**
* Gets remote exception message from response body * Gets remote exception message from response body
* *
* @param {any} responseBody response body * @param responseBody response body
* @returns {string} Error message interpreted by status code * @returns Error message interpreted by status code
*/ */
private getRemoteExceptionMessage(responseBody: any): string { private getRemoteExceptionMessage(responseBody: any): string {
if (!responseBody) { return undefined; } if (!responseBody) { return undefined; }
@@ -128,10 +124,10 @@ export class WebHDFS {
/** /**
* Generates error message descriptive as much as possible * Generates error message descriptive as much as possible
* *
* @param {string} statusMessage status message * @param statusMessage status message
* @param {string} [remoteExceptionMessage] remote exception message * @param [remoteExceptionMessage] remote exception message
* @param {any} [error] error * @param [error] error
* @returns {string} error message * @returns error message
*/ */
private getErrorMessage(statusMessage: string, remoteExceptionMessage?: string, error?: any): string { private getErrorMessage(statusMessage: string, remoteExceptionMessage?: string, error?: any): string {
statusMessage = statusMessage === '' ? undefined : statusMessage; statusMessage = statusMessage === '' ? undefined : statusMessage;
@@ -146,10 +142,10 @@ export class WebHDFS {
/** /**
* Parse error state from response and return valid Error object * Parse error state from response and return valid Error object
* *
* @param {request.Response} response response object * @param response response object
* @param {any} [responseBody] response body * @param [responseBody] response body
* @param {any} [error] error * @param [error] error
* @returns {HdfsError} HdfsError object * @returns HdfsError object
*/ */
private parseError(response: request.Response, responseBody?: any, error?: any): HdfsError { private parseError(response: request.Response, responseBody?: any, error?: any): HdfsError {
let statusMessage: string = this.getStatusMessage(response); let statusMessage: string = this.getStatusMessage(response);
@@ -165,8 +161,8 @@ export class WebHDFS {
/** /**
* Check if response is redirect * Check if response is redirect
* *
* @param {request.Response} response response object * @param response response object
* @returns {boolean} if response is redirect * @returns if response is redirect
*/ */
private isRedirect(response: request.Response): boolean { private isRedirect(response: request.Response): boolean {
return [301, 307].indexOf(response.statusCode) !== -1 && return [301, 307].indexOf(response.statusCode) !== -1 &&
@@ -176,8 +172,8 @@ export class WebHDFS {
/** /**
* Check if response is successful * Check if response is successful
* *
* @param {request.Response} response response object * @param response response object
* @returns {boolean} if response is successful * @returns if response is successful
*/ */
private isSuccess(response: request.Response): boolean { private isSuccess(response: request.Response): boolean {
return [200, 201].indexOf(response.statusCode) !== -1; return [200, 201].indexOf(response.statusCode) !== -1;
@@ -186,8 +182,8 @@ export class WebHDFS {
/** /**
* Check if response is error * Check if response is error
* *
* @param {request.Response} response response object * @param response response object
* @returns {boolean} if response is error * @returns if response is error
*/ */
private isError(response: request.Response): boolean { private isError(response: request.Response): boolean {
return [400, 401, 402, 403, 404, 500].indexOf(response.statusCode) !== -1; return [400, 401, 402, 403, 404, 500].indexOf(response.statusCode) !== -1;
@@ -196,10 +192,8 @@ export class WebHDFS {
/** /**
* Send a request to WebHDFS REST API * Send a request to WebHDFS REST API
* *
* @param {string} method HTTP method * @param method HTTP method
* @param {string} url * @param opts Options for request
* @param {object} opts Options for request
* @param {(error: HdfsError, response: request.Response) => void} callback
* @returns void * @returns void
*/ */
private sendRequest(method: string, url: string, opts: object, private sendRequest(method: string, url: string, opts: object,
@@ -234,10 +228,6 @@ export class WebHDFS {
/** /**
* Change file permissions * Change file permissions
*
* @param {string} path
* @param {string} mode
* @param {(error: HdfsError) => void} callback
* @returns void * @returns void
*/ */
public chmod(path: string, mode: string, callback: (error: HdfsError) => void): void { public chmod(path: string, mode: string, callback: (error: HdfsError) => void): void {
@@ -253,10 +243,8 @@ export class WebHDFS {
/** /**
* Change file owner * Change file owner
* *
* @param {string} path * @param userId User name
* @param {string} userId User name * @param groupId Group name
* @param {string} groupId Group name
* @param {(error: HdfsError) => void} callback
* @returns void * @returns void
*/ */
public chown(path: string, userId: string, groupId: string, callback: (error: HdfsError) => void): void { public chown(path: string, userId: string, groupId: string, callback: (error: HdfsError) => void): void {
@@ -279,8 +267,6 @@ export class WebHDFS {
/** /**
* Read directory contents * Read directory contents
* *
* @param {string} path
* @param {(error: HdfsError, files: any[]) => void)} callback
* @returns void * @returns void
*/ */
public readdir(path: string, callback: (error: HdfsError, files: any[]) => void): void { public readdir(path: string, callback: (error: HdfsError, files: any[]) => void): void {
@@ -305,10 +291,6 @@ export class WebHDFS {
/** /**
* Make new directory * Make new directory
*
* @param {string} path
* @param {string} [permission=0755]
* @param {(error: HdfsError) => void} callback
* @returns void * @returns void
*/ */
public mkdir(path: string, permission: string = '0755', callback: (error: HdfsError) => void): void { public mkdir(path: string, permission: string = '0755', callback: (error: HdfsError) => void): void {
@@ -327,10 +309,6 @@ export class WebHDFS {
/** /**
* Rename path * Rename path
*
* @param {string} path
* @param {string} destination
* @param {(error: HdfsError) => void} callback
* @returns void * @returns void
*/ */
public rename(path: string, destination: string, callback: (error: HdfsError) => void): void { public rename(path: string, destination: string, callback: (error: HdfsError) => void): void {
@@ -350,9 +328,6 @@ export class WebHDFS {
/** /**
* Get file status for given path * Get file status for given path
*
* @param {string} path
* @param {(error: HdfsError, fileStatus: any) => void} callback
* @returns void * @returns void
*/ */
public stat(path: string, callback: (error: HdfsError, fileStatus: any) => void): void { public stat(path: string, callback: (error: HdfsError, fileStatus: any) => void): void {
@@ -376,8 +351,6 @@ export class WebHDFS {
* Wraps stat method * Wraps stat method
* *
* @see WebHDFS.stat * @see WebHDFS.stat
* @param {string} path
* @param {(error: HdfsError, exists: boolean) => void} callback
* @returns void * @returns void
*/ */
public exists(path: string, callback: (error: HdfsError, exists: boolean) => void): void { public exists(path: string, callback: (error: HdfsError, exists: boolean) => void): void {
@@ -392,12 +365,7 @@ export class WebHDFS {
/** /**
* Write data to the file * Write data to the file
* *
* @param {string} path * @param append If set to true then append data to the file
* @param {string | Buffer} data
* @param {boolean} append If set to true then append data to the file
* @param {object} opts
* @param {(error: HdfsError) => void} callback
* @returns {fs.WriteStream}
*/ */
public writeFile(path: string, data: string | Buffer, append: boolean, opts: object, public writeFile(path: string, data: string | Buffer, append: boolean, opts: object,
callback: (error: HdfsError) => void): fs.WriteStream { callback: (error: HdfsError) => void): fs.WriteStream {
@@ -427,11 +395,6 @@ export class WebHDFS {
* Append data to the file * Append data to the file
* *
* @see writeFile * @see writeFile
* @param {string} path
* @param {string | Buffer} data
* @param {object} opts
* @param {(error: HdfsError) => void} callback
* @returns {fs.WriteStream}
*/ */
public appendFile(path: string, data: string | Buffer, opts: object, callback: (error: HdfsError) => void): fs.WriteStream { public appendFile(path: string, data: string | Buffer, opts: object, callback: (error: HdfsError) => void): fs.WriteStream {
return this.writeFile(path, data, true, opts, callback); return this.writeFile(path, data, true, opts, callback);
@@ -442,8 +405,6 @@ export class WebHDFS {
* *
* @fires Request#data * @fires Request#data
* @fires WebHDFS#finish * @fires WebHDFS#finish
* @param {path} path
* @param {(error: HdfsError, buffer: Buffer) => void} callback
* @returns void * @returns void
*/ */
public readFile(path: string, callback: (error: HdfsError, buffer: Buffer) => void): void { public readFile(path: string, callback: (error: HdfsError, buffer: Buffer) => void): void {
@@ -475,10 +436,7 @@ export class WebHDFS {
* Create writable stream for given path * Create writable stream for given path
* *
* @fires WebHDFS#finish * @fires WebHDFS#finish
* @param {string} path * @param [append] If set to true then append data to the file
* @param {boolean} [append] If set to true then append data to the file
* @param {object} [opts]
* @returns {fs.WriteStream}
* *
* @example * @example
* let hdfs = WebHDFS.createClient(); * let hdfs = WebHDFS.createClient();
@@ -593,9 +551,6 @@ export class WebHDFS {
* *
* @fires Request#data * @fires Request#data
* @fires WebHDFS#finish * @fires WebHDFS#finish
* @param {string} path
* @param {object} [opts]
* @returns {fs.ReadStream}
* *
* @example * @example
* let hdfs = WebHDFS.createClient(); * let hdfs = WebHDFS.createClient();
@@ -677,10 +632,6 @@ export class WebHDFS {
/** /**
* Create symbolic link to the destination path * Create symbolic link to the destination path
* *
* @param {string} src
* @param {string} destination
* @param {boolean} [createParent=false]
* @param {(error: HdfsError) => void} callback
* @returns void * @returns void
*/ */
public symlink(src: string, destination: string, createParent: boolean = false, callback: (error: HdfsError) => void): void { public symlink(src: string, destination: string, createParent: boolean = false, callback: (error: HdfsError) => void): void {
@@ -702,9 +653,6 @@ export class WebHDFS {
/** /**
* Unlink path * Unlink path
* *
* @param {string} path
* @param {boolean} [recursive=false]
* @param {(error: any) => void} callback
* @returns void * @returns void
*/ */
public unlink(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void { public unlink(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
@@ -720,9 +668,6 @@ export class WebHDFS {
/** /**
* @alias WebHDFS.unlink * @alias WebHDFS.unlink
* @param {string} path
* @param {boolean} [recursive=false]
* @param {(error: any) => void} callback
* @returns void * @returns void
*/ */
public rmdir(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void { public rmdir(path: string, recursive: boolean = false, callback: (error: HdfsError) => void): void {
+5 -3
View File
@@ -1,5 +1,7 @@
/*---------------------------------------------------------------------------------------------
'use strict'; * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import vscode = require('vscode'); import vscode = require('vscode');
@@ -56,7 +58,7 @@ export interface IPrompter {
/** /**
* Prompts for multiple questions * Prompts for multiple questions
* *
* @returns {[questionId: string]: T} Map of question IDs to results, or undefined if * @returns Map of question IDs to results, or undefined if
* the user canceled the question session * the user canceled the question session
*/ */
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>; prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
@@ -18,8 +18,7 @@ export class OpenSparkYarnHistoryTask {
async execute(sqlConnProfile: azdata.IConnectionProfile, isSpark: boolean): Promise<void> { async execute(sqlConnProfile: azdata.IConnectionProfile, isSpark: boolean): Promise<void> {
try { try {
let sqlClusterConnection = SqlClusterLookUp.findSqlClusterConnection(sqlConnProfile, this.appContext); let sqlClusterConnection = SqlClusterLookUp.findSqlClusterConnection(sqlConnProfile, this.appContext);
if (!sqlClusterConnection) if (!sqlClusterConnection) {
{
let name = isSpark ? 'Spark' : 'Yarn'; let name = isSpark ? 'Spark' : 'Yarn';
this.appContext.apiWrapper.showErrorMessage(`Please connect to the Spark cluster before View ${name} History.`); this.appContext.apiWrapper.showErrorMessage(`Please connect to the Spark cluster before View ${name} History.`);
return; return;
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as childProcess from 'child_process'; import * as childProcess from 'child_process';
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
@@ -170,7 +168,7 @@ export function getOSPlatform(): Platform {
} }
export function getOSPlatformId(): string { export function getOSPlatformId(): string {
var platformId = undefined; let platformId = undefined;
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
platformId = 'win-x64'; platformId = 'win-x64';
+1 -2
View File
@@ -123,8 +123,7 @@ function connToConnectionParam(connection: azdata.connection.Connection): Connec
return <ConnectionParam>result; return <ConnectionParam>result;
} }
class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo class ConnectionParam implements azdata.connection.Connection, azdata.IConnectionProfile, azdata.ConnectionInfo {
{
public connectionName: string; public connectionName: string;
public serverName: string; public serverName: string;
public databaseName: string; public databaseName: string;
-9
View File
@@ -3,7 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as opener from 'opener'; import * as opener from 'opener';
import TelemetryReporter from 'vscode-extension-telemetry'; import TelemetryReporter from 'vscode-extension-telemetry';
@@ -138,7 +137,6 @@ export class Telemetry {
/** /**
* Handle Language Service client errors * Handle Language Service client errors
* @class LanguageClientErrorHandler
*/ */
export class LanguageClientErrorHandler implements ErrorHandler { export class LanguageClientErrorHandler implements ErrorHandler {
@@ -160,11 +158,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
/** /**
* Callback for language service client error * Callback for language service client error
* *
* @param {Error} error
* @param {Message} message
* @param {number} count
* @returns {ErrorAction}
*
* @memberOf LanguageClientErrorHandler * @memberOf LanguageClientErrorHandler
*/ */
error(error: Error, message: Message, count: number): ErrorAction { error(error: Error, message: Message, count: number): ErrorAction {
@@ -178,8 +171,6 @@ export class LanguageClientErrorHandler implements ErrorHandler {
/** /**
* Callback for language service client closed * Callback for language service client closed
* *
* @returns {CloseAction}
*
* @memberOf LanguageClientErrorHandler * @memberOf LanguageClientErrorHandler
*/ */
closed(): CloseAction { closed(): CloseAction {
+1 -2
View File
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
@@ -163,7 +162,7 @@ export function generateGuid(): string {
} }
export function verifyPlatform(): Thenable<boolean> { export function verifyPlatform(): Thenable<boolean> {
if (os.platform() === 'darwin' && parseFloat(os.release()) < 16.0) { if (os.platform() === 'darwin' && parseFloat(os.release()) < 16) {
return Promise.resolve(false); return Promise.resolve(false);
} else { } else {
return Promise.resolve(true); return Promise.resolve(true);
@@ -3,17 +3,12 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
/** /**
* Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into * Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into
* this API from our code * this API from our code
*
* @export
* @class ApiWrapper
*/ */
export class ApiWrapper { export class ApiWrapper {
public createOutputChannel(name: string): vscode.OutputChannel { public createOutputChannel(name: string): vscode.OutputChannel {
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
// CONFIG VALUES /////////////////////////////////////////////////////////// // CONFIG VALUES ///////////////////////////////////////////////////////////
+3 -5
View File
@@ -4,8 +4,6 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
// This code is originally from https://github.com/Microsoft/vscode/blob/master/src/vs/base/node/ports.ts // This code is originally from https://github.com/Microsoft/vscode/blob/master/src/vs/base/node/ports.ts
'use strict';
import * as net from 'net'; import * as net from 'net';
export class StrictPortFindOptions { export class StrictPortFindOptions {
@@ -36,9 +34,9 @@ export async function strictFindFreePort(options: StrictPortFindOptions): Promis
/** /**
* Get a random integer between `min` and `max`. * Get a random integer between `min` and `max`.
* *
* @param {number} min - min number * @param min - min number
* @param {number} max - max number * @param max - max number
* @return {number} a random integer * @return a random integer
*/ */
function getRandomInt(min, max): number { function getRandomInt(min, max): number {
return Math.floor(Math.random() * (max - min + 1) + min); return Math.floor(Math.random() * (max - min + 1) + min);
+5 -2
View File
@@ -1,4 +1,7 @@
'use strict'; /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as childProcess from 'child_process'; import * as childProcess from 'child_process';
import * as fs from 'fs-extra'; import * as fs from 'fs-extra';
@@ -108,7 +111,7 @@ export function getOSPlatform(): Platform {
} }
export function getOSPlatformId(): string { export function getOSPlatformId(): string {
var platformId = undefined; let platformId = undefined;
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
platformId = 'win-x64'; platformId = 'win-x64';
+4 -4
View File
@@ -31,9 +31,9 @@ export function jsIndexToCharIndex(jsIdx: number, text: string): number {
for (let i = 0; i + 1 < text.length && i < jsIdx; i++) { for (let i = 0; i + 1 < text.length && i < jsIdx; i++) {
let charCode = text.charCodeAt(i); let charCode = text.charCodeAt(i);
// check for surrogate pair // check for surrogate pair
if (charCode >= 0xd800 && charCode <= 0xdbff) { if (charCode >= 0xD800 && charCode <= 0xDBFF) {
let nextCharCode = text.charCodeAt(i + 1); let nextCharCode = text.charCodeAt(i + 1);
if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) { if (nextCharCode >= 0xDC00 && nextCharCode <= 0xDFFF) {
charIdx--; charIdx--;
i++; i++;
} }
@@ -60,9 +60,9 @@ export function charCountToJsCountDiff(text: string): number {
for (let i = 0; i + 1 < text.length; i++) { for (let i = 0; i + 1 < text.length; i++) {
let charCode = text.charCodeAt(i); let charCode = text.charCodeAt(i);
// check for surrogate pair // check for surrogate pair
if (charCode >= 0xd800 && charCode <= 0xdbff) { if (charCode >= 0xD800 && charCode <= 0xDBFF) {
let nextCharCode = text.charCodeAt(i + 1); let nextCharCode = text.charCodeAt(i + 1);
if (nextCharCode >= 0xdc00 && nextCharCode <= 0xdfff) { if (nextCharCode >= 0xDC00 && nextCharCode <= 0xDFFF) {
diff++; diff++;
i++; i++;
} }
@@ -1,11 +1,8 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { nb } from 'azdata'; import { nb } from 'azdata';
import { Kernel, KernelMessage } from '@jupyterlab/services'; import { Kernel, KernelMessage } from '@jupyterlab/services';
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as UUID from 'vscode-languageclient/lib/utils/uuid'; import * as UUID from 'vscode-languageclient/lib/utils/uuid';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as path from 'path'; import * as path from 'path';
@@ -224,7 +222,6 @@ export class PerNotebookServerInstance implements IServerInstance {
/** /**
* Starts a Jupyter instance using the provided a start command. Server is determined to have * Starts a Jupyter instance using the provided a start command. Server is determined to have
* started when the log message with URL to connect to is emitted. * started when the log message with URL to connect to is emitted.
* @returns {Promise<void>}
*/ */
protected async startInternal(): Promise<void> { protected async startInternal(): Promise<void> {
if (this.isStarted) { if (this.isStarted) {
+5 -3
View File
@@ -1,5 +1,7 @@
/*---------------------------------------------------------------------------------------------
'use strict'; * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import vscode = require('vscode'); import vscode = require('vscode');
@@ -56,7 +58,7 @@ export interface IPrompter {
/** /**
* Prompts for multiple questions * Prompts for multiple questions
* *
* @returns {[questionId: string]: T} Map of question IDs to results, or undefined if * @returns Map of question IDs to results, or undefined if
* the user canceled the question session * the user canceled the question session
*/ */
prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>; prompt<T>(questions: IQuestion[], ignoreFocusOut?: boolean): Promise<{ [questionId: string]: any }>;
@@ -1,4 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
@@ -1,4 +1,3 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
@@ -3,16 +3,12 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as data from 'azdata'; import * as data from 'azdata';
/** /**
* Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into * Wrapper class to act as a facade over VSCode and Data APIs and allow us to test / mock callbacks into
* this API from our code * this API from our code
*
* @export
* @class ApiWrapper
*/ */
export class ApiWrapper { export class ApiWrapper {
// Data APIs // Data APIs
+1 -2
View File
@@ -10,8 +10,7 @@
"sourceMap": true, "sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node"
"declaration": true
}, },
"exclude": [ "exclude": [
"node_modules" "node_modules"
@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
@@ -1,57 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as Proto from '../protocol';
import { ITypeScriptServiceClient } from '../typescriptService';
import API from '../utils/api';
import { VersionDependentRegistration } from '../utils/dependentRegistration';
import * as typeConverters from '../utils/typeConverters';
class SmartSelection implements vscode.SelectionRangeProvider {
public static readonly minVersion = API.v350;
public constructor(
private readonly client: ITypeScriptServiceClient
) { }
public async provideSelectionRanges(
document: vscode.TextDocument,
positions: vscode.Position[],
token: vscode.CancellationToken,
): Promise<vscode.SelectionRange[] | undefined> {
const file = this.client.toOpenedFilePath(document);
if (!file) {
return undefined;
}
const args: Proto.FileRequestArgs & { locations: Proto.Location[] } = {
file,
locations: positions.map(typeConverters.Position.toLocation)
};
const response = await this.client.execute('selectionRange', args, token);
if (response.type !== 'response' || !response.body) {
return undefined;
}
return response.body.map(SmartSelection.convertSelectionRange);
}
private static convertSelectionRange(
selectionRange: Proto.SelectionRange
): vscode.SelectionRange {
return new vscode.SelectionRange(
typeConverters.Range.fromTextSpan(selectionRange.textSpan),
selectionRange.parent ? SmartSelection.convertSelectionRange(selectionRange.parent) : undefined,
);
}
}
export function register(
selector: vscode.DocumentSelector,
client: ITypeScriptServiceClient,
) {
return new VersionDependentRegistration(client, SmartSelection.minVersion, () =>
vscode.languages.registerSelectionRangeProvider(selector, new SmartSelection(client)));
}
@@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import 'mocha';
import * as vscode from 'vscode';
import { CURSOR, withRandomFileEditor } from './testUtils';
const onDocumentChange = (doc: vscode.TextDocument): Promise<vscode.TextDocument> => {
return new Promise<vscode.TextDocument>(resolve => {
const sub = vscode.workspace.onDidChangeTextDocument(e => {
if (e.document !== doc) {
return;
}
sub.dispose();
resolve(e.document);
});
});
};
const type = async (document: vscode.TextDocument, text: string): Promise<vscode.TextDocument> => {
const onChange = onDocumentChange(document);
await vscode.commands.executeCommand('type', { text });
await onChange;
return document;
};
suite('OnEnter', () => {
test('should indent after if block with braces', () => {
return withRandomFileEditor(`if (true) {${CURSOR}`, 'js', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `if (true) {\n x`);
});
});
test('should indent within empty object literal', () => {
return withRandomFileEditor(`({${CURSOR}})`, 'js', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `({\n x\n})`);
});
});
test('should indent after simple jsx tag with attributes', () => {
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
});
});
test('should indent after simple jsx tag with attributes', () => {
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(document.getText(), `const a = <div onclick={bla}>\n x`);
});
});
});
@@ -1,68 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as os from 'os';
import { join } from 'path';
function rndName() {
return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
}
export function createRandomFile(contents = '', fileExtension = 'txt'): Thenable<vscode.Uri> {
return new Promise((resolve, reject) => {
const tmpFile = join(os.tmpdir(), rndName() + '.' + fileExtension);
fs.writeFile(tmpFile, contents, (error) => {
if (error) {
return reject(error);
}
resolve(vscode.Uri.file(tmpFile));
});
});
}
export function deleteFile(file: vscode.Uri): Thenable<boolean> {
return new Promise((resolve, reject) => {
fs.unlink(file.fsPath, (err) => {
if (err) {
reject(err);
} else {
resolve(true);
}
});
});
}
export const CURSOR = '$$CURSOR$$';
export function withRandomFileEditor(
contents: string,
fileExtension: string,
run: (editor: vscode.TextEditor, doc: vscode.TextDocument) => Thenable<void>
): Thenable<boolean> {
const cursorIndex = contents.indexOf(CURSOR);
return createRandomFile(contents.replace(CURSOR, ''), fileExtension).then(file => {
return vscode.workspace.openTextDocument(file).then(doc => {
return vscode.window.showTextDocument(doc).then((editor) => {
if (cursorIndex >= 0) {
const pos = doc.positionAt(cursorIndex);
editor.selection = new vscode.Selection(pos, pos);
}
return run(editor, doc).then(_ => {
if (doc.isDirty) {
return doc.save().then(() => {
return deleteFile(file);
});
} else {
return deleteFile(file);
}
});
});
});
});
}
+1 -1
View File
@@ -7,7 +7,7 @@
'use strict'; 'use strict';
// @ts-ignore // @ts-ignore
const pkg = require('../package.json'); // const pkg = require('../package.json');
const path = require('path'); const path = require('path');
const os = require('os'); const os = require('os');
+44 -56
View File
@@ -60,8 +60,8 @@ declare module 'azdata' {
export namespace credentials { export namespace credentials {
/** /**
* Register a credential provider to handle credential requests. * Register a credential provider to handle credential requests.
* @param {CredentialProvider} provider The provider to register * @param provider The provider to register
* @return {Disposable} Handle to the provider for disposal * @return Handle to the provider for disposal
*/ */
export function registerProvider(provider: CredentialProvider): vscode.Disposable; export function registerProvider(provider: CredentialProvider): vscode.Disposable;
@@ -69,8 +69,8 @@ declare module 'azdata' {
* Retrieves a provider from the extension host if one has been registered. Any credentials * Retrieves a provider from the extension host if one has been registered. Any credentials
* accessed with the returned provider will have the namespaceId appended to credential ID * accessed with the returned provider will have the namespaceId appended to credential ID
* to prevent extensions from trampling over each others' credentials. * to prevent extensions from trampling over each others' credentials.
* @param {string} namespaceId ID that will be appended to credential IDs. * @param namespaceId ID that will be appended to credential IDs.
* @return {Thenable<CredentialProvider>} Promise that returns the namespaced provider * @return Promise that returns the namespaced provider
*/ */
export function getProvider(namespaceId: string): Thenable<CredentialProvider>; export function getProvider(namespaceId: string): Thenable<CredentialProvider>;
} }
@@ -98,14 +98,14 @@ declare module 'azdata' {
/** /**
* Get the credentials for an active connection * Get the credentials for an active connection
* @param {string} connectionId The id of the connection * @param connectionId The id of the connection
* @returns {{ [name: string]: string}} A dictionary containing the credentials as they would be included in the connection's options dictionary * @returns A dictionary containing the credentials as they would be included in the connection's options dictionary
*/ */
export function getCredentials(connectionId: string): Thenable<{ [name: string]: string }>; export function getCredentials(connectionId: string): Thenable<{ [name: string]: string }>;
/** /**
* Get ServerInfo for a connectionId * Get ServerInfo for a connectionId
* @param {string} connectionId The id of the connection * @param connectionId The id of the connection
* @returns ServerInfo * @returns ServerInfo
*/ */
export function getServerInfo(connectionId: string): Thenable<ServerInfo>; export function getServerInfo(connectionId: string): Thenable<ServerInfo>;
@@ -134,35 +134,35 @@ declare module 'azdata' {
* Get an Object Explorer node corresponding to the given connection and path. If no path * Get an Object Explorer node corresponding to the given connection and path. If no path
* is given, it returns the top-level node for the given connection. If there is no node at * is given, it returns the top-level node for the given connection. If there is no node at
* the given path, it returns undefined. * the given path, it returns undefined.
* @param {string} connectionId The id of the connection that the node exists on * @param connectionId The id of the connection that the node exists on
* @param {string?} nodePath The path of the node to get * @param nodePath The path of the node to get
* @returns {ObjectExplorerNode} The node corresponding to the given connection and path, * @returns The node corresponding to the given connection and path,
* or undefined if no such node exists. * or undefined if no such node exists.
*/ */
export function getNode(connectionId: string, nodePath?: string): Thenable<ObjectExplorerNode>; export function getNode(connectionId: string, nodePath?: string): Thenable<ObjectExplorerNode>;
/** /**
* Get all active Object Explorer connection nodes * Get all active Object Explorer connection nodes
* @returns {ObjectExplorerNode[]} The Object Explorer nodes for each saved connection * @returns The Object Explorer nodes for each saved connection
*/ */
export function getActiveConnectionNodes(): Thenable<ObjectExplorerNode[]>; export function getActiveConnectionNodes(): Thenable<ObjectExplorerNode[]>;
/** /**
* Find Object Explorer nodes that match the given information * Find Object Explorer nodes that match the given information
* @param {string} connectionId The id of the connection that the node exists on * @param connectionId The id of the connection that the node exists on
* @param {string} type The type of the object to retrieve * @param type The type of the object to retrieve
* @param {string} schema The schema of the object, if applicable * @param schema The schema of the object, if applicable
* @param {string} name The name of the object * @param name The name of the object
* @param {string} database The database the object exists under, if applicable * @param database The database the object exists under, if applicable
* @param {string[]} parentObjectNames A list of names of parent objects in the tree, ordered from highest to lowest level * @param parentObjectNames A list of names of parent objects in the tree, ordered from highest to lowest level
* (for example when searching for a table's column, provide the name of its parent table for this argument) * (for example when searching for a table's column, provide the name of its parent table for this argument)
*/ */
export function findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<ObjectExplorerNode[]>; export function findNodes(connectionId: string, type: string, schema: string, name: string, database: string, parentObjectNames: string[]): Thenable<ObjectExplorerNode[]>;
/** /**
* Get connectionProfile from sessionId * Get connectionProfile from sessionId
* *@param {string} sessionId The id of the session that the node exists on * @param sessionId The id of the session that the node exists on
* @returns {IConnectionProfile} The IConnecitonProfile for the session * @returns The IConnecitonProfile for the session
*/ */
export function getSessionConnectionProfile(sessionId: string): Thenable<IConnectionProfile>; export function getSessionConnectionProfile(sessionId: string): Thenable<IConnectionProfile>;
@@ -2047,11 +2047,7 @@ declare module 'azdata' {
* Launches a flyout dialog that will display the information on how to complete device * Launches a flyout dialog that will display the information on how to complete device
* code OAuth login to the user. Only one flyout can be opened at once and each must be closed * code OAuth login to the user. Only one flyout can be opened at once and each must be closed
* by calling {@link endAutoOAuthDeviceCode}. * by calling {@link endAutoOAuthDeviceCode}.
* @param {string} providerId ID of the provider that's requesting the flyout be opened * @param providerId ID of the provider that's requesting the flyout be opened
* @param {string} title
* @param {string} message
* @param {string} userCode
* @param {string} uri
*/ */
export function beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void>; export function beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void>;
@@ -2063,21 +2059,21 @@ declare module 'azdata' {
/** /**
* Notifies the account management service that an account has updated (usually due to the * Notifies the account management service that an account has updated (usually due to the
* account going stale). * account going stale).
* @param {Account} updatedAccount Account object with updated properties * @param updatedAccount Account object with updated properties
*/ */
export function accountUpdated(updatedAccount: Account): void; export function accountUpdated(updatedAccount: Account): void;
/** /**
* Gets all added accounts. * Gets all added accounts.
* @returns {Thenable<Account>} Promise to return the accounts * @returns Promise to return the accounts
*/ */
export function getAllAccounts(): Thenable<Account[]>; export function getAllAccounts(): Thenable<Account[]>;
/** /**
* Generates a security token by asking the account's provider * Generates a security token by asking the account's provider
* @param {Account} account Account to generate security token for (defaults to * @param account Account to generate security token for (defaults to
* AzureResource.ResourceManagement if not given) * AzureResource.ResourceManagement if not given)
* @return {Thenable<{}>} Promise to return the security token * @return Promise to return the security token
*/ */
export function getSecurityToken(account: Account, resource?: AzureResource): Thenable<{}>; export function getSecurityToken(account: Account, resource?: AzureResource): Thenable<{}>;
@@ -2211,16 +2207,16 @@ declare module 'azdata' {
export interface AccountProvider { export interface AccountProvider {
/** /**
* Initializes the account provider with the accounts restored from the memento, * Initializes the account provider with the accounts restored from the memento,
* @param {Account[]} storedAccounts Accounts restored from the memento * @param storedAccounts Accounts restored from the memento
* @return {Thenable<Account[]>} Account objects after being rehydrated (if necessary) * @return Account objects after being rehydrated (if necessary)
*/ */
initialize(storedAccounts: Account[]): Thenable<Account[]>; initialize(storedAccounts: Account[]): Thenable<Account[]>;
/** /**
* Generates a security token for the provided account * Generates a security token for the provided account
* @param {Account} account The account to generate a security token for * @param account The account to generate a security token for
* @param {AzureResource} resource The resource to get the token for * @param resource The resource to get the token for
* @return {Thenable<{}>} Promise to return a security token object * @return Promise to return a security token object
*/ */
getSecurityToken(account: Account, resource: AzureResource): Thenable<{}>; getSecurityToken(account: Account, resource: AzureResource): Thenable<{}>;
@@ -2444,7 +2440,6 @@ declare module 'azdata' {
/** /**
* Supports defining a model that can be instantiated as a view in the UI * Supports defining a model that can be instantiated as a view in the UI
* @export * @export
* @interface ModelBuilder
*/ */
export interface ModelBuilder { export interface ModelBuilder {
navContainer(): ContainerBuilder<NavContainer, any, any>; navContainer(): ContainerBuilder<NavContainer, any, any>;
@@ -2554,7 +2549,7 @@ declare module 'azdata' {
* Creates a collection of child components and adds them all to this container * Creates a collection of child components and adds them all to this container
* *
* @param formComponents the definitions * @param formComponents the definitions
* @param {*} [itemLayout] Optional layout for the child items * @param [itemLayout] Optional layout for the child items
*/ */
addFormItems(formComponents: Array<FormComponent | FormComponentGroup>, itemLayout?: FormItemLayout): void; addFormItems(formComponents: Array<FormComponent | FormComponentGroup>, itemLayout?: FormItemLayout): void;
@@ -2562,7 +2557,7 @@ declare module 'azdata' {
* Creates a child component and adds it to this container. * Creates a child component and adds it to this container.
* *
* @param formComponent the component to be added * @param formComponent the component to be added
* @param {*} [itemLayout] Optional layout for this child item * @param [itemLayout] Optional layout for this child item
*/ */
addFormItem(formComponent: FormComponent | FormComponentGroup, itemLayout?: FormItemLayout): void; addFormItem(formComponent: FormComponent | FormComponentGroup, itemLayout?: FormItemLayout): void;
@@ -2576,7 +2571,6 @@ declare module 'azdata' {
/** /**
* Removes a from item from the from * Removes a from item from the from
* @param formComponent
*/ */
removeFormItem(formComponent: FormComponent | FormComponentGroup): boolean; removeFormItem(formComponent: FormComponent | FormComponentGroup): boolean;
} }
@@ -2587,18 +2581,16 @@ declare module 'azdata' {
/** /**
* Sends any updated properties of the component to the UI * Sends any updated properties of the component to the UI
* *
* @returns {Thenable<void>} Thenable that completes once the update * @returns Thenable that completes once the update
* has been applied in the UI * has been applied in the UI
* @memberof Component
*/ */
updateProperties(properties: { [key: string]: any }): Thenable<void>; updateProperties(properties: { [key: string]: any }): Thenable<void>;
/** /**
* Sends an updated property of the component to the UI * Sends an updated property of the component to the UI
* *
* @returns {Thenable<void>} Thenable that completes once the update * @returns Thenable that completes once the update
* has been applied in the UI * has been applied in the UI
* @memberof Component
*/ */
updateProperty(key: string, value: any): Thenable<void>; updateProperty(key: string, value: any): Thenable<void>;
@@ -2665,7 +2657,7 @@ declare module 'azdata' {
* Creates a collection of child components and adds them all to this container * Creates a collection of child components and adds them all to this container
* *
* @param itemConfigs the definitions * @param itemConfigs the definitions
* @param {*} [itemLayout] Optional layout for the child items * @param [itemLayout] Optional layout for the child items
*/ */
addItems(itemConfigs: Array<Component>, itemLayout?: TItemLayout): void; addItems(itemConfigs: Array<Component>, itemLayout?: TItemLayout): void;
@@ -2673,8 +2665,8 @@ declare module 'azdata' {
* Creates a child component and adds it to this container. * Creates a child component and adds it to this container.
* Adding component to multiple containers is not supported * Adding component to multiple containers is not supported
* *
* @param {Component} component the component to be added * @param component the component to be added
* @param {*} [itemLayout] Optional layout for this child item * @param [itemLayout] Optional layout for this child item
*/ */
addItem(component: Component, itemLayout?: TItemLayout): void; addItem(component: Component, itemLayout?: TItemLayout): void;
@@ -2683,7 +2675,7 @@ declare module 'azdata' {
* Adding component to multiple containers is not supported * Adding component to multiple containers is not supported
* @param component the component to be added * @param component the component to be added
* @param index the index to insert the component to * @param index the index to insert the component to
* @param {*} [itemLayout] Optional layout for this child item * @param [itemLayout] Optional layout for this child item
*/ */
insertItem(component: Component, index: number, itemLayout?: TItemLayout): void; insertItem(component: Component, index: number, itemLayout?: TItemLayout): void;
@@ -2696,7 +2688,7 @@ declare module 'azdata' {
/** /**
* Defines the layout for this container * Defines the layout for this container
* *
* @param {TLayout} layout object * @param layout object
*/ */
setLayout(layout: TLayout): void; setLayout(layout: TLayout): void;
} }
@@ -3372,7 +3364,6 @@ declare module 'azdata' {
export namespace window { export namespace window {
/** /**
* creates a web view dialog * creates a web view dialog
* @param title
*/ */
export function createWebViewDialog(title: string): ModalDialog; export function createWebViewDialog(title: string): ModalDialog;
@@ -3736,14 +3727,14 @@ declare module 'azdata' {
/** /**
* Make connection for the query editor * Make connection for the query editor
* @param {string} fileUri file URI for the query editor * @param fileUri file URI for the query editor
* @param {string} connectionId connection ID * @param connectionId connection ID
*/ */
export function connect(fileUri: string, connectionId: string): Thenable<void>; export function connect(fileUri: string, connectionId: string): Thenable<void>;
/** /**
* Run query if it is a query editor and it is already opened. * Run query if it is a query editor and it is already opened.
* @param {string} fileUri file URI for the query editor * @param fileUri file URI for the query editor
*/ */
export function runQuery(fileUri: string, options?: Map<string, string>): void; export function runQuery(fileUri: string, options?: Map<string, string>): void;
@@ -3752,7 +3743,7 @@ declare module 'azdata' {
*/ */
export function registerQueryEventListener(listener: queryeditor.QueryEventListener): void; export function registerQueryEventListener(listener: queryeditor.QueryEventListener): void;
export function getQueryDocument(fileUri: string): queryeditor.QueryDocument export function getQueryDocument(fileUri: string): queryeditor.QueryDocument;
} }
/** /**
@@ -3944,8 +3935,8 @@ declare module 'azdata' {
export namespace connection { export namespace connection {
/** /**
* List the databases that can be accessed from the given connection * List the databases that can be accessed from the given connection
* @param {string} connectionId The ID of the connection * @param connectionId The ID of the connection
* @returns {string[]} An list of names of databases * @returns An list of names of databases
*/ */
export function listDatabases(connectionId: string): Thenable<string[]>; export function listDatabases(connectionId: string): Thenable<string[]>;
@@ -3960,7 +3951,6 @@ declare module 'azdata' {
/** /**
* Opens the connection dialog, calls the callback with the result. If connection was successful * Opens the connection dialog, calls the callback with the result. If connection was successful
* returns the connection otherwise returns undefined * returns the connection otherwise returns undefined
* @param callback
*/ */
export function openConnectionDialog(providers?: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: IConnectionCompletionOptions): Thenable<connection.Connection>; export function openConnectionDialog(providers?: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: IConnectionCompletionOptions): Thenable<connection.Connection>;
@@ -3974,8 +3964,6 @@ declare module 'azdata' {
export namespace nb { export namespace nb {
/** /**
* All notebook documents currently known to the system. * All notebook documents currently known to the system.
*
* @readonly
*/ */
export let notebookDocuments: NotebookDocument[]; export let notebookDocuments: NotebookDocument[];
@@ -107,7 +107,7 @@ export class Dropdown extends Disposable {
super(); super();
this._contextView = new ContextView(layoutService.container); this._contextView = new ContextView(layoutService.container);
this._options = opt || Object.create(null); this._options = opt || Object.create(null);
mixin(this._options, defaults, false) as IDropdownOptions; mixin(this._options, defaults, false);
this._el = DOM.append(container, DOM.$('.monaco-dropdown')); this._el = DOM.append(container, DOM.$('.monaco-dropdown'));
this._el.style.width = '100%'; this._el.style.width = '100%';
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.labelOnTopContainer { .labelOnTopContainer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1,9 +1,7 @@
/* /*---------------------------------------------------------------------------------------------
IMPORTANT: * Copyright (c) Microsoft Corporation. All rights reserved.
In order to preserve the uniform grid appearance, all cell styles need to have padding, margin and border sizes. * Licensed under the Source EULA. See License.txt in the project root for license information.
No built-in (selected, editable, highlight, flashing, invalid, loading, :focus) or user-specified CSS *--------------------------------------------------------------------------------------------*/
classes should alter those!
*/
.slick-header.ui-state-default, .slick-headerrow.ui-state-default, .slick-footerrow.ui-state-default { .slick-header.ui-state-default, .slick-headerrow.ui-state-default, .slick-footerrow.ui-state-default {
width: 100%; width: 100%;
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { mixin } from 'vs/base/common/objects'; import { mixin } from 'vs/base/common/objects';
const defaultOptions: ICellRangeSelectorOptions = { const defaultOptions: ICellRangeSelectorOptions = {
@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
.backup-path-list { .backup-path-list {
overflow-x: auto; overflow-x: auto;
} }
@@ -715,8 +715,8 @@ export class RestoreDialog extends Modal {
public dispose(): void { public dispose(): void {
super.dispose(); super.dispose();
for (var key in this._optionsMap) { for (let key in this._optionsMap) {
var widget: Widget = this._optionsMap[key]; let widget: Widget = this._optionsMap[key];
widget.dispose(); widget.dispose();
delete this._optionsMap[key]; delete this._optionsMap[key];
} }
@@ -3,7 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper'; import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper';
import * as types from 'vs/base/common/types'; import * as types from 'vs/base/common/types';
@@ -189,7 +188,7 @@ export class RestoreViewModel {
*/ */
public updateOptionWithPlanDetail(planDetails: { [key: string]: azdata.RestorePlanDetailInfo }): void { public updateOptionWithPlanDetail(planDetails: { [key: string]: azdata.RestorePlanDetailInfo }): void {
if (planDetails) { if (planDetails) {
for (var key in planDetails) { for (let key in planDetails) {
let optionElement = this._optionsMap[key]; let optionElement = this._optionsMap[key];
if (optionElement) { if (optionElement) {
let planDetailInfo = planDetails[key]; let planDetailInfo = planDetails[key];
@@ -219,7 +218,7 @@ export class RestoreViewModel {
this.defaultBackupFolder = configInfo['defaultBackupFolder']; this.defaultBackupFolder = configInfo['defaultBackupFolder'];
} }
for (var key in configInfo) { for (let key in configInfo) {
let optionElement = this._optionsMap[key]; let optionElement = this._optionsMap[key];
if (optionElement) { if (optionElement) {
let planDetailInfo = configInfo[key]; let planDetailInfo = configInfo[key];
@@ -258,7 +257,7 @@ export class RestoreViewModel {
this.updateLastBackupTaken(''); this.updateLastBackupTaken('');
this.databaseList = []; this.databaseList = [];
this.selectedBackupSets = null; this.selectedBackupSets = null;
for (var key in this._optionsMap) { for (let key in this._optionsMap) {
this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue); this._optionsMap[key].defaultValue = this.getDisplayValue(this._optionsMap[key].optionMetadata, this._optionsMap[key].optionMetadata.defaultValue);
this._optionsMap[key].currentValue = this._optionsMap[key].defaultValue; this._optionsMap[key].currentValue = this._optionsMap[key].defaultValue;
this._onSetRestoreOption.fire({ optionName: key, value: this._optionsMap[key].defaultValue, isReadOnly: false }); this._onSetRestoreOption.fire({ optionName: key, value: this._optionsMap[key].defaultValue, isReadOnly: false });
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.detailView-toggle .detailView-toggle
{ {
display: inline-block; display: inline-block;
@@ -96,7 +96,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
} }
protected _keybindingFor(action: IAction): ResolvedKeybinding { protected _keybindingFor(action: IAction): ResolvedKeybinding {
var [kb] = this._keybindingService.lookupKeybindings(action.id); let [kb] = this._keybindingService.lookupKeybindings(action.id);
return kb; return kb;
} }
+5
View File
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.model-card { .model-card {
position: relative; position: relative;
display: inline-block; display: inline-block;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.declarative-table { .declarative-table {
padding: 5px 30px 0px 30px; padding: 5px 30px 0px 30px;
@@ -5,9 +9,6 @@
border-collapse: collapse; border-collapse: collapse;
} }
.declarative-table-row {
}
.declarative-table-header { .declarative-table-header {
padding: 5px; padding: 5px;
border: 1px solid gray; border: 1px solid gray;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.divContainer { .divContainer {
display: block; display: block;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.flexContainer { .flexContainer {
display: flex; display: flex;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.form-table { .form-table {
display: table; display: table;
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.modelview-group-container { .modelview-group-container {
display: table; display: table;
+2 -5
View File
@@ -12,7 +12,6 @@ import { IDisposable } from 'vs/base/common/lifecycle';
* An instance of a model-backed component. This will be a UI element * An instance of a model-backed component. This will be a UI element
* *
* @export * @export
* @interface IComponent
*/ */
export interface IComponent extends IDisposable { export interface IComponent extends IDisposable {
descriptor: IComponentDescriptor; descriptor: IComponentDescriptor;
@@ -44,7 +43,6 @@ export interface IComponentConfig {
* world to the frontend UI; * world to the frontend UI;
* *
* @export * @export
* @interface IComponentDescriptor
*/ */
export interface IComponentDescriptor { export interface IComponentDescriptor {
/** /**
@@ -91,9 +89,8 @@ export interface IModelStore {
* Runs on a component immediately if the component exists, or runs on * Runs on a component immediately if the component exists, or runs on
* registration of the component otherwise * registration of the component otherwise
* *
* @param {string} componentId unique identifier of the component * @param componentId unique identifier of the component
* @param {(component: IComponent) => void} action some action to perform * @param action some action to perform
* @memberof IModelStore
*/ */
eventuallyRunOnComponent<T>(componentId: string, action: (component: IComponent) => T): Promise<T>; eventuallyRunOnComponent<T>(componentId: string, action: (component: IComponent) => T): Promise<T>;
/** /**
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.modelview-loadingComponent-container { .modelview-loadingComponent-container {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -1,21 +1,12 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { Registry } from 'vs/platform/registry/common/platform';
import * as azdata from 'azdata';
import { IModelStore, IComponentDescriptor, IComponent } from './interfaces'; import { IModelStore, IComponentDescriptor, IComponent } from './interfaces';
import { Extensions, IComponentRegistry } from 'sql/platform/dashboard/common/modelComponentRegistry';
import { Deferred } from 'sql/base/common/promise'; import { Deferred } from 'sql/base/common/promise';
import { entries } from 'sql/base/common/objects'; import { entries } from 'sql/base/common/objects';
const componentRegistry = <IComponentRegistry>Registry.as(Extensions.ComponentContribution);
class ComponentDescriptor implements IComponentDescriptor { class ComponentDescriptor implements IComponentDescriptor {
constructor(public readonly id: string, public readonly type: string) { constructor(public readonly id: string, public readonly type: string) {
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.modelview-radiobutton-container { .modelview-radiobutton-container {
align-items: flex-start; align-items: flex-start;
} }
@@ -5,7 +10,3 @@
.modelview-radiobutton-item { .modelview-radiobutton-item {
align-self: flex-start ; align-self: flex-start ;
} }
.modelview-radiobutton-title {
}
@@ -5,15 +5,14 @@
import 'vs/css!./flexContainer'; import 'vs/css!./flexContainer';
import { import {
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver, Component, Input, Inject, ChangeDetectorRef, forwardRef, ElementRef, OnDestroy,
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, QueryList,
} from '@angular/core'; } from '@angular/core';
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/parts/modelComponents/interfaces'; import { IComponent, IComponentDescriptor, IModelStore } from 'sql/parts/modelComponents/interfaces';
import { FlexItemLayout, SplitViewLayout } from 'azdata'; import { FlexItemLayout, SplitViewLayout } from 'azdata';
import { FlexItem } from './flexContainer.component'; import { FlexItem } from './flexContainer.component';
import { ContainerBase, ComponentBase } from 'sql/parts/modelComponents/componentBase'; import { ContainerBase, ComponentBase } from 'sql/parts/modelComponents/componentBase';
import { Event, Emitter } from 'vs/base/common/event'; import { Event } from 'vs/base/common/event';
import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview'; import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview';
class SplitPane implements IView { class SplitPane implements IView {
@@ -113,7 +112,7 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
if (this._componentWrappers) { if (this._componentWrappers) {
this._componentWrappers.forEach(item => { this._componentWrappers.forEach(item => {
var component = item.modelStore.getComponent(item.descriptor.id); let component = item.modelStore.getComponent(item.descriptor.id);
item.modelStore.validate(component).then(value => { item.modelStore.validate(component).then(value => {
if (value === true) { if (value === true) {
let view = this.GetCorrespondingView(component, this._orientation); let view = this.GetCorrespondingView(component, this._orientation);
@@ -1,3 +1,8 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.tree-component-node-tile { .tree-component-node-tile {
display: flex; display: flex;
} }
+1 -2
View File
@@ -1,9 +1,8 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { ChangeDetectorRef } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
.profiler-filter-dialog { .profiler-filter-dialog {
height: 300px; height: 300px;
padding: 10px; padding: 10px;
@@ -263,7 +263,7 @@ export class ProfilerFilterDialog extends Modal {
case NotStartsWith: case NotStartsWith:
return ProfilerFilterClauseOperator.NotStartsWith; return ProfilerFilterClauseOperator.NotStartsWith;
default: default:
throw `Not a valid operator: ${operator}`; throw new Error(`Not a valid operator: ${operator}`);
} }
} }
@@ -294,7 +294,7 @@ export class ProfilerFilterDialog extends Modal {
case ProfilerFilterClauseOperator.NotStartsWith: case ProfilerFilterClauseOperator.NotStartsWith:
return NotStartsWith; return NotStartsWith;
default: default:
throw `Not a valid operator: ${operator}`; throw new Error(`Not a valid operator: ${operator}`);
} }
} }
} }
@@ -27,8 +27,8 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
let expectedValueString: string = expectedValue === undefined ? undefined : expectedValue.toLocaleLowerCase(); let expectedValueString: string = expectedValue === undefined ? undefined : expectedValue.toLocaleLowerCase();
let actualValueDate = new Date(actualValue).valueOf(); let actualValueDate = new Date(actualValue).valueOf();
let expectedValueDate = new Date(expectedValue).valueOf(); let expectedValueDate = new Date(expectedValue).valueOf();
let actualValueNumber = new Number(actualValue).valueOf(); let actualValueNumber = Number(actualValue).valueOf();
let expectedValueNumber = new Number(expectedValue).valueOf(); let expectedValueNumber = Number(expectedValue).valueOf();
if (isValidNumber(actualValue) && isValidNumber(expectedValue)) { if (isValidNumber(actualValue) && isValidNumber(expectedValue)) {
actualValue = actualValueNumber; actualValue = actualValueNumber;
@@ -79,7 +79,7 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
match = !actualValueString || !actualValueString.startsWith(expectedValueString); match = !actualValueString || !actualValueString.startsWith(expectedValueString);
break; break;
default: default:
throw `Not a valid operator: ${clause.operator}`; throw new Error(`Not a valid operator: ${clause.operator}`);
} }
} }
@@ -93,7 +93,7 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
} }
function isValidNumber(value: string): boolean { function isValidNumber(value: string): boolean {
let num = new Number(value); let num = Number(value);
return value !== undefined && !isNaN(num.valueOf()) && value.replace(' ', '') !== ''; return value !== undefined && !isNaN(num.valueOf()) && value.replace(' ', '') !== '';
} }
+1 -5
View File
@@ -1,11 +1,8 @@
/*--------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { Action } from 'vs/base/common/actions'; import { Action } from 'vs/base/common/actions';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -150,8 +147,7 @@ export class CopyAllMessagesAction extends Action {
constructor( constructor(
private tree: ITree, private tree: ITree,
@IClipboardService private clipboardService: IClipboardService) @IClipboardService private clipboardService: IClipboardService) {
{
super(CopyAllMessagesAction.ID, CopyAllMessagesAction.LABEL); super(CopyAllMessagesAction.ID, CopyAllMessagesAction.LABEL);
} }
@@ -3,14 +3,11 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { IPanelTab } from 'sql/base/browser/ui/panel/panel'; import { IPanelTab } from 'sql/base/browser/ui/panel/panel';
import { ChartView } from './chartView'; import { ChartView } from './chartView';
import QueryRunner from 'sql/platform/query/common/queryRunner'; import QueryRunner from 'sql/platform/query/common/queryRunner';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { generateUuid } from 'vs/base/common/uuid';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class ChartTab implements IPanelTab { export class ChartTab implements IPanelTab {
@@ -3,8 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { Chart as ChartJs } from 'chart.js'; import { Chart as ChartJs } from 'chart.js';
import { mixin } from 'sql/base/common/objects'; import { mixin } from 'sql/base/common/objects';
@@ -303,7 +301,7 @@ export class Graph implements IInsight {
* color functionality * color functionality
*/ */
const defaultColors = [ const defaultColors: Array<Color> = [
[255, 99, 132], [255, 99, 132],
[54, 162, 235], [54, 162, 235],
[255, 206, 86], [255, 206, 86],
@@ -318,42 +316,71 @@ const defaultColors = [
[77, 83, 96] [77, 83, 96]
]; ];
type Color = [number, number, number];
function rgba(colour, alpha) { interface ILineColor {
backgroundColor: string;
borderColor: string;
pointBackgroundColor: string;
pointBorderColor: string;
pointHoverBackgroundColor: string;
pointHoverBorderColor: string;
}
interface IBarColor {
backgroundColor: string;
borderColor: string;
hoverBackgroundColor: string;
hoverBorderColor: string;
}
interface IPieColors {
backgroundColor: Array<string>;
borderColor: Array<string>;
pointBackgroundColor: Array<string>;
pointBorderColor: Array<string>;
pointHoverBackgroundColor: Array<string>;
pointHoverBorderColor: Array<string>;
}
interface IPolarAreaColors {
backgroundColor: Array<string>;
borderColor: Array<string>;
hoverBackgroundColor: Array<string>;
hoverBorderColor: Array<string>;
}
function rgba(colour: Color, alpha: number): string {
return 'rgba(' + colour.concat(alpha).join(',') + ')'; return 'rgba(' + colour.concat(alpha).join(',') + ')';
} }
function getRandomInt(min, max) { function getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min; return Math.floor(Math.random() * (max - min + 1)) + min;
} }
function getRandomColor() { function getRandomColor(): Color {
return [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)]; return [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];
} }
/** /**
* Generate colors for line|bar charts * Generate colors for line|bar charts
* @param index
* @returns {number[]|Color}
*/ */
function generateColor(index) { function generateColor(index: number): Color {
return defaultColors[index] || getRandomColor(); return defaultColors[index] || getRandomColor();
} }
/** /**
* Generate colors for pie|doughnut charts * Generate colors for pie|doughnut charts
* @param count
* @returns {Colors}
*/ */
function generateColors(count) { function generateColors(count: number): Array<Color> {
var colorsArr = new Array(count); const colorsArr = new Array(count);
for (var i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
colorsArr[i] = defaultColors[i] || getRandomColor(); colorsArr[i] = defaultColors[i] || getRandomColor();
} }
return colorsArr; return colorsArr;
} }
function formatLineColor(colors) { function formatLineColor(colors: Color): ILineColor {
return { return {
backgroundColor: rgba(colors, 0.4), backgroundColor: rgba(colors, 0.4),
borderColor: rgba(colors, 1), borderColor: rgba(colors, 1),
@@ -364,7 +391,7 @@ function formatLineColor(colors) {
}; };
} }
function formatBarColor(colors) { function formatBarColor(colors: Color): IBarColor {
return { return {
backgroundColor: rgba(colors, 0.6), backgroundColor: rgba(colors, 0.6),
borderColor: rgba(colors, 1), borderColor: rgba(colors, 1),
@@ -373,34 +400,30 @@ function formatBarColor(colors) {
}; };
} }
function formatPieColors(colors) { function formatPieColors(colors: Array<Color>): IPieColors {
return { return {
backgroundColor: colors.map(function (color) { return rgba(color, 0.6); }), backgroundColor: colors.map(color => rgba(color, 0.6)),
borderColor: colors.map(function () { return '#fff'; }), borderColor: colors.map(() => '#fff'),
pointBackgroundColor: colors.map(function (color) { return rgba(color, 1); }), pointBackgroundColor: colors.map(color => rgba(color, 1)),
pointBorderColor: colors.map(function () { return '#fff'; }), pointBorderColor: colors.map(() => '#fff'),
pointHoverBackgroundColor: colors.map(function (color) { return rgba(color, 1); }), pointHoverBackgroundColor: colors.map(color => rgba(color, 1)),
pointHoverBorderColor: colors.map(function (color) { return rgba(color, 1); }) pointHoverBorderColor: colors.map(color => rgba(color, 1))
}; };
} }
function formatPolarAreaColors(colors) { function formatPolarAreaColors(colors: Array<Color>): IPolarAreaColors {
return { return {
backgroundColor: colors.map(function (color) { return rgba(color, 0.6); }), backgroundColor: colors.map(color => rgba(color, 0.6)),
borderColor: colors.map(function (color) { return rgba(color, 1); }), borderColor: colors.map(color => rgba(color, 1)),
hoverBackgroundColor: colors.map(function (color) { return rgba(color, 0.8); }), hoverBackgroundColor: colors.map(color => rgba(color, 0.8)),
hoverBorderColor: colors.map(function (color) { return rgba(color, 1); }) hoverBorderColor: colors.map(color => rgba(color, 1))
}; };
} }
/** /**
* Generate colors by chart type * Generate colors by chart type
* @param chartType
* @param index
* @param count
* @returns {Color}
*/ */
function getColors(chartType, index, count) { function getColors(chartType: string, index: number, count: number): Color | ILineColor | IBarColor | IPieColors | IPolarAreaColors {
if (chartType === 'pie' || chartType === 'doughnut') { if (chartType === 'pie' || chartType === 'doughnut') {
return formatPieColors(generateColors(count)); return formatPieColors(generateColors(count));
} }
@@ -3,7 +3,6 @@
* 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.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict';
import { Dimension } from 'vs/base/browser/dom'; import { Dimension } from 'vs/base/browser/dom';
import { IInsightData } from 'sql/workbench/parts/dashboard/widgets/insights/interfaces'; import { IInsightData } from 'sql/workbench/parts/dashboard/widgets/insights/interfaces';
@@ -1,3 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Disable repl hover highlight in tree. */ /* Disable repl hover highlight in tree. */
.monaco-workbench .message-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row:hover:not(.highlighted):not(.selected):not(.focused) { .monaco-workbench .message-tree .monaco-tree .monaco-tree-rows > .monaco-tree-row:hover:not(.highlighted):not(.selected):not(.focused) {

Some files were not shown because too many files have changed in this diff Show More