From 9c11195be33aa53884a5f80fd614ba25e4f09cca Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com> Date: Mon, 8 Jul 2019 13:54:49 -0700 Subject: [PATCH 1/7] Fix experiments hash parsing (#6492) * Simplify & fix crypto.createHash * Add tests * Fix python test in news folder (#6398) * Fix broken python tests in news * Revert changes --- news/test_announce.py | 3 ++- src/client/common/crypto.ts | 8 +++---- src/client/common/experiments.ts | 2 +- src/client/common/types.ts | 4 +--- src/test/common/crypto.unit.test.ts | 30 ++++++++++++++++++++++-- src/test/common/experiments.unit.test.ts | 6 ++--- 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/news/test_announce.py b/news/test_announce.py index 54233e30115f..acc125a7c360 100644 --- a/news/test_announce.py +++ b/news/test_announce.py @@ -187,7 +187,8 @@ def fake_git_rm(path): def test_complete_news(): version = "2019.3.0" - date = datetime.date.today().strftime("%d %B %Y") + # Remove leading `0`. + date = datetime.date.today().strftime("%d %B %Y").lstrip("0") news = ann.complete_news(version, NEW_NEWS, f"{TITLE}\n\n\n{OLD_NEWS}") expected = f"{TITLE}\n\n## {version} ({date})\n\n{NEW_NEWS.strip()}\n\n\n{OLD_NEWS.strip()}" assert news == expected diff --git a/src/client/common/crypto.ts b/src/client/common/crypto.ts index c25ea6cdc089..1d599737d46e 100644 --- a/src/client/common/crypto.ts +++ b/src/client/common/crypto.ts @@ -4,7 +4,7 @@ // tslint:disable: no-any -import { createHash, HexBase64Latin1Encoding } from 'crypto'; +import { createHash } from 'crypto'; import { injectable } from 'inversify'; import { ICryptoUtils, IHashFormat } from './types'; @@ -13,8 +13,8 @@ import { ICryptoUtils, IHashFormat } from './types'; */ @injectable() export class CryptoUtils implements ICryptoUtils { - public createHash(data: string, encoding: HexBase64Latin1Encoding, hashFormat: E): IHashFormat[E] { - const hash = createHash('sha512').update(data).digest(encoding); - return hashFormat === 'number' ? parseInt(hash, undefined) : hash as any; + public createHash(data: string, hashFormat: E): IHashFormat[E] { + const hash = createHash('sha512').update(data).digest('hex'); + return hashFormat === 'number' ? parseInt(hash, 16) : hash as any; } } diff --git a/src/client/common/experiments.ts b/src/client/common/experiments.ts index 4960dc96ff41..eb922edb0ddb 100644 --- a/src/client/common/experiments.ts +++ b/src/client/common/experiments.ts @@ -150,7 +150,7 @@ export class ExperimentsManager implements IExperimentsManager { if (typeof (this.appEnvironment.machineId) !== 'string') { throw new Error('Machine ID should be a string'); } - const hash = this.crypto.createHash(`${this.appEnvironment.machineId}+${salt}`, 'hex', 'number'); + const hash = this.crypto.createHash(`${this.appEnvironment.machineId}+${salt}`, 'number'); return hash % 100 >= min && hash % 100 < max; } diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 8d35997b6670..145395af7ee8 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -2,7 +2,6 @@ // Licensed under the MIT License. 'use strict'; -import { HexBase64Latin1Encoding } from 'crypto'; import { Socket } from 'net'; import { Request as RequestResult } from 'request'; import { ConfigurationTarget, DiagnosticSeverity, Disposable, DocumentSymbolProvider, Event, Extension, ExtensionContext, OutputChannel, Uri, WorkspaceEdit } from 'vscode'; @@ -439,10 +438,9 @@ export interface ICryptoUtils { * Creates hash using the data and encoding specified * @returns hash as number, or string * @param data The string to hash - * @param encoding Data encoding to use * @param hashFormat Return format of the hash, number or string */ - createHash(data: string, encoding: HexBase64Latin1Encoding, hashFormat: E): IHashFormat[E]; + createHash(data: string, hashFormat: E): IHashFormat[E]; } export const IAsyncDisposableRegistry = Symbol('IAsyncDisposableRegistry'); diff --git a/src/test/common/crypto.unit.test.ts b/src/test/common/crypto.unit.test.ts index a7274f3900af..6dfef4737eef 100644 --- a/src/test/common/crypto.unit.test.ts +++ b/src/test/common/crypto.unit.test.ts @@ -12,11 +12,37 @@ suite('Crypto Utils', async () => { crypto = new CryptoUtils(); }); test('If hashFormat equals `number`, method createHash() returns a number', async () => { - const hash = crypto.createHash('blabla', 'hex', 'number'); + const hash = crypto.createHash('blabla', 'number'); assert.typeOf(hash, 'number', 'Type should be a number'); }); test('If hashFormat equals `string`, method createHash() returns a string', async () => { - const hash = crypto.createHash('blabla', 'hex', 'string'); + const hash = crypto.createHash('blabla', 'string'); assert.typeOf(hash, 'string', 'Type should be a string'); }); + test('If hashFormat equals `number`, the hash should not be NaN', async () => { + let hash = crypto.createHash('test', 'number'); + assert.isNotNaN(hash, 'Number hash should not be NaN'); + hash = crypto.createHash('hash', 'number'); + assert.isNotNaN(hash, 'Number hash should not be NaN'); + hash = crypto.createHash('HASH1', 'number'); + assert.isNotNaN(hash, 'Number hash should not be NaN'); + }); + test('If hashFormat equals `string`, the hash should not be undefined', async () => { + let hash = crypto.createHash('test', 'string'); + assert.isDefined(hash, 'String hash should not be undefined'); + hash = crypto.createHash('hash', 'string'); + assert.isDefined(hash, 'String hash should not be undefined'); + hash = crypto.createHash('HASH1', 'string'); + assert.isDefined(hash, 'String hash should not be undefined'); + }); + test('If hashFormat equals `number`, hashes with different data should return different number hashes', async () => { + const hash1 = crypto.createHash('hash1', 'number'); + const hash2 = crypto.createHash('hash2', 'number'); + assert.notEqual(hash1, hash2, 'Hashes should be different numbers'); + }); + test('If hashFormat equals `string`, hashes with different data should return different string hashes', async () => { + const hash1 = crypto.createHash('hash1', 'string'); + const hash2 = crypto.createHash('hash2', 'string'); + assert.notEqual(hash1, hash2, 'Hashes should be different strings'); + }); }); diff --git a/src/test/common/experiments.unit.test.ts b/src/test/common/experiments.unit.test.ts index 82cf97bce3e7..0dd97a433b8a 100644 --- a/src/test/common/experiments.unit.test.ts +++ b/src/test/common/experiments.unit.test.ts @@ -588,10 +588,10 @@ suite('A/B experiments', () => { expect(() => expManager.isUserInRange(79, 94, 'salt')).to.throw(); } else if (testParams.error) { const error = new Error('Kaboom'); - when(crypto.createHash(anything(), 'hex', 'number')).thenThrow(error); + when(crypto.createHash(anything(), 'number')).thenThrow(error); expect(() => expManager.isUserInRange(79, 94, 'salt')).to.throw(error); } else { - when(crypto.createHash(anything(), 'hex', 'number')).thenReturn(testParams.hash); + when(crypto.createHash(anything(), 'number')).thenReturn(testParams.hash); expect(expManager.isUserInRange(79, 94, 'salt')).to.equal(testParams.expectedResult, 'Incorrectly identified'); } }); @@ -625,7 +625,7 @@ suite('A/B experiments', () => { .returns(() => testParams.experimentStorageValue); when(appEnvironment.machineId).thenReturn('101'); if (testParams.hash) { - when(crypto.createHash(anything(), 'hex', 'number')).thenReturn(testParams.hash); + when(crypto.createHash(anything(), 'number')).thenReturn(testParams.hash); } expManager.populateUserExperiments(); assert.deepEqual(expManager.userExperiments, testParams.expectedResult); From fd33223a44734fb2035c81e4b8d59cf76a692db0 Mon Sep 17 00:00:00 2001 From: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com> Date: Tue, 9 Jul 2019 14:20:53 -0700 Subject: [PATCH 2/7] Release cherry pick (#6515) * Enable experiment for always displaying the test explorer (#6330) * Add logging --- experiments.json | 15 ++++++++++++++- src/client/common/crypto.ts | 10 +++++++++- src/client/common/experimentGroups.ts | 2 +- src/client/testing/main.ts | 2 +- src/test/testing/main.unit.test.ts | 8 ++++---- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/experiments.json b/experiments.json index 60b0742537a3..69bfb177fd1d 100644 --- a/experiments.json +++ b/experiments.json @@ -1 +1,14 @@ -[] +[ + { + "name": "AlwaysDisplayTestExplorer - experiment", + "salt": "AlwaysDisplayTestExplorer", + "min": 80, + "max": 100 + }, + { + "name": "AlwaysDisplayTestExplorer - control", + "salt": "AlwaysDisplayTestExplorer", + "min": 0, + "max": 20 + } +] diff --git a/src/client/common/crypto.ts b/src/client/common/crypto.ts index 1d599737d46e..c0115ddf8b9f 100644 --- a/src/client/common/crypto.ts +++ b/src/client/common/crypto.ts @@ -6,6 +6,7 @@ import { createHash } from 'crypto'; import { injectable } from 'inversify'; +import { traceError } from './logger'; import { ICryptoUtils, IHashFormat } from './types'; /** @@ -15,6 +16,13 @@ import { ICryptoUtils, IHashFormat } from './types'; export class CryptoUtils implements ICryptoUtils { public createHash(data: string, hashFormat: E): IHashFormat[E] { const hash = createHash('sha512').update(data).digest('hex'); - return hashFormat === 'number' ? parseInt(hash, 16) : hash as any; + if (hashFormat === 'number') { + const result = parseInt(hash, 16); + if (isNaN(result)) { + traceError(`Number hash for data '${data}' is NaN`); + } + return result as any; + } + return hash as any; } } diff --git a/src/client/common/experimentGroups.ts b/src/client/common/experimentGroups.ts index 104d0ead8e78..3df5140f537c 100644 --- a/src/client/common/experimentGroups.ts +++ b/src/client/common/experimentGroups.ts @@ -4,5 +4,5 @@ export const LSEnabled = 'LS - enabled'; // Experiment to check whether to always display the test explorer. export enum AlwaysDisplayTestExplorerGroups { control = 'AlwaysDisplayTestExplorer - control', - enabled = 'AlwaysDisplayTestExplorer - enabled' + experiment = 'AlwaysDisplayTestExplorer - experiment' } diff --git a/src/client/testing/main.ts b/src/client/testing/main.ts index 7d495cd3d1f3..fc71ecaa22a1 100644 --- a/src/client/testing/main.ts +++ b/src/client/testing/main.ts @@ -74,7 +74,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos } public checkExperiments() { const experiments = this.serviceContainer.get(IExperimentsManager); - if (experiments.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)) { + if (experiments.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)) { const commandManager = this.serviceContainer.get(ICommandManager); commandManager.executeCommand('setContext', 'testsDiscovered', true).then(noop, noop); } else { diff --git a/src/test/testing/main.unit.test.ts b/src/test/testing/main.unit.test.ts index ea28b9830bd8..7f38e6ad6b72 100644 --- a/src/test/testing/main.unit.test.ts +++ b/src/test/testing/main.unit.test.ts @@ -47,22 +47,22 @@ suite('Unit Tests - ManagementService', () => { }); test('Execute command if in experiment', async () => { - when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).thenReturn(true); + when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).thenReturn(true); await testManagementService.activate(instance(mock(JediSymbolProvider))); verify(commandManager.executeCommand('setContext', 'testsDiscovered', true)).once(); - verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).once(); + verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).once(); verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.control)).never(); verify(experiment.sendTelemetryIfInExperiment(anything())).never(); }); test('If not in experiment, check and send Telemetry for control group and do not execute command', async () => { - when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).thenReturn(false); + when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).thenReturn(false); await testManagementService.activate(instance(mock(JediSymbolProvider))); verify(commandManager.executeCommand('setContext', 'testsDiscovered', anything())).never(); - verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).once(); + verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).once(); verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.control)).never(); verify(experiment.sendTelemetryIfInExperiment(AlwaysDisplayTestExplorerGroups.control)).once(); }); From d6f1835ecddcf5b4506899e6e1907bc2aee1d6aa Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Tue, 9 Jul 2019 14:51:39 -0700 Subject: [PATCH 3/7] Point release - Updated package.json and CHANGELOG (#6516) --- CHANGELOG.md | 7 +++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e125e5033b62..04bd2ee7d95d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2019.6.1 (9 July 2019) + +### Fixes + +1. Fixes to A/B testing. + ([#6400](https://github.com/microsoft/vscode-python/issues/6400)) + ## 2019.6.0 (25 June 2019) ### Enhancements diff --git a/package-lock.json b/package-lock.json index feac52a1ec3c..169ef5a4d52a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "python", - "version": "2019.6.0", + "version": "2019.6.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 70eaee5a3052..1f4dd24fcdb7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "python", "displayName": "Python", "description": "Linting, Debugging (multi-threaded, remote), Intellisense, code formatting, refactoring, unit tests, snippets, and more.", - "version": "2019.6.0", + "version": "2019.6.1", "languageServerVersion": "0.2.82", "publisher": "ms-python", "author": { From 756c8af858eac4729767e9e2d51e30c3f5f21725 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 31 Jul 2019 09:15:39 -0700 Subject: [PATCH 4/7] Cherry pick change from master --- news/2 Fixes/6748.md | 1 + .../languageServer/analysisOptions.ts | 48 ++++++++++++++++--- src/client/constants.ts | 3 ++ .../intellisense/baseIntellisenseProvider.ts | 3 +- .../dotNetIntellisenseProvider.ts | 18 +++---- 5 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 news/2 Fixes/6748.md diff --git a/news/2 Fixes/6748.md b/news/2 Fixes/6748.md new file mode 100644 index 000000000000..16e36112cefa --- /dev/null +++ b/news/2 Fixes/6748.md @@ -0,0 +1 @@ +Eliminate 'History_\' from the problems list when using the interactive panel. diff --git a/src/client/activation/languageServer/analysisOptions.ts b/src/client/activation/languageServer/analysisOptions.ts index 436f14bbc266..8173fbe56b80 100644 --- a/src/client/activation/languageServer/analysisOptions.ts +++ b/src/client/activation/languageServer/analysisOptions.ts @@ -1,16 +1,43 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - 'use strict'; - import { inject, injectable, named } from 'inversify'; import * as path from 'path'; -import { CancellationToken, CompletionContext, ConfigurationChangeEvent, Disposable, Event, EventEmitter, OutputChannel, Position, TextDocument, WorkspaceFolder } from 'vscode'; -import { DocumentFilter, DocumentSelector, LanguageClientOptions, ProvideCompletionItemsSignature, RevealOutputChannelOn } from 'vscode-languageclient'; +import { + CancellationToken, + CompletionContext, + ConfigurationChangeEvent, + Diagnostic, + Disposable, + Event, + EventEmitter, + OutputChannel, + Position, + TextDocument, + Uri, + WorkspaceFolder +} from 'vscode'; +import { + DocumentFilter, + DocumentSelector, + HandleDiagnosticsSignature, + LanguageClientOptions, + ProvideCompletionItemsSignature, + RevealOutputChannelOn +} from 'vscode-languageclient'; + import { IWorkspaceService } from '../../common/application/types'; -import { isTestExecution, PYTHON_LANGUAGE, STANDARD_OUTPUT_CHANNEL } from '../../common/constants'; +import { HiddenFilePrefix, isTestExecution, PYTHON_LANGUAGE, STANDARD_OUTPUT_CHANNEL } from '../../common/constants'; import { traceDecorators, traceError } from '../../common/logger'; -import { BANNER_NAME_LS_SURVEY, IConfigurationService, IExtensionContext, IOutputChannel, IPathUtils, IPythonExtensionBanner, Resource } from '../../common/types'; +import { + BANNER_NAME_LS_SURVEY, + IConfigurationService, + IExtensionContext, + IOutputChannel, + IPathUtils, + IPythonExtensionBanner, + Resource +} from '../../common/types'; import { debounceSync } from '../../common/utils/decorators'; import { IEnvironmentVariablesProvider } from '../../common/variables/types'; import { IInterpreterService } from '../../interpreter/contracts'; @@ -88,6 +115,7 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt } } + // tslint:disable-next-line: no-suspicious-comment // TODO: remove this setting since LS 0.2.92+ is not using it. // tslint:disable-next-line:no-string-literal properties['DatabasePath'] = path.join(this.context.extensionPath, this.languageServerFolder); @@ -139,6 +167,14 @@ export class LanguageServerAnalysisOptions implements ILanguageServerAnalysisOpt provideCompletionItem: (document: TextDocument, position: Position, context: CompletionContext, token: CancellationToken, next: ProvideCompletionItemsSignature) => { this.surveyBanner.showBanner().ignoreErrors(); return next(document, position, context, token); + }, + handleDiagnostics: (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => { + // Skip sending if this is a special file. + const filePath = uri.fsPath; + const baseName = filePath ? path.basename(filePath) : undefined; + if (!baseName || !baseName.startsWith(HiddenFilePrefix)) { + next(uri, diagnostics); + } } } }; diff --git a/src/client/constants.ts b/src/client/constants.ts index d0b1f89025b6..0e429b7ddc25 100644 --- a/src/client/constants.ts +++ b/src/client/constants.ts @@ -9,3 +9,6 @@ import * as path from 'path'; // When bundling, the bundle file for the debug adapter ends up elsewhere. const folderName = path.basename(__dirname); export const EXTENSION_ROOT_DIR = folderName === 'client' ? path.join(__dirname, '..', '..') : path.join(__dirname, '..', '..', '..', '..'); + +export const HiddenFileFormatString = '_HiddenFile_{0}.py'; +export const HiddenFilePrefix = '_HiddenFile_'; diff --git a/src/client/datascience/interactive-window/intellisense/baseIntellisenseProvider.ts b/src/client/datascience/interactive-window/intellisense/baseIntellisenseProvider.ts index 92c4e1866b4b..d0857132f83a 100644 --- a/src/client/datascience/interactive-window/intellisense/baseIntellisenseProvider.ts +++ b/src/client/datascience/interactive-window/intellisense/baseIntellisenseProvider.ts @@ -16,6 +16,7 @@ import { Uri } from 'vscode'; +import { HiddenFileFormatString } from '../../../../client/constants'; import { IWorkspaceService } from '../../../common/application/types'; import { CancellationError } from '../../../common/cancellation'; import { traceWarning } from '../../../common/logger'; @@ -123,7 +124,7 @@ export abstract class BaseIntellisenseProvider implements IInteractiveWindowList // Create our dummy document. Compute a file path for it. if (this.workspaceService.rootPath || resource) { const dir = resource ? path.dirname(resource.fsPath) : this.workspaceService.rootPath!; - const dummyFilePath = path.join(dir, `History_${uuid().replace(/-/g, '')}.py`); + const dummyFilePath = path.join(dir, HiddenFileFormatString.format(uuid().replace(/-/g, ''))); this.documentPromise.resolve(new IntellisenseDocument(dummyFilePath)); } else { this.fileSystem.createTemporaryFile('.py') diff --git a/src/client/datascience/interactive-window/intellisense/dotNetIntellisenseProvider.ts b/src/client/datascience/interactive-window/intellisense/dotNetIntellisenseProvider.ts index e199c9490106..836d03490341 100644 --- a/src/client/datascience/interactive-window/intellisense/dotNetIntellisenseProvider.ts +++ b/src/client/datascience/interactive-window/intellisense/dotNetIntellisenseProvider.ts @@ -23,8 +23,8 @@ import { IntellisenseDocument } from './intellisenseDocument'; @injectable() export class DotNetIntellisenseProvider extends BaseIntellisenseProvider implements IInteractiveWindowListener { - private languageClientPromise : Deferred | undefined; - private sentOpenDocument : boolean = false; + private languageClientPromise: Deferred | undefined; + private sentOpenDocument: boolean = false; private active: boolean = false; constructor( @@ -47,11 +47,11 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme this.configService.getSettings().onDidChange(() => this.active = !this.configService.getSettings().jediEnabled); } - protected get isActive() : boolean { + protected get isActive(): boolean { return this.active; } - protected async provideCompletionItems(position: monacoEditor.Position, context: monacoEditor.languages.CompletionContext, cellId: string, token: CancellationToken) : Promise { + protected async provideCompletionItems(position: monacoEditor.Position, context: monacoEditor.languages.CompletionContext, cellId: string, token: CancellationToken): Promise { const languageClient = await this.getLanguageClient(); const document = await this.getDocument(); if (languageClient && document) { @@ -68,7 +68,7 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme incomplete: false }; } - protected async provideHover(position: monacoEditor.Position, cellId: string, token: CancellationToken) : Promise { + protected async provideHover(position: monacoEditor.Position, cellId: string, token: CancellationToken): Promise { const languageClient = await this.getLanguageClient(); const document = await this.getDocument(); if (languageClient && document) { @@ -84,7 +84,7 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme contents: [] }; } - protected async provideSignatureHelp(position: monacoEditor.Position, _context: monacoEditor.languages.SignatureHelpContext, cellId: string, token: CancellationToken) : Promise { + protected async provideSignatureHelp(position: monacoEditor.Position, _context: monacoEditor.languages.SignatureHelpContext, cellId: string, token: CancellationToken): Promise { const languageClient = await this.getLanguageClient(); const document = await this.getDocument(); if (languageClient && document) { @@ -103,7 +103,7 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme }; } - protected async handleChanges(originalFile: string | undefined, document: IntellisenseDocument, changes: TextDocumentContentChangeEvent[]) : Promise { + protected async handleChanges(originalFile: string | undefined, document: IntellisenseDocument, changes: TextDocumentContentChangeEvent[]): Promise { // Then see if we can talk to our language client if (this.active && document) { @@ -124,7 +124,7 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme } } - private getLanguageClient(file?: Uri) : Promise { + private getLanguageClient(file?: Uri): Promise { if (!this.languageClientPromise) { this.languageClientPromise = createDeferred(); this.startup(file) @@ -138,7 +138,7 @@ export class DotNetIntellisenseProvider extends BaseIntellisenseProvider impleme return this.languageClientPromise.promise; } - private async startup(resource?: Uri) : Promise { + private async startup(resource?: Uri): Promise { // Start up the language server. We'll use this to talk to the language server const options = await this.analysisOptions!.getAnalysisOptions(); await this.languageServer.start(resource, options); From 36993b5fc4f53207df5a3a2473b667f8a7aa8c62 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 31 Jul 2019 09:34:27 -0700 Subject: [PATCH 5/7] Fix npm audit --- package-lock.json | 206 +++++++++++----------------------------------- package.json | 4 +- 2 files changed, 49 insertions(+), 161 deletions(-) diff --git a/package-lock.json b/package-lock.json index f3c5cf528f37..67a19573a881 100644 --- a/package-lock.json +++ b/package-lock.json @@ -168,9 +168,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -227,9 +227,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -306,9 +306,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -338,9 +338,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -693,9 +693,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -1243,9 +1243,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, "ms": { @@ -1268,9 +1268,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -3086,12 +3086,12 @@ "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" }, "azure-storage": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/azure-storage/-/azure-storage-2.10.1.tgz", - "integrity": "sha512-rnFo1uMIPtilusRCpK91tfY3P4Q7qRsDNwriXdp+OeTIGkGt0cTxL4mhqYfNPYPK+WBQmBdGWhOk+iROM05dcw==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/azure-storage/-/azure-storage-2.10.3.tgz", + "integrity": "sha512-IGLs5Xj6kO8Ii90KerQrrwuJKexLgSwYC4oLWmc11mzKe7Jt2E5IVg+ZQ8K53YWZACtVTMBNO3iGuA+4ipjJxQ==", "requires": { "browserify-mime": "~1.2.9", - "extend": "~1.2.1", + "extend": "^3.0.2", "json-edm-parser": "0.1.2", "md5.js": "1.3.4", "readable-stream": "~2.0.0", @@ -3100,99 +3100,14 @@ "uuid": "^3.0.0", "validator": "~9.4.1", "xml2js": "0.2.8", - "xmlbuilder": "0.4.3" + "xmlbuilder": "^9.0.7" }, "dependencies": { - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "extend": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz", - "integrity": "sha1-oPX9bPyDpf5J72mNYOyKYk3UV2w=" - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, - "mime-db": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", - "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==" - }, - "mime-types": { - "version": "2.1.20", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", - "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", - "requires": { - "mime-db": "~1.36.0" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - } - } - }, "sax": { "version": "0.5.8", "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=" }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, "xml2js": { "version": "0.2.8", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz", @@ -3200,11 +3115,6 @@ "requires": { "sax": "0.5.x" } - }, - "xmlbuilder": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-0.4.3.tgz", - "integrity": "sha1-xGFLp04K0ZbmCcknLNnh3bKKilg=" } } }, @@ -5563,9 +5473,9 @@ }, "dependencies": { "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true } } @@ -7193,9 +7103,9 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "extend-shallow": { "version": "3.0.2", @@ -11541,9 +11451,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._reinterpolate": { "version": "3.0.0", @@ -12127,9 +12037,9 @@ } }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -14279,7 +14189,8 @@ "psl": { "version": "1.1.29", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true }, "public-encrypt": { "version": "4.0.2", @@ -15724,9 +15635,9 @@ "dev": true }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -18135,38 +18046,15 @@ } }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "uniqid": { diff --git a/package.json b/package.json index e98f51f10bd8..c7a4fdb882a2 100644 --- a/package.json +++ b/package.json @@ -2196,7 +2196,7 @@ "dependencies": { "@jupyterlab/services": "^3.2.1", "arch": "^2.1.0", - "azure-storage": "^2.10.1", + "azure-storage": "^2.10.3", "diff-match-patch": "^1.0.0", "fs-extra": "^4.0.3", "fuzzy": "^0.1.3", @@ -2208,7 +2208,7 @@ "jsonc-parser": "^2.0.3", "less-plugin-inline-urls": "^1.2.0", "line-by-line": "^0.1.6", - "lodash": "^4.17.11", + "lodash": "^4.17.15", "md5": "^2.2.1", "minimatch": "^3.0.4", "monaco-editor-textmate": "^2.1.1", From 39a028b9f11b3768fa4b1efcd274a35e4068f360 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 31 Jul 2019 09:42:15 -0700 Subject: [PATCH 6/7] Make dataviewers open faster --- news/2 Fixes/6729.md | 1 + package-lock.json | 78 +++++-------------- .../data-viewing/dataViewerProvider.ts | 55 ++++++++++--- .../interactive-window/interactiveWindow.ts | 19 +---- src/client/datascience/types.ts | 3 +- 5 files changed, 67 insertions(+), 89 deletions(-) create mode 100644 news/2 Fixes/6729.md diff --git a/news/2 Fixes/6729.md b/news/2 Fixes/6729.md new file mode 100644 index 000000000000..65c2e4ff2706 --- /dev/null +++ b/news/2 Fixes/6729.md @@ -0,0 +1 @@ +Make the dataviewer open a window much faster. Total load time is the same, but initial response is much faster. diff --git a/package-lock.json b/package-lock.json index ac5ab45290b4..6cfdac5b8e53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4158,8 +4158,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -4183,15 +4182,13 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4208,22 +4205,19 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4354,8 +4348,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4369,7 +4362,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4386,7 +4378,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4395,15 +4386,13 @@ "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -4424,7 +4413,6 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4513,8 +4501,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4528,7 +4515,6 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4624,8 +4610,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4667,7 +4652,6 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4689,7 +4673,6 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4738,15 +4721,13 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true + "dev": true } } }, @@ -8177,8 +8158,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -8202,15 +8182,13 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8220,22 +8198,19 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -8356,8 +8331,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -8371,7 +8345,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -8388,7 +8361,6 @@ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -8397,15 +8369,13 @@ "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true + "dev": true }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -8494,8 +8464,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -8509,7 +8478,6 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -8605,8 +8573,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -8648,7 +8615,6 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8670,7 +8636,6 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -8728,8 +8693,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", diff --git a/src/client/datascience/data-viewing/dataViewerProvider.ts b/src/client/datascience/data-viewing/dataViewerProvider.ts index 4e6ead69183d..5c41dde86ef5 100644 --- a/src/client/datascience/data-viewing/dataViewerProvider.ts +++ b/src/client/datascience/data-viewing/dataViewerProvider.ts @@ -11,6 +11,8 @@ import * as localize from '../../common/utils/localize'; import { noop } from '../../common/utils/misc'; import { IInterpreterService } from '../../interpreter/contracts'; import { IServiceContainer } from '../../ioc/types'; +import { sendTelemetryEvent } from '../../telemetry'; +import { Telemetry } from '../constants'; import { IDataViewer, IDataViewerProvider, IJupyterVariables } from '../types'; @injectable() @@ -31,21 +33,36 @@ export class DataViewerProvider implements IDataViewerProvider, IAsyncDisposable await Promise.all(this.activeExplorers.map(d => d.dispose())); } - public async create(variable: string) : Promise{ - // Make sure this is a valid variable - const variables = await this.variables.getVariables(); - const index = variables.findIndex(v => v && v.name === variable); - if (index >= 0) { - const dataExplorer = this.serviceContainer.get(IDataViewer); - this.activeExplorers.push(dataExplorer); - await dataExplorer.showVariable(variables[index]); - return dataExplorer; - } + public async create(variable: string): Promise { + let result: IDataViewer | undefined; + + // Create the data explorer (this should show the window) + const dataExplorer = this.serviceContainer.get(IDataViewer); + try { + // Verify this is allowed. + await this.checkPandas(); - throw new Error(localize.DataScience.dataExplorerInvalidVariableFormat().format(variable)); + // Make sure this is a valid variable + const variables = await this.variables.getVariables(); + const index = variables.findIndex(v => v && v.name === variable); + if (index >= 0) { + // Then load the data. + this.activeExplorers.push(dataExplorer); + await dataExplorer.showVariable(variables[index]); + result = dataExplorer; + } else { + throw new Error(localize.DataScience.dataExplorerInvalidVariableFormat().format(variable)); + } + } finally { + if (!result) { + // If throw any errors, close the window we opened. + dataExplorer.dispose(); + } + } + return result; } - public async getPandasVersion() : Promise<{major: number; minor: number; build: number} | undefined> { + private async getPandasVersion(): Promise<{ major: number; minor: number; build: number } | undefined> { const interpreter = await this.interpreterService.getActiveInterpreter(); const launcher = await this.pythonFactory.createActivatedEnvironment({ resource: undefined, interpreter, allowEnvironmentFetchExceptions: true }); try { @@ -61,4 +78,18 @@ export class DataViewerProvider implements IDataViewerProvider, IAsyncDisposable noop(); } } + + private async checkPandas(): Promise { + const pandasVersion = await this.getPandasVersion(); + if (!pandasVersion) { + sendTelemetryEvent(Telemetry.PandasNotInstalled); + // Warn user that there is no pandas. + throw new Error(localize.DataScience.pandasRequiredForViewing()); + } else if (pandasVersion.major < 1 && pandasVersion.minor < 20) { + sendTelemetryEvent(Telemetry.PandasTooOld); + // Warn user that we cannot start because pandas is too old. + const versionStr = `${pandasVersion.major}.${pandasVersion.minor}.${pandasVersion.build}`; + throw new Error(localize.DataScience.pandasTooOldForViewingFormat().format(versionStr)); + } + } } diff --git a/src/client/datascience/interactive-window/interactiveWindow.ts b/src/client/datascience/interactive-window/interactiveWindow.ts index 6e099aa5b8f3..3de75061f11e 100644 --- a/src/client/datascience/interactive-window/interactiveWindow.ts +++ b/src/client/datascience/interactive-window/interactiveWindow.ts @@ -519,23 +519,6 @@ export class InteractiveWindow extends WebViewHost im this.addMessage(message, 'preview'); } - private async checkPandas() : Promise { - const pandasVersion = await this.dataExplorerProvider.getPandasVersion(); - if (!pandasVersion) { - sendTelemetryEvent(Telemetry.PandasNotInstalled); - // Warn user that there is no pandas. - this.applicationShell.showErrorMessage(localize.DataScience.pandasRequiredForViewing()); - return false; - } else if (pandasVersion.major < 1 && pandasVersion.minor < 20) { - sendTelemetryEvent(Telemetry.PandasTooOld); - // Warn user that we cannot start because pandas is too old. - const versionStr = `${pandasVersion.major}.${pandasVersion.minor}.${pandasVersion.build}`; - this.applicationShell.showErrorMessage(localize.DataScience.pandasTooOldForViewingFormat().format(versionStr)); - return false; - } - return true; - } - private shouldAskForLargeData(): boolean { const settings = this.configuration.getSettings(); return settings && settings.datascience && settings.datascience.askForLargeDataFrames === true; @@ -567,7 +550,7 @@ export class InteractiveWindow extends WebViewHost im private async showDataViewer(request: IShowDataViewer) : Promise { try { - if (await this.checkPandas() && await this.checkColumnSize(request.columnSize)) { + if (await this.checkColumnSize(request.columnSize)) { await this.dataExplorerProvider.create(request.variableName); } } catch (e) { diff --git a/src/client/datascience/types.ts b/src/client/datascience/types.ts index 6dc5a2ce706a..d947264dc6ac 100644 --- a/src/client/datascience/types.ts +++ b/src/client/datascience/types.ts @@ -359,8 +359,7 @@ export interface IJupyterVariablesResponse { export const IDataViewerProvider = Symbol('IDataViewerProvider'); export interface IDataViewerProvider { - create(variable: string) : Promise; - getPandasVersion() : Promise<{major: number; minor: number; build: number} | undefined>; + create(variable: string): Promise; } export const IDataViewer = Symbol('IDataViewer'); From 6f7e5891ef3850c2bc9207a3eecd9b273a968398 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 31 Jul 2019 12:16:25 -0700 Subject: [PATCH 7/7] Fix package-lock.json --- package-lock.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 96c44513890c..9fe4953b8dcc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8914,7 +8914,6 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -8934,8 +8933,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true + "dev": true } } }, @@ -12308,9 +12306,9 @@ } }, "lodash": { - "version": "4.17.13", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.13.tgz", - "integrity": "sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==" + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "lodash._reinterpolate": { "version": "3.0.0",