mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 17:20:28 -04:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -12,6 +12,7 @@ import { Emitter } from 'vs/base/common/event';
|
||||
import { fromEventEmitter } from 'vs/base/node/event';
|
||||
import { createQueuedSender } from 'vs/base/node/processes';
|
||||
import { ChannelServer as IPCServer, ChannelClient as IPCClient, IChannelClient, IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { isRemoteConsoleLog, log } from 'vs/base/node/console';
|
||||
|
||||
export class Server extends IPCServer {
|
||||
constructor() {
|
||||
@@ -89,7 +90,7 @@ export class Client implements IChannelClient, IDisposable {
|
||||
}
|
||||
|
||||
getChannel<T extends IChannel>(channelName: string): T {
|
||||
const call = (command, arg) => this.request(channelName, command, arg);
|
||||
const call = (command: string, arg: any) => this.request(channelName, command, arg);
|
||||
return { call } as T;
|
||||
}
|
||||
|
||||
@@ -151,24 +152,15 @@ export class Client implements IChannelClient, IDisposable {
|
||||
const onRawMessage = fromEventEmitter(this.child, 'message', msg => msg);
|
||||
|
||||
onRawMessage(msg => {
|
||||
// Handle console logs specially
|
||||
if (msg && msg.type === '__$console') {
|
||||
let args = ['%c[IPC Library: ' + this.options.serverName + ']', 'color: darkgreen'];
|
||||
try {
|
||||
const parsed = JSON.parse(msg.arguments);
|
||||
args = args.concat(Object.getOwnPropertyNames(parsed).map(o => parsed[o]));
|
||||
} catch (error) {
|
||||
args.push(msg.arguments);
|
||||
}
|
||||
|
||||
console[msg.severity].apply(console, args);
|
||||
// Handle remote console logs specially
|
||||
if (isRemoteConsoleLog(msg)) {
|
||||
log(msg, `IPC Library: ${this.options.serverName}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Anything else goes to the outside
|
||||
else {
|
||||
onMessageEmitter.fire(msg);
|
||||
}
|
||||
onMessageEmitter.fire(msg);
|
||||
});
|
||||
|
||||
const sender = this.options.useQueue ? createQueuedSender(this.child) : this.child;
|
||||
|
||||
Reference in New Issue
Block a user