mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 02:02:35 -05:00
* Added Unified connection support * Use generic way to do expandNode. Cleanup the ported code and removed unreference code. Added as needed later. Resolved PR comments. * Minor fixes and removed timer for all expanders for now. If any providers can't response, the tree node will spin and wait. We may improve later. * Change handSessionClose to not thenable. Added a node to OE to show error message instead of reject. So we could show partial expanded result if get any. Resolve PR comments * Minor fixes of PR comments
28 lines
967 B
TypeScript
28 lines
967 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
'use strict';
|
|
|
|
import { Transform } from 'stream';
|
|
import * as vscode from 'vscode';
|
|
import * as nls from 'vscode-nls';
|
|
|
|
const localize = nls.loadMessageBundle();
|
|
|
|
export class CancelableStream extends Transform {
|
|
constructor(private cancelationToken: vscode.CancellationTokenSource) {
|
|
super();
|
|
}
|
|
|
|
public _transform(chunk: any, encoding: string, callback: Function): void {
|
|
if (this.cancelationToken && this.cancelationToken.token.isCancellationRequested) {
|
|
callback(new Error(localize('streamCanceled', 'Stream operation canceled by the user')));
|
|
} else {
|
|
this.push(chunk);
|
|
callback();
|
|
}
|
|
}
|
|
}
|