From 78d2ad5a7f4f475329889dbae574a4c7417aba8a Mon Sep 17 00:00:00 2001 From: Akshita Agarwal Date: Wed, 30 Jan 2019 15:21:54 -0800 Subject: [PATCH] update --- package-lock.json | 21 ++++++++--------- package.json | 2 +- src/CompositeDisposable.ts | 2 +- src/Disposable.ts | 2 +- src/EventStream.ts | 3 +-- src/observables/CreateOptionStream.ts | 8 +++---- src/observers/OptionChangeObserver.ts | 15 ++++++------ src/observers/OptionProvider.ts | 4 +--- src/observers/WarningMessageObserver.ts | 14 +++++------ src/omnisharp/server.ts | 13 ++++++----- .../OptionChangeObserver.test.ts | 23 ++++++++----------- .../OptionObserver/OptionProvider.test.ts | 2 +- .../logging/ErrorMessageObserver.test.ts | 4 ++-- .../InformationMessageObserver.test.ts | 13 +++++------ .../logging/WarningMessageObserver.test.ts | 23 ++++++++----------- test/unitTests/optionStream.test.ts | 3 +-- 16 files changed, 68 insertions(+), 84 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73b3cdf..fa91bea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9823,13 +9823,18 @@ } }, "rxjs": { - "version": "5.5.6", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.6.tgz", - "integrity": "sha512-v4Q5HDC0FHAQ7zcBX7T2IL6O5ltl1a2GX4ENjPXg6SjDY69Cmx9v4113C99a4wGF16ClPv5Z8mghuYorVkg/kg==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", + "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", "requires": { - "symbol-observable": "1.0.1" + "tslib": "^1.9.0" } }, + "rxjs-compat": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.4.0.tgz", + "integrity": "sha512-eo/O8RS83hJdJukCtA+IF6qnqa8FPOuVo+OPCzgVi+dbTle9KCdNv97IcQO0WwNVik7DJLKmf0F8uwzc0q40vw==" + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", @@ -10414,11 +10419,6 @@ "es6-symbol": "^3.1.1" } }, - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=" - }, "tar": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", @@ -10711,8 +10711,7 @@ "tslib": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", - "dev": true + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==" }, "tslint": { "version": "5.10.0", diff --git a/package.json b/package.json index 52e6dfa..5d8a2f3 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "open": "*", "remove-bom-buffer": "3.0.0", "request-light": "0.2.4", - "rxjs": "5.5.6", + "rxjs": "6.4.0", "semver": "*", "stream": "0.0.2", "strip-bom": "3.0.0", diff --git a/src/CompositeDisposable.ts b/src/CompositeDisposable.ts index 9f38e23..49d83f5 100644 --- a/src/CompositeDisposable.ts +++ b/src/CompositeDisposable.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Subscription } from "rxjs/Subscription"; +import { Subscription } from "rxjs"; import Disposable, { IDisposable } from "./Disposable"; export default class CompositeDisposable extends Disposable { diff --git a/src/Disposable.ts b/src/Disposable.ts index 73e4e73..fdc88d5 100644 --- a/src/Disposable.ts +++ b/src/Disposable.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Subscription } from "rxjs/Subscription"; +import { Subscription } from "rxjs"; export default class Disposable implements IDisposable { private onDispose: { (): void }; diff --git a/src/EventStream.ts b/src/EventStream.ts index 9ca1f81..cd21cf4 100644 --- a/src/EventStream.ts +++ b/src/EventStream.ts @@ -2,9 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Subject } from "rxjs/Subject"; +import { Subject , Subscription } from "rxjs"; import { BaseEvent } from "./omnisharp/loggingEvents"; -import { Subscription } from "rxjs/Subscription"; export class EventStream { private sink: Subject; diff --git a/src/observables/CreateOptionStream.ts b/src/observables/CreateOptionStream.ts index daec46b..4d648fd 100644 --- a/src/observables/CreateOptionStream.ts +++ b/src/observables/CreateOptionStream.ts @@ -5,10 +5,8 @@ import { Options } from "../omnisharp/options"; import { vscode } from "../vscodeAdapter"; -import 'rxjs/add/operator/take'; -import 'rxjs/add/operator/publishBehavior'; -import { Observable } from "rxjs/Observable"; -import { Observer } from "rxjs/Observer"; +import { Observable, Observer } from "rxjs"; +import { publishBehavior } from "rxjs/operators"; export default function createOptionStream(vscode: vscode): Observable { return Observable.create((observer: Observer) => { @@ -20,5 +18,5 @@ export default function createOptionStream(vscode: vscode): Observable }); return () => disposable.dispose(); - }).publishBehavior(Options.Read(vscode)).refCount(); + }).pipe(publishBehavior(Options.Read(vscode))).refCount(); } \ No newline at end of file diff --git a/src/observers/OptionChangeObserver.ts b/src/observers/OptionChangeObserver.ts index f9eb38d..755143c 100644 --- a/src/observers/OptionChangeObserver.ts +++ b/src/observers/OptionChangeObserver.ts @@ -1,23 +1,22 @@ /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ import { vscode } from "../vscodeAdapter"; import { Options } from "../omnisharp/options"; import ShowInformationMessage from "./utils/ShowInformationMessage"; -import { Observable } from "rxjs/Observable"; +import { Observable } from "rxjs"; import Disposable from "../Disposable"; -import 'rxjs/add/operator/filter'; -import 'rxjs/add/operator/distinctUntilChanged'; +import { filter} from 'rxjs/operators'; function ConfigChangeObservable(optionObservable: Observable): Observable { let options: Options; - return optionObservable. filter(newOptions => { + return optionObservable.pipe( filter(newOptions => { let changed = (options && hasChanged(options, newOptions)); options = newOptions; return changed; - }); + })); } export function ShowOmniSharpConfigChangePrompt(optionObservable: Observable, vscode: vscode): Disposable { diff --git a/src/observers/OptionProvider.ts b/src/observers/OptionProvider.ts index 0d24216..a01f36b 100644 --- a/src/observers/OptionProvider.ts +++ b/src/observers/OptionProvider.ts @@ -4,9 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Options } from "../omnisharp/options"; -import { Subscription } from "rxjs/Subscription"; -import { Observable } from "rxjs/Observable"; - +import { Subscription , Observable } from "rxjs"; export default class OptionProvider { private options: Options; private subscription: Subscription; diff --git a/src/observers/WarningMessageObserver.ts b/src/observers/WarningMessageObserver.ts index 2e6ba2a..5bec739 100644 --- a/src/observers/WarningMessageObserver.ts +++ b/src/observers/WarningMessageObserver.ts @@ -1,13 +1,13 @@ /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ +import {debounceTime} from 'rxjs/operators'; import { vscode } from '../vscodeAdapter'; import { BaseEvent, OmnisharpServerOnError, OmnisharpServerMsBuildProjectDiagnostics } from "../omnisharp/loggingEvents"; -import { Scheduler } from 'rxjs/Scheduler'; -import { Subject } from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; +import { Scheduler , Subject } from 'rxjs'; + import showWarningMessage from './utils/ShowWarningMessage'; export class WarningMessageObserver { @@ -15,7 +15,7 @@ export class WarningMessageObserver { constructor(private vscode: vscode, private disableMsBuildDiagnosticWarning: () => boolean, scheduler?: Scheduler) { this.warningMessageDebouncer = new Subject(); - this.warningMessageDebouncer.debounceTime(1500, scheduler).subscribe(async event => { + this.warningMessageDebouncer.pipe(debounceTime(1500, scheduler)).subscribe(async event => { let message = "Some projects have trouble loading. Please review the output for more details."; await showWarningMessage(this.vscode, message, { title: "Show Output", command: 'o.showOutput' }); }); diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index 69c04d4..5f86dc0 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -1,7 +1,8 @@ + /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ import * as fs from 'fs'; import * as path from 'path'; @@ -24,8 +25,8 @@ import { OmnisharpDownloader } from './OmnisharpDownloader'; import * as ObservableEvents from './loggingEvents'; import { EventStream } from '../EventStream'; import { NetworkSettingsProvider } from '../NetworkSettings'; -import { Subject } from 'rxjs/Subject'; -import 'rxjs/add/operator/debounceTime'; +import { Subject } from 'rxjs'; +import {debounceTime} from 'rxjs/operators'; import CompositeDisposable from '../CompositeDisposable'; import Disposable from '../Disposable'; import OptionProvider from '../observers/OptionProvider'; @@ -97,7 +98,7 @@ export class OmniSharpServer { this._requestQueue = new RequestQueueCollection(this.eventStream, 8, request => this._makeRequest(request)); let downloader = new OmnisharpDownloader(networkSettingsProvider, this.eventStream, this.packageJSON, platformInfo, extensionPath); this._omnisharpManager = new OmnisharpManager(downloader, platformInfo); - this.updateProjectDebouncer.debounceTime(1500).subscribe((event) => { this.updateProjectInfo(); }); + this.updateProjectDebouncer.pipe(debounceTime(1500)).subscribe((event) => { this.updateProjectInfo(); }); this.firstUpdateProject = true; } diff --git a/test/unitTests/OptionObserver/OptionChangeObserver.test.ts b/test/unitTests/OptionObserver/OptionChangeObserver.test.ts index f19bfc1..910df02 100644 --- a/test/unitTests/OptionObserver/OptionChangeObserver.test.ts +++ b/test/unitTests/OptionObserver/OptionChangeObserver.test.ts @@ -1,18 +1,15 @@ /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ import { use as chaiUse, expect, should } from 'chai'; import { updateConfig, getVSCodeWithConfig } from '../testAssets/Fakes'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/fromPromise'; -import 'rxjs/add/operator/timeout'; +import { timeout } from 'rxjs/operators'; +import { from as observableFrom, Subject, BehaviorSubject } from 'rxjs'; import { vscode } from '../../../src/vscodeAdapter'; import { ShowOmniSharpConfigChangePrompt } from '../../../src/observers/OptionChangeObserver'; -import { Subject } from 'rxjs/Subject'; import { Options } from '../../../src/omnisharp/options'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; chaiUse(require('chai-as-promised')); chaiUse(require('chai-string')); @@ -37,7 +34,7 @@ suite("OmniSharpConfigChangeObserver", () => { signalCommandDone = () => { resolve(); }; }); }); - + [ { config: "omnisharp", section: "path", value: "somePath" }, { config: "omnisharp", section: "waitForDebugger", value: true }, @@ -59,7 +56,7 @@ suite("OmniSharpConfigChangeObserver", () => { test('Given an information message if the user clicks cancel, the command is not executed', async () => { doClickCancel(); - await expect(Observable.fromPromise(commandDone).timeout(1).toPromise()).to.be.rejected; + await expect(observableFrom(commandDone).pipe(timeout(1)).toPromise()).to.be.rejected; expect(invokedCommand).to.be.undefined; }); @@ -69,9 +66,9 @@ suite("OmniSharpConfigChangeObserver", () => { expect(invokedCommand).to.be.equal("o.restart"); }); }); - }); - - suite('Information Message is not shown on change in',() => { + }); + + suite('Information Message is not shown on change in', () => { [ { config: "csharp", section: 'disableCodeActions', value: true }, { config: "csharp", section: 'testsCodeLens.enabled', value: false }, diff --git a/test/unitTests/OptionObserver/OptionProvider.test.ts b/test/unitTests/OptionObserver/OptionProvider.test.ts index 46c041e..ca1b681 100644 --- a/test/unitTests/OptionObserver/OptionProvider.test.ts +++ b/test/unitTests/OptionObserver/OptionProvider.test.ts @@ -7,7 +7,7 @@ import { should, expect } from 'chai'; import { getVSCodeWithConfig, updateConfig } from "../testAssets/Fakes"; import { vscode } from "../../../src/vscodeAdapter"; import OptionProvider from '../../../src/observers/OptionProvider'; -import { Subject } from 'rxjs/Subject'; +import { Subject } from 'rxjs'; import { Options } from '../../../src/omnisharp/options'; suite('OptionProvider', () => { diff --git a/test/unitTests/logging/ErrorMessageObserver.test.ts b/test/unitTests/logging/ErrorMessageObserver.test.ts index 3b14eca..54a0bb4 100644 --- a/test/unitTests/logging/ErrorMessageObserver.test.ts +++ b/test/unitTests/logging/ErrorMessageObserver.test.ts @@ -6,8 +6,8 @@ import { use as chaiUse, expect, should } from 'chai'; import { vscode } from '../../../src/vscodeAdapter'; import { getFakeVsCode } from '../testAssets/Fakes'; -import 'rxjs/add/observable/fromPromise'; -import 'rxjs/add/operator/timeout'; + + import { ErrorMessageObserver } from '../../../src/observers/ErrorMessageObserver'; import { ZipError, DotNetTestRunFailure, DotNetTestDebugStartFailure, EventWithMessage, IntegrityCheckFailure } from '../../../src/omnisharp/loggingEvents'; diff --git a/test/unitTests/logging/InformationMessageObserver.test.ts b/test/unitTests/logging/InformationMessageObserver.test.ts index 47e0dc2..cb5816a 100644 --- a/test/unitTests/logging/InformationMessageObserver.test.ts +++ b/test/unitTests/logging/InformationMessageObserver.test.ts @@ -1,14 +1,13 @@ /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ import { InformationMessageObserver } from '../../../src/observers/InformationMessageObserver'; import { use as chaiUse, expect, should } from 'chai'; import { getUnresolvedDependenices, updateConfig, getVSCodeWithConfig } from '../testAssets/Fakes'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/fromPromise'; -import 'rxjs/add/operator/timeout'; +import {from as observableFrom } from 'rxjs'; +import {timeout} from 'rxjs/operators'; chaiUse(require('chai-as-promised')); chaiUse(require('chai-string')); @@ -72,7 +71,7 @@ suite("InformationMessageObserver", () => { test('Given an information message if the user clicks cancel, the command is not executed', async () => { observer.post(elem.event); doClickCancel(); - await expect(Observable.fromPromise(commandDone).timeout(1).toPromise()).to.be.rejected; + await expect(observableFrom(commandDone).pipe(timeout(1)).toPromise()).to.be.rejected; expect(invokedCommand).to.be.undefined; }); }); diff --git a/test/unitTests/logging/WarningMessageObserver.test.ts b/test/unitTests/logging/WarningMessageObserver.test.ts index 9266b53..e9a8b2c 100644 --- a/test/unitTests/logging/WarningMessageObserver.test.ts +++ b/test/unitTests/logging/WarningMessageObserver.test.ts @@ -1,20 +1,15 @@ /*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ +* Copyright (c) Microsoft Corporation. All rights reserved. +* Licensed under the MIT License. See License.txt in the project root for license information. +*--------------------------------------------------------------------------------------------*/ import { WarningMessageObserver } from '../../../src/observers/WarningMessageObserver'; import { assert, use as chaiUse, expect, should } from 'chai'; import { getFakeVsCode, getMSBuildDiagnosticsMessage, getOmnisharpMSBuildProjectDiagnosticsEvent, getOmnisharpServerOnErrorEvent } from '../testAssets/Fakes'; import { vscode } from '../../../src/vscodeAdapter'; -import { TestScheduler } from 'rxjs/testing/TestScheduler'; -import { Observable } from 'rxjs/Observable'; -import "rxjs/add/operator/map"; -import "rxjs/add/operator/debounceTime"; -import 'rxjs/add/operator/timeout'; -import 'rxjs/add/observable/fromPromise'; -import 'rxjs/add/observable/timer'; -import { Subject } from 'rxjs/Subject'; +import { TestScheduler } from 'rxjs/testing'; +import { from as observableFrom, Subject } from 'rxjs'; +import { timeout, map } from 'rxjs/operators'; chaiUse(require('chai-as-promised')); chaiUse(require('chai-string')); @@ -165,7 +160,7 @@ suite('WarningMessageObserver', () => { test(`Given a warning message, when the user clicks ok the command is executed`, async () => { let marble = `${timeToMarble(1500)}a`; let eventList = scheduler.createHotObservable(marble, { a: elem.eventA }); - scheduler.expectObservable(eventList.map(e => observer.post(e))); + scheduler.expectObservable(eventList.pipe(map(e => observer.post(e)))); scheduler.flush(); doClickOk(); await commandDone; @@ -175,10 +170,10 @@ suite('WarningMessageObserver', () => { test(`Given a warning message, when the user clicks cancel the command is not executed`, async () => { let marble = `${timeToMarble(1500)}a--|`; let eventList = scheduler.createHotObservable(marble, { a: elem.eventA }); - scheduler.expectObservable(eventList.map(e => observer.post(e))); + scheduler.expectObservable(eventList.pipe(map(e => observer.post(e)))); scheduler.flush(); doClickCancel(); - await expect(Observable.fromPromise(commandDone).timeout(1).toPromise()).to.be.rejected; + await expect(observableFrom(commandDone).pipe(timeout(1)).toPromise()).to.be.rejected; expect(invokedCommand).to.be.undefined; }); }); diff --git a/test/unitTests/optionStream.test.ts b/test/unitTests/optionStream.test.ts index 63d79e7..ed615e9 100644 --- a/test/unitTests/optionStream.test.ts +++ b/test/unitTests/optionStream.test.ts @@ -7,10 +7,9 @@ import { should, expect } from 'chai'; import { ConfigurationChangeEvent, vscode } from "../../src/vscodeAdapter"; import { getVSCodeWithConfig, updateConfig } from "./testAssets/Fakes"; import Disposable from "../../src/Disposable"; -import { Observable } from "rxjs/Observable"; +import { Observable, Subscription } from "rxjs"; import { Options } from "../../src/omnisharp/options"; import { GetConfigChangeEvent } from './testAssets/GetConfigChangeEvent'; -import { Subscription } from 'rxjs/Subscription'; import createOptionStream from '../../src/observables/CreateOptionStream'; suite('OptionStream', () => {