vscode-jsonrpc
Advanced tools
Comparing version 3.0.1-alpha.3 to 3.0.1-alpha.5
@@ -11,7 +11,7 @@ import { Event } from './events'; | ||
*/ | ||
isCancellationRequested: boolean; | ||
readonly isCancellationRequested: boolean; | ||
/** | ||
* An [event](#Event) which fires upon cancellation. | ||
*/ | ||
onCancellationRequested: Event<any>; | ||
readonly onCancellationRequested: Event<any>; | ||
} | ||
@@ -18,0 +18,0 @@ export declare namespace CancellationToken { |
@@ -5,3 +5,3 @@ export interface Disposable { | ||
*/ | ||
dispose(): any; | ||
dispose(): void; | ||
} | ||
@@ -8,0 +8,0 @@ export declare namespace Disposable { |
@@ -37,7 +37,8 @@ /* -------------------------------------------------------------------------------------------- | ||
DisposableImpl.from = function () { | ||
var disposables = []; | ||
var _disposables = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
disposables[_i - 0] = arguments[_i]; | ||
_disposables[_i - 0] = arguments[_i]; | ||
} | ||
return new DisposableImpl(function () { | ||
var disposables = _disposables; | ||
if (disposables) { | ||
@@ -108,3 +109,3 @@ for (var _i = 0, disposables_1 = disposables; _i < disposables_1.length; _i++) { | ||
if (!this._callbacks) { | ||
return; | ||
return []; | ||
} | ||
@@ -111,0 +112,0 @@ var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); |
@@ -166,3 +166,3 @@ /// <reference path="thenable.d.ts" /> | ||
onUnhandledNotification: Event<NotificationMessage>; | ||
listen(): any; | ||
listen(): void; | ||
onDispose: Event<void>; | ||
@@ -169,0 +169,0 @@ dispose(): void; |
@@ -26,3 +26,3 @@ /* -------------------------------------------------------------------------------------------- | ||
(function (CancelNotification) { | ||
CancelNotification.type = { get method() { return '$/cancelRequest'; }, _: undefined }; | ||
CancelNotification.type = { get method() { return '$/cancelRequest'; } }; | ||
})(CancelNotification || (CancelNotification = {})); | ||
@@ -67,7 +67,7 @@ (function (Trace) { | ||
(function (SetTraceNotification) { | ||
SetTraceNotification.type = { get method() { return '$/setTraceNotification'; }, _: undefined }; | ||
SetTraceNotification.type = { get method() { return '$/setTraceNotification'; } }; | ||
})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); | ||
var LogTraceNotification; | ||
(function (LogTraceNotification) { | ||
LogTraceNotification.type = { get method() { return '$/logTraceNotification'; }, _: undefined }; | ||
LogTraceNotification.type = { get method() { return '$/logTraceNotification'; } }; | ||
})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); | ||
@@ -139,5 +139,3 @@ var ConnectionState; | ||
} | ||
if (trace != Trace.Off && tracer) { | ||
traceSendingResponse(message, method, startTime); | ||
} | ||
traceSendingResponse(message, method, startTime); | ||
messageWriter.write(message); | ||
@@ -151,5 +149,3 @@ } | ||
}; | ||
if (trace != Trace.Off && tracer) { | ||
traceSendingResponse(message, method, startTime); | ||
} | ||
traceSendingResponse(message, method, startTime); | ||
messageWriter.write(message); | ||
@@ -168,10 +164,6 @@ } | ||
}; | ||
if (trace != Trace.Off && tracer) { | ||
traceSendingResponse(message, method, startTime); | ||
} | ||
traceSendingResponse(message, method, startTime); | ||
messageWriter.write(message); | ||
} | ||
if (trace != Trace.Off && tracer) { | ||
traceReceviedRequest(requestMessage); | ||
} | ||
traceReceviedRequest(requestMessage); | ||
var requestHandler = requestHandlers[requestMessage.method]; | ||
@@ -245,9 +237,7 @@ var startTime = Date.now(); | ||
var responsePromise = responsePromises[key]; | ||
if (trace != Trace.Off && tracer) { | ||
traceReceviedResponse(responseMessage, responsePromise); | ||
} | ||
traceReceviedResponse(responseMessage, responsePromise); | ||
if (responsePromise) { | ||
delete responsePromises[key]; | ||
try { | ||
if (is.defined(responseMessage.error)) { | ||
if (responseMessage.error && is.defined(responseMessage.error)) { | ||
var error = responseMessage.error; | ||
@@ -293,5 +283,3 @@ responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); | ||
try { | ||
if (trace != Trace.Off && tracer) { | ||
traceReceivedNotification(message); | ||
} | ||
traceReceivedNotification(message); | ||
if (is.nil(message.params)) { | ||
@@ -337,2 +325,5 @@ notificationHandler(); | ||
function traceSendingRequest(message) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -345,2 +336,5 @@ if (trace === Trace.Verbose && message.params) { | ||
function traceSendNotification(message) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -358,2 +352,5 @@ if (trace === Trace.Verbose) { | ||
function traceSendingResponse(message, method, startTime) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -376,2 +373,5 @@ if (trace === Trace.Verbose) { | ||
function traceReceviedRequest(message) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -384,3 +384,3 @@ if (trace === Trace.Verbose && message.params) { | ||
function traceReceivedNotification(message) { | ||
if (message.method === LogTraceNotification.type.method) { | ||
if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { | ||
return; | ||
@@ -400,2 +400,5 @@ } | ||
function traceReceviedResponse(message, responsePromise) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
} | ||
var data = undefined; | ||
@@ -474,5 +477,3 @@ if (trace === Trace.Verbose) { | ||
}; | ||
if (trace != Trace.Off && tracer) { | ||
traceSendNotification(notificatioMessage); | ||
} | ||
traceSendNotification(notificatioMessage); | ||
messageWriter.write(notificatioMessage); | ||
@@ -531,5 +532,3 @@ }, | ||
var responsePromise = { method: method, timerStart: Date.now(), resolve: resolve, reject: reject }; | ||
if (trace != Trace.Off && tracer) { | ||
traceSendingRequest(requestMessage); | ||
} | ||
traceSendingRequest(requestMessage); | ||
try { | ||
@@ -548,3 +547,3 @@ messageWriter.write(requestMessage); | ||
if (token) { | ||
token.onCancellationRequested(function (event) { | ||
token.onCancellationRequested(function () { | ||
connection.sendNotification(CancelNotification.type, { id: id }); | ||
@@ -563,3 +562,3 @@ }); | ||
if (trace === Trace.Off) { | ||
tracer = null; | ||
tracer = undefined; | ||
} | ||
@@ -598,3 +597,3 @@ else { | ||
connection.onNotification(LogTraceNotification.type, function (params) { | ||
if (trace === Trace.Off) { | ||
if (trace === Trace.Off || !tracer) { | ||
return; | ||
@@ -601,0 +600,0 @@ } |
@@ -9,9 +9,9 @@ /// <reference types="node" /> | ||
export interface PartialMessageInfo { | ||
messageToken: number; | ||
waitingTime: number; | ||
readonly messageToken: number; | ||
readonly waitingTime: number; | ||
} | ||
export interface MessageReader { | ||
onError: Event<Error>; | ||
onClose: Event<void>; | ||
onPartialMessage: Event<PartialMessageInfo>; | ||
readonly onError: Event<Error>; | ||
readonly onClose: Event<void>; | ||
readonly onPartialMessage: Event<PartialMessageInfo>; | ||
listen(callback: DataCallback): void; | ||
@@ -18,0 +18,0 @@ } |
@@ -99,43 +99,43 @@ /// <reference types="node" /> | ||
export interface RequestType0<R, E, RO> extends MessageType { | ||
_: [R, E, RO, _EM]; | ||
_?: [R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType<P, R, E, RO> extends MessageType { | ||
_: [P, R, E, RO, _EM]; | ||
_?: [P, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType1<P1, R, E, RO> extends MessageType { | ||
_: [P1, R, E, RO, _EM]; | ||
_?: [P1, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType2<P1, P2, R, E, RO> extends MessageType { | ||
_: [P1, P2, R, E, RO, _EM]; | ||
_?: [P1, P2, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType3<P1, P2, P3, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType4<P1, P2, P3, P4, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType5<P1, P2, P3, P4, P5, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType6<P1, P2, P3, P4, P5, P6, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType7<P1, P2, P3, P4, P5, P6, P7, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType8<P1, P2, P3, P4, P5, P6, P7, P8, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, P8, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, P8, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface RequestType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E, RO, _EM]; | ||
registerOptions?: RO; | ||
@@ -160,43 +160,43 @@ } | ||
export interface NotificationType<P, RO> extends MessageType { | ||
_: [P, RO, _EM]; | ||
_?: [P, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType0<RO> extends MessageType { | ||
_: [RO, _EM]; | ||
_?: [RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType1<P1, RO> extends MessageType { | ||
_: [P1, RO, _EM]; | ||
_?: [P1, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType2<P1, P2, RO> extends MessageType { | ||
_: [P1, P2, RO, _EM]; | ||
_?: [P1, P2, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType3<P1, P2, P3, RO> extends MessageType { | ||
_: [P1, P2, P3, RO, _EM]; | ||
_?: [P1, P2, P3, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType4<P1, P2, P3, P4, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, RO, _EM]; | ||
_?: [P1, P2, P3, P4, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType5<P1, P2, P3, P4, P5, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType6<P1, P2, P3, P4, P5, P6, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType7<P1, P2, P3, P4, P5, P6, P7, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType8<P1, P2, P3, P4, P5, P6, P7, P8, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, P8, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, P8, RO, _EM]; | ||
registerOptions?: RO; | ||
} | ||
export interface NotificationType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, RO> extends MessageType { | ||
_: [P1, P2, P3, P4, P5, P6, P7, P8, P9, RO, _EM]; | ||
_?: [P1, P2, P3, P4, P5, P6, P7, P8, P9, RO, _EM]; | ||
registerOptions?: RO; | ||
@@ -203,0 +203,0 @@ } |
@@ -39,3 +39,3 @@ /* -------------------------------------------------------------------------------------------- | ||
this.message = message; | ||
if (is.defined(data)) { | ||
if (data && is.defined(data)) { | ||
this.data = data; | ||
@@ -42,0 +42,0 @@ } |
@@ -6,4 +6,4 @@ /// <reference types="node" /> | ||
export interface MessageWriter { | ||
onError: Event<[Error, Message, number]>; | ||
onClose: Event<void>; | ||
readonly onError: Event<[Error, Message | undefined, number | undefined]>; | ||
readonly onClose: Event<void>; | ||
write(msg: Message): void; | ||
@@ -10,0 +10,0 @@ } |
@@ -98,4 +98,6 @@ /* -------------------------------------------------------------------------------------------- | ||
try { | ||
this.process.send(msg); | ||
this.errorCount = 0; | ||
if (this.process.send) { | ||
this.process.send(msg); | ||
this.errorCount = 0; | ||
} | ||
} | ||
@@ -102,0 +104,0 @@ catch (error) { |
{ | ||
"name": "vscode-jsonrpc", | ||
"description": "A json rpc implementation over streams", | ||
"version": "3.0.1-alpha.3", | ||
"version": "3.0.1-alpha.5", | ||
"author": "Microsoft Corporation", | ||
@@ -21,3 +21,3 @@ "license": "MIT", | ||
"mocha": "^3.1.0", | ||
"typescript": "^2.0.3", | ||
"typescript": "^2.0.10", | ||
"@types/node": "^6.0.42", | ||
@@ -24,0 +24,0 @@ "@types/mocha": "^2.2.32" |
@@ -52,19 +52,10 @@ # VSCode JSON RPC | ||
- converted the NPM module to use TypeScript 2.0.3 | ||
- converted the NPM module to use TypeScript 2.0.3. | ||
- added strict null support. | ||
- support for passing more than one parameter to a request or notification. | ||
- Breaking changes: | ||
- due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to | ||
- due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to | ||
TypeScript 2.0.3 as well. | ||
- Request and notification types have an additional property '_'. This property is to improve TypeScript type | ||
inference and can savely be set to undefined when a request of notification type is created. For example: | ||
```ts | ||
export namespace CompletionRequest { | ||
export const type: RequestType<TextDocumentPositionParams, CompletionItem[] | CompletionList, void> = { | ||
get method() { return 'textDocument/completion'; }, | ||
_: undefined | ||
}; | ||
} | ||
``` | ||
## License | ||
[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) |
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
1913
85063
60