vscode-jsonrpc
Advanced tools
Comparing version 2.3.2-next.3 to 2.3.2-next.4
@@ -26,3 +26,17 @@ import { Message, RequestMessage, RequestType, ResponseError, ErrorCodes, NotificationMessage, NotificationType } from './messages'; | ||
function fromString(value: string): Trace; | ||
function toString(value: Trace): string; | ||
} | ||
export interface SetTraceParams { | ||
value: 'off' | 'messages' | 'verbose'; | ||
} | ||
export declare namespace SetTraceNotification { | ||
const type: NotificationType<SetTraceParams>; | ||
} | ||
export interface LogTraceParams { | ||
message: string; | ||
verbose?: string; | ||
} | ||
export declare namespace LogTraceNotification { | ||
const type: NotificationType<LogTraceParams>; | ||
} | ||
export interface Tracer { | ||
@@ -36,3 +50,3 @@ log(message: string, data?: string): void; | ||
onNotification<P>(type: NotificationType<P>, handler: NotificationHandler<P>): void; | ||
trace(value: Trace, tracer: Tracer): void; | ||
trace(value: Trace, tracer: Tracer, sendNotification?: boolean): void; | ||
onError: Event<[Error, Message, number]>; | ||
@@ -39,0 +53,0 @@ onClose: Event<void>; |
@@ -48,3 +48,24 @@ /* -------------------------------------------------------------------------------------------- | ||
Trace.fromString = fromString; | ||
function toString(value) { | ||
switch (value) { | ||
case Trace.Off: | ||
return 'off'; | ||
case Trace.Messages: | ||
return 'messages'; | ||
case Trace.Verbose: | ||
return 'verbose'; | ||
default: | ||
return 'off'; | ||
} | ||
} | ||
Trace.toString = toString; | ||
})(Trace = exports.Trace || (exports.Trace = {})); | ||
var SetTraceNotification; | ||
(function (SetTraceNotification) { | ||
SetTraceNotification.type = { get method() { return '$/setTraceNotification'; } }; | ||
})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); | ||
var LogTraceNotification; | ||
(function (LogTraceNotification) { | ||
LogTraceNotification.type = { get method() { return '$/logTraceNotification'; } }; | ||
})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); | ||
var ConnectionState; | ||
@@ -298,2 +319,5 @@ (function (ConnectionState) { | ||
function traceReceivedNotification(message) { | ||
if (message.method === LogTraceNotification.type.method) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -414,3 +438,4 @@ if (trace === Trace.Verbose) { | ||
}, | ||
trace: function (_value, _tracer) { | ||
trace: function (_value, _tracer, sendNotification) { | ||
if (sendNotification === void 0) { sendNotification = false; } | ||
trace = _value; | ||
@@ -423,2 +448,5 @@ if (trace === Trace.Off) { | ||
} | ||
if (sendNotification && !isClosed() && !isDisposed()) { | ||
connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); | ||
} | ||
}, | ||
@@ -449,2 +477,8 @@ onError: errorEmitter.event, | ||
}; | ||
connection.onNotification(LogTraceNotification.type, function (params) { | ||
if (trace === Trace.Off) { | ||
return; | ||
} | ||
tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); | ||
}); | ||
return connection; | ||
@@ -451,0 +485,0 @@ } |
{ | ||
"name": "vscode-jsonrpc", | ||
"description": "A json rpc implementation over streams", | ||
"version": "2.3.2-next.3", | ||
"version": "2.3.2-next.4", | ||
"author": "Microsoft Corporation", | ||
@@ -14,2 +14,5 @@ "license": "MIT", | ||
}, | ||
"engines": { | ||
"node": ">=4.0.0 || >=6.0.0" | ||
}, | ||
"main": "./lib/main.js", | ||
@@ -16,0 +19,0 @@ "typings": "./lib/main", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65592
1570