Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6 (#6779)

* Merge from vscode 1ce89e2cb720d69c496c2815c4696ee4fd4429a6

* redisable accounts because of issues
This commit is contained in:
Anthony Dresser
2019-08-15 23:56:46 -07:00
committed by GitHub
parent fb4e3c6a05
commit 6f297efb88
166 changed files with 1941 additions and 1279 deletions

View File

@@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 3.76345L5.80687 11.9351L5.08584 11.8927L1 7.29614L1.76345 6.61752L5.50997 10.8324L14.3214 3L15 3.76345Z" fill="#C5C5C5"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4315 3.3232L5.96151 13.3232L5.1708 13.2874L1.8208 8.5174L2.63915 7.94268L5.61697 12.1827L13.6684 2.67688L14.4315 3.3232Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 295 B

View File

@@ -293,12 +293,9 @@ function topStep<T>(array: ReadonlyArray<T>, compare: (a: T, b: T) => number, re
}
/**
* @returns a new array with all falsy values removed. The original array IS NOT modified.
* @returns New array with all falsy values removed. The original array IS NOT modified.
*/
export function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {
if (!array) {
return array as T[]; // {{SQL CARBON EDIT}} @anthonydresser strict-null-checks
}
return <T[]>array.filter(e => !!e);
}
@@ -306,9 +303,6 @@ export function coalesce<T>(array: ReadonlyArray<T | undefined | null>): T[] {
* Remove all falsey values from `array`. The original array IS modified.
*/
export function coalesceInPlace<T>(array: Array<T | undefined | null>): void {
if (!array) {
return;
}
let to = 0;
for (let i = 0; i < array.length; i++) {
if (!!array[i]) {

View File

@@ -127,8 +127,7 @@ export class DisposableStore implements IDisposable {
markTracked(t);
if (this._isDisposed) {
console.warn(new Error('Registering disposable on object that has already been disposed of').stack);
t.dispose();
console.warn(new Error('Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!').stack);
} else {
this._toDispose.add(t);
}

View File

@@ -49,3 +49,26 @@ export namespace Schemas {
export const userData: string = 'vscode-userdata';
}
class RemoteAuthoritiesImpl {
private readonly _hosts: { [authority: string]: string; };
private readonly _ports: { [authority: string]: number; };
private readonly _connectionTokens: { [authority: string]: string; };
constructor() {
this._hosts = Object.create(null);
this._ports = Object.create(null);
this._connectionTokens = Object.create(null);
}
public set(authority: string, host: string, port: number): void {
this._hosts[authority] = host;
this._ports[authority] = port;
}
public setConnectionToken(authority: string, connectionToken: string): void {
this._connectionTokens[authority] = connectionToken;
}
}
export const RemoteAuthorities = new RemoteAuthoritiesImpl();

View File

@@ -3,11 +3,11 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { isWindows, isMacintosh, setImmediate } from 'vs/base/common/platform';
import { isWindows, isMacintosh, setImmediate, IProcessEnvironment } from 'vs/base/common/platform';
interface IProcess {
platform: string;
env: object;
env: IProcessEnvironment;
cwd(): string;
nextTick(callback: (...args: any[]) => void): number;

View File

@@ -8,8 +8,7 @@ import { IMessagePassingProtocol, IPCClient } from 'vs/base/parts/ipc/common/ipc
import { IDisposable, Disposable, dispose } from 'vs/base/common/lifecycle';
import { VSBuffer } from 'vs/base/common/buffer';
import * as platform from 'vs/base/common/platform';
declare var process: any;
import * as process from 'vs/base/common/process';
export interface ISocket extends IDisposable {
onData(listener: (e: VSBuffer) => void): IDisposable;
@@ -434,11 +433,7 @@ export function createBufferedEvent<T>(source: Event<T>): Event<T> {
// it is important to deliver these messages after this call, but before
// other messages have a chance to be received (to guarantee in order delivery)
// that's why we're using here nextTick and not other types of timeouts
if (typeof process !== 'undefined') {
process.nextTick(deliverMessages);
} else {
platform.setImmediate(deliverMessages);
}
process.nextTick(deliverMessages);
},
onLastListenerRemove: () => {
hasListeners = false;

View File

@@ -86,7 +86,7 @@ export interface IIPCOptions {
export class Client implements IChannelClient, IDisposable {
private disposeDelayer: Delayer<void>;
private disposeDelayer: Delayer<void> | undefined;
private activeRequests = new Set<IDisposable>();
private child: ChildProcess | null;
private _client: IPCClient | null;
@@ -137,7 +137,7 @@ export class Client implements IChannelClient, IDisposable {
cancellationTokenListener.dispose();
this.activeRequests.delete(disposable);
if (this.activeRequests.size === 0) {
if (this.activeRequests.size === 0 && this.disposeDelayer) {
this.disposeDelayer.trigger(() => this.disposeClient());
}
});
@@ -271,8 +271,10 @@ export class Client implements IChannelClient, IDisposable {
dispose() {
this._onDidProcessExit.dispose();
this.disposeDelayer.cancel();
this.disposeDelayer = null!; // StrictNullOverride: nulling out ok in dispose
if (this.disposeDelayer) {
this.disposeDelayer.cancel();
this.disposeDelayer = undefined;
}
this.disposeClient();
this.activeRequests.clear();
}

View File

@@ -206,7 +206,7 @@ export class SQLiteStorageDatabase implements IStorageDatabase {
return this.doUpdateItems(recoveryConnection, { insert: recovery() }).then(() => closeRecoveryConnection(), error => {
// In case of an error updating items, still ensure to close the connection
// to prevent SQLITE_BUSY errors when the connection is restablished
// to prevent SQLITE_BUSY errors when the connection is reestablished
closeRecoveryConnection();
return Promise.reject(error);

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { IDisposable, dispose, ReferenceCollection, Disposable as DisposableBase, toDisposable } from 'vs/base/common/lifecycle';
import { IDisposable, dispose, ReferenceCollection } from 'vs/base/common/lifecycle';
class Disposable implements IDisposable {
isDisposed = false;
@@ -50,38 +50,6 @@ suite('Lifecycle', () => {
});
});
suite('DisposableBase', () => {
test('register should not leak if object has already been disposed', () => {
let aCount = 0;
let bCount = 0;
const disposable = new class extends DisposableBase {
register(other: IDisposable) {
this._register(other);
}
};
disposable.register(toDisposable(() => ++aCount));
assert.strictEqual(aCount, 0);
assert.strictEqual(bCount, 0);
disposable.dispose();
assert.strictEqual(aCount, 1);
assert.strictEqual(bCount, 0);
// Any newly added disposables should be disposed of immediately
disposable.register(toDisposable(() => ++bCount));
assert.strictEqual(aCount, 1);
assert.strictEqual(bCount, 1);
// Further dispose calls should have no effect
disposable.dispose();
assert.strictEqual(aCount, 1);
assert.strictEqual(bCount, 1);
});
});
suite('Reference Collection', () => {
class Collection extends ReferenceCollection<number> {
private _count = 0;
@@ -118,4 +86,4 @@ suite('Reference Collection', () => {
ref4.dispose();
assert.equal(collection.count, 0);
});
});
});

View File

@@ -30,6 +30,7 @@
import * as assert from 'assert';
import * as path from 'vs/base/common/path';
import { isWindows } from 'vs/base/common/platform';
import * as process from 'vs/base/common/process';
suite('Paths (Node Implementation)', () => {
test('join', () => {