🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
11
node_modules/vscode-jsonrpc/License.txt
generated
vendored
Normal file
11
node_modules/vscode-jsonrpc/License.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
69
node_modules/vscode-jsonrpc/README.md
generated
vendored
Normal file
69
node_modules/vscode-jsonrpc/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# VSCode JSON RPC
|
||||
|
||||
[](https://npmjs.org/package/vscode-jsonrpc)
|
||||
[](https://npmjs.org/package/vscode-jsonrpc)
|
||||
[](https://travis-ci.org/Microsoft/vscode-languageserver-node)
|
||||
|
||||
This npm module implements the base messaging protocol spoken between a VSCode language server and a VSCode language client.
|
||||
|
||||
The npm module can also be used standalone to establish a [JSON-RPC](http://www.jsonrpc.org/) channel between
|
||||
a client and a server. Below an example how to setup a JSON-RPC connection. First the client side.
|
||||
|
||||
```ts
|
||||
import * as cp from 'child_process';
|
||||
import * as rpc from 'vscode-jsonrpc/node';
|
||||
|
||||
let childProcess = cp.spawn(...);
|
||||
|
||||
// Use stdin and stdout for communication:
|
||||
let connection = rpc.createMessageConnection(
|
||||
new rpc.StreamMessageReader(childProcess.stdout),
|
||||
new rpc.StreamMessageWriter(childProcess.stdin));
|
||||
|
||||
let notification = new rpc.NotificationType<string, void>('testNotification');
|
||||
|
||||
connection.listen();
|
||||
|
||||
connection.sendNotification(notification, 'Hello World');
|
||||
```
|
||||
|
||||
The server side looks very symmetrical:
|
||||
|
||||
```ts
|
||||
import * as rpc from 'vscode-jsonrpc/node';
|
||||
|
||||
|
||||
let connection = rpc.createMessageConnection(
|
||||
new rpc.StreamMessageReader(process.stdin),
|
||||
new rpc.StreamMessageWriter(process.stdout));
|
||||
|
||||
let notification = new rpc.NotificationType<string, void>('testNotification');
|
||||
connection.onNotification(notification, (param: string) => {
|
||||
console.log(param); // This prints Hello World
|
||||
});
|
||||
|
||||
connection.listen();
|
||||
```
|
||||
|
||||
# History
|
||||
|
||||
### 5.0.0
|
||||
|
||||
- add progress support
|
||||
- move JS target to ES2017
|
||||
|
||||
### 4.0.0
|
||||
|
||||
- move JS target to ES6.
|
||||
|
||||
### 3.0.0:
|
||||
|
||||
- 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
|
||||
TypeScript 2.0.3 as well.
|
||||
|
||||
## License
|
||||
[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt)
|
||||
6
node_modules/vscode-jsonrpc/browser.d.ts
generated
vendored
Normal file
6
node_modules/vscode-jsonrpc/browser.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
|
||||
export * from './lib/browser/main';
|
||||
7
node_modules/vscode-jsonrpc/browser.js
generated
vendored
Normal file
7
node_modules/vscode-jsonrpc/browser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/browser/main');
|
||||
17
node_modules/vscode-jsonrpc/lib/browser/main.d.ts
generated
vendored
Normal file
17
node_modules/vscode-jsonrpc/lib/browser/main.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { AbstractMessageReader, DataCallback, AbstractMessageWriter, Message, Disposable, ConnectionStrategy, ConnectionOptions, MessageReader, MessageWriter, Logger, MessageConnection } from '../common/api';
|
||||
export * from '../common/api';
|
||||
export declare class BrowserMessageReader extends AbstractMessageReader implements MessageReader {
|
||||
private _onData;
|
||||
private _messageListener;
|
||||
constructor(port: MessagePort | Worker | DedicatedWorkerGlobalScope);
|
||||
listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export declare class BrowserMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
||||
private port;
|
||||
private errorCount;
|
||||
constructor(port: MessagePort | Worker | DedicatedWorkerGlobalScope);
|
||||
write(msg: Message): Promise<void>;
|
||||
private handleError;
|
||||
end(): void;
|
||||
}
|
||||
export declare function createMessageConnection(reader: MessageReader, writer: MessageWriter, logger?: Logger, options?: ConnectionStrategy | ConnectionOptions): MessageConnection;
|
||||
76
node_modules/vscode-jsonrpc/lib/browser/main.js
generated
vendored
Normal file
76
node_modules/vscode-jsonrpc/lib/browser/main.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createMessageConnection = exports.BrowserMessageWriter = exports.BrowserMessageReader = void 0;
|
||||
const ril_1 = require("./ril");
|
||||
// Install the browser runtime abstract.
|
||||
ril_1.default.install();
|
||||
const api_1 = require("../common/api");
|
||||
__exportStar(require("../common/api"), exports);
|
||||
class BrowserMessageReader extends api_1.AbstractMessageReader {
|
||||
constructor(port) {
|
||||
super();
|
||||
this._onData = new api_1.Emitter();
|
||||
this._messageListener = (event) => {
|
||||
this._onData.fire(event.data);
|
||||
};
|
||||
port.addEventListener('error', (event) => this.fireError(event));
|
||||
port.onmessage = this._messageListener;
|
||||
}
|
||||
listen(callback) {
|
||||
return this._onData.event(callback);
|
||||
}
|
||||
}
|
||||
exports.BrowserMessageReader = BrowserMessageReader;
|
||||
class BrowserMessageWriter extends api_1.AbstractMessageWriter {
|
||||
constructor(port) {
|
||||
super();
|
||||
this.port = port;
|
||||
this.errorCount = 0;
|
||||
port.addEventListener('error', (event) => this.fireError(event));
|
||||
}
|
||||
write(msg) {
|
||||
try {
|
||||
this.port.postMessage(msg);
|
||||
return Promise.resolve();
|
||||
}
|
||||
catch (error) {
|
||||
this.handleError(error, msg);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
handleError(error, msg) {
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
end() {
|
||||
}
|
||||
}
|
||||
exports.BrowserMessageWriter = BrowserMessageWriter;
|
||||
function createMessageConnection(reader, writer, logger, options) {
|
||||
if (logger === undefined) {
|
||||
logger = api_1.NullLogger;
|
||||
}
|
||||
if (api_1.ConnectionStrategy.is(options)) {
|
||||
options = { connectionStrategy: options };
|
||||
}
|
||||
return (0, api_1.createMessageConnection)(reader, writer, logger, options);
|
||||
}
|
||||
exports.createMessageConnection = createMessageConnection;
|
||||
12
node_modules/vscode-jsonrpc/lib/browser/ril.d.ts
generated
vendored
Normal file
12
node_modules/vscode-jsonrpc/lib/browser/ril.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { RAL } from '../common/api';
|
||||
interface RIL extends RAL {
|
||||
readonly stream: {
|
||||
readonly asReadableStream: (stream: WebSocket) => RAL.ReadableStream;
|
||||
readonly asWritableStream: (stream: WebSocket) => RAL.WritableStream;
|
||||
};
|
||||
}
|
||||
declare function RIL(): RIL;
|
||||
declare namespace RIL {
|
||||
function install(): void;
|
||||
}
|
||||
export default RIL;
|
||||
156
node_modules/vscode-jsonrpc/lib/browser/ril.js
generated
vendored
Normal file
156
node_modules/vscode-jsonrpc/lib/browser/ril.js
generated
vendored
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const api_1 = require("../common/api");
|
||||
class MessageBuffer extends api_1.AbstractMessageBuffer {
|
||||
constructor(encoding = 'utf-8') {
|
||||
super(encoding);
|
||||
this.asciiDecoder = new TextDecoder('ascii');
|
||||
}
|
||||
emptyBuffer() {
|
||||
return MessageBuffer.emptyBuffer;
|
||||
}
|
||||
fromString(value, _encoding) {
|
||||
return (new TextEncoder()).encode(value);
|
||||
}
|
||||
toString(value, encoding) {
|
||||
if (encoding === 'ascii') {
|
||||
return this.asciiDecoder.decode(value);
|
||||
}
|
||||
else {
|
||||
return (new TextDecoder(encoding)).decode(value);
|
||||
}
|
||||
}
|
||||
asNative(buffer, length) {
|
||||
if (length === undefined) {
|
||||
return buffer;
|
||||
}
|
||||
else {
|
||||
return buffer.slice(0, length);
|
||||
}
|
||||
}
|
||||
allocNative(length) {
|
||||
return new Uint8Array(length);
|
||||
}
|
||||
}
|
||||
MessageBuffer.emptyBuffer = new Uint8Array(0);
|
||||
class ReadableStreamWrapper {
|
||||
constructor(socket) {
|
||||
this.socket = socket;
|
||||
this._onData = new api_1.Emitter();
|
||||
this._messageListener = (event) => {
|
||||
const blob = event.data;
|
||||
blob.arrayBuffer().then((buffer) => {
|
||||
this._onData.fire(new Uint8Array(buffer));
|
||||
}, () => {
|
||||
(0, api_1.RAL)().console.error(`Converting blob to array buffer failed.`);
|
||||
});
|
||||
};
|
||||
this.socket.addEventListener('message', this._messageListener);
|
||||
}
|
||||
onClose(listener) {
|
||||
this.socket.addEventListener('close', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.socket.addEventListener('error', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.socket.addEventListener('end', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('end', listener));
|
||||
}
|
||||
onData(listener) {
|
||||
return this._onData.event(listener);
|
||||
}
|
||||
}
|
||||
class WritableStreamWrapper {
|
||||
constructor(socket) {
|
||||
this.socket = socket;
|
||||
}
|
||||
onClose(listener) {
|
||||
this.socket.addEventListener('close', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.socket.addEventListener('error', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.socket.addEventListener('end', listener);
|
||||
return api_1.Disposable.create(() => this.socket.removeEventListener('end', listener));
|
||||
}
|
||||
write(data, encoding) {
|
||||
if (typeof data === 'string') {
|
||||
if (encoding !== undefined && encoding !== 'utf-8') {
|
||||
throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`);
|
||||
}
|
||||
this.socket.send(data);
|
||||
}
|
||||
else {
|
||||
this.socket.send(data);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
end() {
|
||||
this.socket.close();
|
||||
}
|
||||
}
|
||||
const _textEncoder = new TextEncoder();
|
||||
const _ril = Object.freeze({
|
||||
messageBuffer: Object.freeze({
|
||||
create: (encoding) => new MessageBuffer(encoding)
|
||||
}),
|
||||
applicationJson: Object.freeze({
|
||||
encoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
encode: (msg, options) => {
|
||||
if (options.charset !== 'utf-8') {
|
||||
throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options.charset}`);
|
||||
}
|
||||
return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, undefined, 0)));
|
||||
}
|
||||
}),
|
||||
decoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
decode: (buffer, options) => {
|
||||
if (!(buffer instanceof Uint8Array)) {
|
||||
throw new Error(`In a Browser environments only Uint8Arrays are supported.`);
|
||||
}
|
||||
return Promise.resolve(JSON.parse(new TextDecoder(options.charset).decode(buffer)));
|
||||
}
|
||||
})
|
||||
}),
|
||||
stream: Object.freeze({
|
||||
asReadableStream: (socket) => new ReadableStreamWrapper(socket),
|
||||
asWritableStream: (socket) => new WritableStreamWrapper(socket)
|
||||
}),
|
||||
console: console,
|
||||
timer: Object.freeze({
|
||||
setTimeout(callback, ms, ...args) {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setImmediate(callback, ...args) {
|
||||
const handle = setTimeout(callback, 0, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setInterval(callback, ms, ...args) {
|
||||
const handle = setInterval(callback, ms, ...args);
|
||||
return { dispose: () => clearInterval(handle) };
|
||||
},
|
||||
})
|
||||
});
|
||||
function RIL() {
|
||||
return _ril;
|
||||
}
|
||||
(function (RIL) {
|
||||
function install() {
|
||||
api_1.RAL.install(_ril);
|
||||
}
|
||||
RIL.install = install;
|
||||
})(RIL || (RIL = {}));
|
||||
exports.default = RIL;
|
||||
14
node_modules/vscode-jsonrpc/lib/common/api.d.ts
generated
vendored
Normal file
14
node_modules/vscode-jsonrpc/lib/common/api.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/// <reference path="../../typings/thenable.d.ts" />
|
||||
import { Message, MessageSignature, RequestMessage, RequestType, RequestType0, RequestType1, RequestType2, RequestType3, RequestType4, RequestType5, RequestType6, RequestType7, RequestType8, RequestType9, ResponseError, ErrorCodes, NotificationMessage, NotificationType, NotificationType0, NotificationType1, NotificationType2, NotificationType3, NotificationType4, NotificationType5, NotificationType6, NotificationType7, NotificationType8, NotificationType9, ResponseMessage, ParameterStructures, _EM } from './messages';
|
||||
import { LinkedMap, LRUCache, Touch } from './linkedMap';
|
||||
import { Disposable } from './disposable';
|
||||
import { Event, Emitter } from './events';
|
||||
import { AbstractCancellationTokenSource, CancellationTokenSource, CancellationToken } from './cancellation';
|
||||
import { SharedArraySenderStrategy, SharedArrayReceiverStrategy } from './sharedArrayCancellation';
|
||||
import { MessageReader, AbstractMessageReader, ReadableStreamMessageReader, DataCallback, MessageReaderOptions, PartialMessageInfo } from './messageReader';
|
||||
import { MessageWriter, AbstractMessageWriter, WriteableStreamMessageWriter, MessageWriterOptions } from './messageWriter';
|
||||
import { AbstractMessageBuffer } from './messageBuffer';
|
||||
import { ContentTypeEncoderOptions, ContentTypeDecoderOptions } from './encoding';
|
||||
import { Logger, ConnectionStrategy, ConnectionOptions, MessageConnection, NullLogger, createMessageConnection, ProgressToken, ProgressType, HandlerResult, StarRequestHandler, GenericRequestHandler, RequestHandler0, RequestHandler, RequestHandler1, RequestHandler2, RequestHandler3, RequestHandler4, RequestHandler5, RequestHandler6, RequestHandler7, RequestHandler8, RequestHandler9, StarNotificationHandler, GenericNotificationHandler, NotificationHandler0, NotificationHandler, NotificationHandler1, NotificationHandler2, NotificationHandler3, NotificationHandler4, NotificationHandler5, NotificationHandler6, NotificationHandler7, NotificationHandler8, NotificationHandler9, Trace, TraceValues, TraceFormat, TraceOptions, SetTraceParams, SetTraceNotification, LogTraceParams, LogTraceNotification, Tracer, ConnectionErrors, ConnectionError, CancellationId, CancellationReceiverStrategy, CancellationSenderStrategy, CancellationStrategy, MessageStrategy } from './connection';
|
||||
import RAL from './ral';
|
||||
export { RAL, Message, MessageSignature, RequestMessage, RequestType, RequestType0, RequestType1, RequestType2, RequestType3, RequestType4, RequestType5, RequestType6, RequestType7, RequestType8, RequestType9, ResponseError, ErrorCodes, NotificationMessage, NotificationType, NotificationType0, NotificationType1, NotificationType2, NotificationType3, NotificationType4, NotificationType5, NotificationType6, NotificationType7, NotificationType8, NotificationType9, ResponseMessage, ParameterStructures, _EM, LinkedMap, Touch, LRUCache, Disposable, Event, Emitter, AbstractCancellationTokenSource, CancellationTokenSource, CancellationToken, SharedArraySenderStrategy, SharedArrayReceiverStrategy, MessageReader, AbstractMessageReader, ReadableStreamMessageReader, DataCallback, MessageReaderOptions, PartialMessageInfo, MessageWriter, AbstractMessageWriter, WriteableStreamMessageWriter, MessageWriterOptions, AbstractMessageBuffer, ContentTypeEncoderOptions, ContentTypeDecoderOptions, Logger, ConnectionStrategy, ConnectionOptions, MessageConnection, NullLogger, createMessageConnection, ProgressToken, ProgressType, HandlerResult, StarRequestHandler, GenericRequestHandler, RequestHandler0, RequestHandler, RequestHandler1, RequestHandler2, RequestHandler3, RequestHandler4, RequestHandler5, RequestHandler6, RequestHandler7, RequestHandler8, RequestHandler9, StarNotificationHandler, GenericNotificationHandler, NotificationHandler0, NotificationHandler, NotificationHandler1, NotificationHandler2, NotificationHandler3, NotificationHandler4, NotificationHandler5, NotificationHandler6, NotificationHandler7, NotificationHandler8, NotificationHandler9, Trace, TraceValues, TraceFormat, TraceOptions, SetTraceParams, SetTraceNotification, LogTraceParams, LogTraceNotification, Tracer, ConnectionErrors, ConnectionError, CancellationId, CancellationReceiverStrategy, CancellationSenderStrategy, CancellationStrategy, MessageStrategy };
|
||||
81
node_modules/vscode-jsonrpc/lib/common/api.js
generated
vendored
Normal file
81
node_modules/vscode-jsonrpc/lib/common/api.js
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
/// <reference path="../../typings/thenable.d.ts" />
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ProgressType = exports.ProgressToken = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.AbstractMessageBuffer = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.LRUCache = exports.Touch = exports.LinkedMap = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.Message = exports.RAL = void 0;
|
||||
exports.MessageStrategy = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.TraceValues = exports.Trace = void 0;
|
||||
const messages_1 = require("./messages");
|
||||
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return messages_1.Message; } });
|
||||
Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages_1.RequestType; } });
|
||||
Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages_1.RequestType0; } });
|
||||
Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages_1.RequestType1; } });
|
||||
Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages_1.RequestType2; } });
|
||||
Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages_1.RequestType3; } });
|
||||
Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages_1.RequestType4; } });
|
||||
Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages_1.RequestType5; } });
|
||||
Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages_1.RequestType6; } });
|
||||
Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages_1.RequestType7; } });
|
||||
Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages_1.RequestType8; } });
|
||||
Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages_1.RequestType9; } });
|
||||
Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages_1.ResponseError; } });
|
||||
Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages_1.ErrorCodes; } });
|
||||
Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages_1.NotificationType; } });
|
||||
Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages_1.NotificationType0; } });
|
||||
Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages_1.NotificationType1; } });
|
||||
Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages_1.NotificationType2; } });
|
||||
Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages_1.NotificationType3; } });
|
||||
Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages_1.NotificationType4; } });
|
||||
Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages_1.NotificationType5; } });
|
||||
Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages_1.NotificationType6; } });
|
||||
Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages_1.NotificationType7; } });
|
||||
Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages_1.NotificationType8; } });
|
||||
Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages_1.NotificationType9; } });
|
||||
Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages_1.ParameterStructures; } });
|
||||
const linkedMap_1 = require("./linkedMap");
|
||||
Object.defineProperty(exports, "LinkedMap", { enumerable: true, get: function () { return linkedMap_1.LinkedMap; } });
|
||||
Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return linkedMap_1.LRUCache; } });
|
||||
Object.defineProperty(exports, "Touch", { enumerable: true, get: function () { return linkedMap_1.Touch; } });
|
||||
const disposable_1 = require("./disposable");
|
||||
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable_1.Disposable; } });
|
||||
const events_1 = require("./events");
|
||||
Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events_1.Event; } });
|
||||
Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events_1.Emitter; } });
|
||||
const cancellation_1 = require("./cancellation");
|
||||
Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } });
|
||||
Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation_1.CancellationToken; } });
|
||||
const sharedArrayCancellation_1 = require("./sharedArrayCancellation");
|
||||
Object.defineProperty(exports, "SharedArraySenderStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArraySenderStrategy; } });
|
||||
Object.defineProperty(exports, "SharedArrayReceiverStrategy", { enumerable: true, get: function () { return sharedArrayCancellation_1.SharedArrayReceiverStrategy; } });
|
||||
const messageReader_1 = require("./messageReader");
|
||||
Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader_1.MessageReader; } });
|
||||
Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } });
|
||||
Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } });
|
||||
const messageWriter_1 = require("./messageWriter");
|
||||
Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter_1.MessageWriter; } });
|
||||
Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } });
|
||||
Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } });
|
||||
const messageBuffer_1 = require("./messageBuffer");
|
||||
Object.defineProperty(exports, "AbstractMessageBuffer", { enumerable: true, get: function () { return messageBuffer_1.AbstractMessageBuffer; } });
|
||||
const connection_1 = require("./connection");
|
||||
Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection_1.ConnectionStrategy; } });
|
||||
Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection_1.ConnectionOptions; } });
|
||||
Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection_1.NullLogger; } });
|
||||
Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection_1.createMessageConnection; } });
|
||||
Object.defineProperty(exports, "ProgressToken", { enumerable: true, get: function () { return connection_1.ProgressToken; } });
|
||||
Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection_1.ProgressType; } });
|
||||
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection_1.Trace; } });
|
||||
Object.defineProperty(exports, "TraceValues", { enumerable: true, get: function () { return connection_1.TraceValues; } });
|
||||
Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection_1.TraceFormat; } });
|
||||
Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection_1.SetTraceNotification; } });
|
||||
Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection_1.LogTraceNotification; } });
|
||||
Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection_1.ConnectionErrors; } });
|
||||
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection_1.ConnectionError; } });
|
||||
Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } });
|
||||
Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } });
|
||||
Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection_1.CancellationStrategy; } });
|
||||
Object.defineProperty(exports, "MessageStrategy", { enumerable: true, get: function () { return connection_1.MessageStrategy; } });
|
||||
const ral_1 = require("./ral");
|
||||
exports.RAL = ral_1.default;
|
||||
32
node_modules/vscode-jsonrpc/lib/common/cancellation.d.ts
generated
vendored
Normal file
32
node_modules/vscode-jsonrpc/lib/common/cancellation.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Event } from './events';
|
||||
import { Disposable } from './disposable';
|
||||
/**
|
||||
* Defines a CancellationToken. This interface is not
|
||||
* intended to be implemented. A CancellationToken must
|
||||
* be created via a CancellationTokenSource.
|
||||
*/
|
||||
export interface CancellationToken {
|
||||
/**
|
||||
* Is `true` when the token has been cancelled, `false` otherwise.
|
||||
*/
|
||||
readonly isCancellationRequested: boolean;
|
||||
/**
|
||||
* An {@link Event event} which fires upon cancellation.
|
||||
*/
|
||||
readonly onCancellationRequested: Event<any>;
|
||||
}
|
||||
export declare namespace CancellationToken {
|
||||
const None: CancellationToken;
|
||||
const Cancelled: CancellationToken;
|
||||
function is(value: any): value is CancellationToken;
|
||||
}
|
||||
export interface AbstractCancellationTokenSource extends Disposable {
|
||||
token: CancellationToken;
|
||||
cancel(): void;
|
||||
}
|
||||
export declare class CancellationTokenSource implements AbstractCancellationTokenSource {
|
||||
private _token;
|
||||
get token(): CancellationToken;
|
||||
cancel(): void;
|
||||
dispose(): void;
|
||||
}
|
||||
96
node_modules/vscode-jsonrpc/lib/common/cancellation.js
generated
vendored
Normal file
96
node_modules/vscode-jsonrpc/lib/common/cancellation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CancellationTokenSource = exports.CancellationToken = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
const Is = require("./is");
|
||||
const events_1 = require("./events");
|
||||
var CancellationToken;
|
||||
(function (CancellationToken) {
|
||||
CancellationToken.None = Object.freeze({
|
||||
isCancellationRequested: false,
|
||||
onCancellationRequested: events_1.Event.None
|
||||
});
|
||||
CancellationToken.Cancelled = Object.freeze({
|
||||
isCancellationRequested: true,
|
||||
onCancellationRequested: events_1.Event.None
|
||||
});
|
||||
function is(value) {
|
||||
const candidate = value;
|
||||
return candidate && (candidate === CancellationToken.None
|
||||
|| candidate === CancellationToken.Cancelled
|
||||
|| (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
|
||||
}
|
||||
CancellationToken.is = is;
|
||||
})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
|
||||
const shortcutEvent = Object.freeze(function (callback, context) {
|
||||
const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0);
|
||||
return { dispose() { handle.dispose(); } };
|
||||
});
|
||||
class MutableToken {
|
||||
constructor() {
|
||||
this._isCancelled = false;
|
||||
}
|
||||
cancel() {
|
||||
if (!this._isCancelled) {
|
||||
this._isCancelled = true;
|
||||
if (this._emitter) {
|
||||
this._emitter.fire(undefined);
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
get isCancellationRequested() {
|
||||
return this._isCancelled;
|
||||
}
|
||||
get onCancellationRequested() {
|
||||
if (this._isCancelled) {
|
||||
return shortcutEvent;
|
||||
}
|
||||
if (!this._emitter) {
|
||||
this._emitter = new events_1.Emitter();
|
||||
}
|
||||
return this._emitter.event;
|
||||
}
|
||||
dispose() {
|
||||
if (this._emitter) {
|
||||
this._emitter.dispose();
|
||||
this._emitter = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
class CancellationTokenSource {
|
||||
get token() {
|
||||
if (!this._token) {
|
||||
// be lazy and create the token only when
|
||||
// actually needed
|
||||
this._token = new MutableToken();
|
||||
}
|
||||
return this._token;
|
||||
}
|
||||
cancel() {
|
||||
if (!this._token) {
|
||||
// save an object by returning the default
|
||||
// cancelled token when cancellation happens
|
||||
// before someone asks for the token
|
||||
this._token = CancellationToken.Cancelled;
|
||||
}
|
||||
else {
|
||||
this._token.cancel();
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
if (!this._token) {
|
||||
// ensure to initialize with an empty token if we had none
|
||||
this._token = CancellationToken.None;
|
||||
}
|
||||
else if (this._token instanceof MutableToken) {
|
||||
// actually dispose
|
||||
this._token.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.CancellationTokenSource = CancellationTokenSource;
|
||||
358
node_modules/vscode-jsonrpc/lib/common/connection.d.ts
generated
vendored
Normal file
358
node_modules/vscode-jsonrpc/lib/common/connection.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
import { Message, RequestMessage, RequestType, RequestType0, RequestType1, RequestType2, RequestType3, RequestType4, RequestType5, RequestType6, RequestType7, RequestType8, RequestType9, ResponseMessage, ResponseError, NotificationMessage, NotificationType, NotificationType0, NotificationType1, NotificationType2, NotificationType3, NotificationType4, NotificationType5, NotificationType6, NotificationType7, NotificationType8, NotificationType9, _EM, ParameterStructures } from './messages';
|
||||
import type { Disposable } from './disposable';
|
||||
import { Event } from './events';
|
||||
import { CancellationToken, AbstractCancellationTokenSource } from './cancellation';
|
||||
import { MessageReader } from './messageReader';
|
||||
import { MessageWriter } from './messageWriter';
|
||||
export declare type ProgressToken = number | string;
|
||||
export declare namespace ProgressToken {
|
||||
function is(value: any): value is number | string;
|
||||
}
|
||||
interface ProgressParams<T> {
|
||||
/**
|
||||
* The progress token provided by the client or server.
|
||||
*/
|
||||
token: ProgressToken;
|
||||
/**
|
||||
* The progress data.
|
||||
*/
|
||||
value: T;
|
||||
}
|
||||
export declare class ProgressType<PR> {
|
||||
/**
|
||||
* Clients must not use these properties. They are here to ensure correct typing.
|
||||
* in TypeScript
|
||||
*/
|
||||
readonly __?: [PR, _EM];
|
||||
readonly _pr?: PR;
|
||||
constructor();
|
||||
}
|
||||
export declare type HandlerResult<R, E> = R | ResponseError<E> | Thenable<R> | Thenable<ResponseError<E>> | Thenable<R | ResponseError<E>>;
|
||||
export interface StarRequestHandler {
|
||||
(method: string, params: any[] | object | undefined, token: CancellationToken): HandlerResult<any, any>;
|
||||
}
|
||||
export interface GenericRequestHandler<R, E> {
|
||||
(...params: any[]): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler0<R, E> {
|
||||
(token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler<P, R, E> {
|
||||
(params: P, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler1<P1, R, E> {
|
||||
(p1: P1, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler2<P1, P2, R, E> {
|
||||
(p1: P1, p2: P2, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler3<P1, P2, P3, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler4<P1, P2, P3, P4, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler5<P1, P2, P3, P4, P5, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler6<P1, P2, P3, P4, P5, P6, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler7<P1, P2, P3, P4, P5, P6, P7, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler8<P1, P2, P3, P4, P5, P6, P7, P8, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface RequestHandler9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, token: CancellationToken): HandlerResult<R, E>;
|
||||
}
|
||||
export interface StarNotificationHandler {
|
||||
(method: string, params: any[] | object | undefined): void;
|
||||
}
|
||||
export interface GenericNotificationHandler {
|
||||
(...params: any[]): void;
|
||||
}
|
||||
export interface NotificationHandler0 {
|
||||
(): void;
|
||||
}
|
||||
export interface NotificationHandler<P> {
|
||||
(params: P): void;
|
||||
}
|
||||
export interface NotificationHandler1<P1> {
|
||||
(p1: P1): void;
|
||||
}
|
||||
export interface NotificationHandler2<P1, P2> {
|
||||
(p1: P1, p2: P2): void;
|
||||
}
|
||||
export interface NotificationHandler3<P1, P2, P3> {
|
||||
(p1: P1, p2: P2, p3: P3): void;
|
||||
}
|
||||
export interface NotificationHandler4<P1, P2, P3, P4> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4): void;
|
||||
}
|
||||
export interface NotificationHandler5<P1, P2, P3, P4, P5> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): void;
|
||||
}
|
||||
export interface NotificationHandler6<P1, P2, P3, P4, P5, P6> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): void;
|
||||
}
|
||||
export interface NotificationHandler7<P1, P2, P3, P4, P5, P6, P7> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): void;
|
||||
}
|
||||
export interface NotificationHandler8<P1, P2, P3, P4, P5, P6, P7, P8> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): void;
|
||||
}
|
||||
export interface NotificationHandler9<P1, P2, P3, P4, P5, P6, P7, P8, P9> {
|
||||
(p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): void;
|
||||
}
|
||||
export interface Logger {
|
||||
error(message: string): void;
|
||||
warn(message: string): void;
|
||||
info(message: string): void;
|
||||
log(message: string): void;
|
||||
}
|
||||
export declare const NullLogger: Logger;
|
||||
export declare enum Trace {
|
||||
Off = 0,
|
||||
Messages = 1,
|
||||
Compact = 2,
|
||||
Verbose = 3
|
||||
}
|
||||
export declare namespace TraceValues {
|
||||
/**
|
||||
* Turn tracing off.
|
||||
*/
|
||||
const Off: 'off';
|
||||
/**
|
||||
* Trace messages only.
|
||||
*/
|
||||
const Messages: 'messages';
|
||||
/**
|
||||
* Compact message tracing.
|
||||
*/
|
||||
const Compact: 'compact';
|
||||
/**
|
||||
* Verbose message tracing.
|
||||
*/
|
||||
const Verbose: 'verbose';
|
||||
}
|
||||
export declare type TraceValues = 'off' | 'messages' | 'compact' | 'verbose';
|
||||
export declare namespace Trace {
|
||||
function fromString(value: string): Trace;
|
||||
function toString(value: Trace): TraceValues;
|
||||
}
|
||||
export declare enum TraceFormat {
|
||||
Text = "text",
|
||||
JSON = "json"
|
||||
}
|
||||
export declare namespace TraceFormat {
|
||||
function fromString(value: string): TraceFormat;
|
||||
}
|
||||
export interface TraceOptions {
|
||||
sendNotification?: boolean;
|
||||
traceFormat?: TraceFormat;
|
||||
}
|
||||
export interface SetTraceParams {
|
||||
value: TraceValues;
|
||||
}
|
||||
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 {
|
||||
log(dataObject: any): void;
|
||||
log(message: string, data?: string): void;
|
||||
}
|
||||
export declare enum ConnectionErrors {
|
||||
/**
|
||||
* The connection is closed.
|
||||
*/
|
||||
Closed = 1,
|
||||
/**
|
||||
* The connection got disposed.
|
||||
*/
|
||||
Disposed = 2,
|
||||
/**
|
||||
* The connection is already in listening mode.
|
||||
*/
|
||||
AlreadyListening = 3
|
||||
}
|
||||
export declare class ConnectionError extends Error {
|
||||
readonly code: ConnectionErrors;
|
||||
constructor(code: ConnectionErrors, message: string);
|
||||
}
|
||||
export declare type ConnectionStrategy = {
|
||||
cancelUndispatched?: (message: Message, next: (message: Message) => ResponseMessage | undefined) => ResponseMessage | undefined;
|
||||
};
|
||||
export declare namespace ConnectionStrategy {
|
||||
function is(value: any): value is ConnectionStrategy;
|
||||
}
|
||||
export declare type CancellationId = number | string;
|
||||
export interface IdCancellationReceiverStrategy {
|
||||
kind?: 'id';
|
||||
/**
|
||||
* Creates a CancellationTokenSource from a cancellation id.
|
||||
*
|
||||
* @param id The cancellation id.
|
||||
*/
|
||||
createCancellationTokenSource(id: CancellationId): AbstractCancellationTokenSource;
|
||||
/**
|
||||
* An optional method to dispose the strategy.
|
||||
*/
|
||||
dispose?(): void;
|
||||
}
|
||||
export declare namespace IdCancellationReceiverStrategy {
|
||||
function is(value: any): value is IdCancellationReceiverStrategy;
|
||||
}
|
||||
export interface RequestCancellationReceiverStrategy {
|
||||
kind: 'request';
|
||||
/**
|
||||
* Create a cancellation token source from a given request message.
|
||||
*
|
||||
* @param requestMessage The request message.
|
||||
*/
|
||||
createCancellationTokenSource(requestMessage: RequestMessage): AbstractCancellationTokenSource;
|
||||
/**
|
||||
* An optional method to dispose the strategy.
|
||||
*/
|
||||
dispose?(): void;
|
||||
}
|
||||
export declare namespace RequestCancellationReceiverStrategy {
|
||||
function is(value: any): value is RequestCancellationReceiverStrategy;
|
||||
}
|
||||
/**
|
||||
* This will break with the next major version and will become
|
||||
* export type CancellationReceiverStrategy = IdCancellationReceiverStrategy | RequestCancellationReceiverStrategy;
|
||||
*/
|
||||
export declare type CancellationReceiverStrategy = IdCancellationReceiverStrategy;
|
||||
export declare namespace CancellationReceiverStrategy {
|
||||
const Message: CancellationReceiverStrategy;
|
||||
function is(value: any): value is CancellationReceiverStrategy;
|
||||
}
|
||||
export interface CancellationSenderStrategy {
|
||||
/**
|
||||
* Hook to enable cancellation for the given request.
|
||||
*
|
||||
* @param request The request to enable cancellation for.
|
||||
*/
|
||||
enableCancellation?(request: RequestMessage): void;
|
||||
/**
|
||||
* Send cancellation for the given cancellation id
|
||||
*
|
||||
* @param conn The connection used.
|
||||
* @param id The cancellation id.
|
||||
*/
|
||||
sendCancellation(conn: MessageConnection, id: CancellationId): Promise<void>;
|
||||
/**
|
||||
* Cleanup any cancellation state for the given cancellation id. After this
|
||||
* method has been call no cancellation will be sent anymore for the given id.
|
||||
*
|
||||
* @param id The cancellation id.
|
||||
*/
|
||||
cleanup(id: CancellationId): void;
|
||||
/**
|
||||
* An optional method to dispose the strategy.
|
||||
*/
|
||||
dispose?(): void;
|
||||
}
|
||||
export declare namespace CancellationSenderStrategy {
|
||||
const Message: CancellationSenderStrategy;
|
||||
function is(value: any): value is CancellationSenderStrategy;
|
||||
}
|
||||
export interface CancellationStrategy {
|
||||
receiver: CancellationReceiverStrategy | RequestCancellationReceiverStrategy;
|
||||
sender: CancellationSenderStrategy;
|
||||
}
|
||||
export declare namespace CancellationStrategy {
|
||||
const Message: CancellationStrategy;
|
||||
function is(value: any): value is CancellationStrategy;
|
||||
}
|
||||
export interface MessageStrategy {
|
||||
handleMessage(message: Message, next: (message: Message) => void): void;
|
||||
}
|
||||
export declare namespace MessageStrategy {
|
||||
function is(value: any): value is MessageStrategy;
|
||||
}
|
||||
export interface ConnectionOptions {
|
||||
cancellationStrategy?: CancellationStrategy;
|
||||
connectionStrategy?: ConnectionStrategy;
|
||||
messageStrategy?: MessageStrategy;
|
||||
}
|
||||
export declare namespace ConnectionOptions {
|
||||
function is(value: any): value is ConnectionOptions;
|
||||
}
|
||||
export interface MessageConnection {
|
||||
sendRequest<R, E>(type: RequestType0<R, E>, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P, R, E>(type: RequestType<P, R, E>, params: P, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, R, E>(type: RequestType1<P1, R, E>, p1: P1, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, R, E>(type: RequestType2<P1, P2, R, E>, p1: P1, p2: P2, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, R, E>(type: RequestType3<P1, P2, P3, R, E>, p1: P1, p2: P2, p3: P3, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, R, E>(type: RequestType4<P1, P2, P3, P4, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, P5, R, E>(type: RequestType5<P1, P2, P3, P4, P5, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, P5, P6, R, E>(type: RequestType6<P1, P2, P3, P4, P5, P6, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, P5, P6, P7, R, E>(type: RequestType7<P1, P2, P3, P4, P5, P6, P7, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, P5, P6, P7, P8, R, E>(type: RequestType8<P1, P2, P3, P4, P5, P6, P7, P8, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E>(type: RequestType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9, token?: CancellationToken): Promise<R>;
|
||||
sendRequest<R>(method: string, r0?: ParameterStructures | any, ...rest: any[]): Promise<R>;
|
||||
onRequest<R, E>(type: RequestType0<R, E>, handler: RequestHandler0<R, E>): Disposable;
|
||||
onRequest<P, R, E>(type: RequestType<P, R, E>, handler: RequestHandler<P, R, E>): Disposable;
|
||||
onRequest<P1, R, E>(type: RequestType1<P1, R, E>, handler: RequestHandler1<P1, R, E>): Disposable;
|
||||
onRequest<P1, P2, R, E>(type: RequestType2<P1, P2, R, E>, handler: RequestHandler2<P1, P2, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, R, E>(type: RequestType3<P1, P2, P3, R, E>, handler: RequestHandler3<P1, P2, P3, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, R, E>(type: RequestType4<P1, P2, P3, P4, R, E>, handler: RequestHandler4<P1, P2, P3, P4, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, P5, R, E>(type: RequestType5<P1, P2, P3, P4, P5, R, E>, handler: RequestHandler5<P1, P2, P3, P4, P5, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, P5, P6, R, E>(type: RequestType6<P1, P2, P3, P4, P5, P6, R, E>, handler: RequestHandler6<P1, P2, P3, P4, P5, P6, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, P5, P6, P7, R, E>(type: RequestType7<P1, P2, P3, P4, P5, P6, P7, R, E>, handler: RequestHandler7<P1, P2, P3, P4, P5, P6, P7, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, P5, P6, P7, P8, R, E>(type: RequestType8<P1, P2, P3, P4, P5, P6, P7, P8, R, E>, handler: RequestHandler8<P1, P2, P3, P4, P5, P6, P7, P8, R, E>): Disposable;
|
||||
onRequest<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E>(type: RequestType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E>, handler: RequestHandler9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E>): Disposable;
|
||||
onRequest<R, E>(method: string, handler: GenericRequestHandler<R, E>): Disposable;
|
||||
onRequest(handler: StarRequestHandler): Disposable;
|
||||
hasPendingResponse(): boolean;
|
||||
sendNotification(type: NotificationType0): Promise<void>;
|
||||
sendNotification<P>(type: NotificationType<P>, params?: P): Promise<void>;
|
||||
sendNotification<P1>(type: NotificationType1<P1>, p1: P1): Promise<void>;
|
||||
sendNotification<P1, P2>(type: NotificationType2<P1, P2>, p1: P1, p2: P2): Promise<void>;
|
||||
sendNotification<P1, P2, P3>(type: NotificationType3<P1, P2, P3>, p1: P1, p2: P2, p3: P3): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4>(type: NotificationType4<P1, P2, P3, P4>, p1: P1, p2: P2, p3: P3, p4: P4): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4, P5>(type: NotificationType5<P1, P2, P3, P4, P5>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4, P5, P6>(type: NotificationType6<P1, P2, P3, P4, P5, P6>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4, P5, P6, P7>(type: NotificationType7<P1, P2, P3, P4, P5, P6, P7>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4, P5, P6, P7, P8>(type: NotificationType8<P1, P2, P3, P4, P5, P6, P7, P8>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8): Promise<void>;
|
||||
sendNotification<P1, P2, P3, P4, P5, P6, P7, P8, P9>(type: NotificationType9<P1, P2, P3, P4, P5, P6, P7, P8, P9>, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9): Promise<void>;
|
||||
sendNotification(method: string, r0?: ParameterStructures | any, ...rest: any[]): Promise<void>;
|
||||
onNotification(type: NotificationType0, handler: NotificationHandler0): Disposable;
|
||||
onNotification<P>(type: NotificationType<P>, handler: NotificationHandler<P>): Disposable;
|
||||
onNotification<P1>(type: NotificationType1<P1>, handler: NotificationHandler1<P1>): Disposable;
|
||||
onNotification<P1, P2>(type: NotificationType2<P1, P2>, handler: NotificationHandler2<P1, P2>): Disposable;
|
||||
onNotification<P1, P2, P3>(type: NotificationType3<P1, P2, P3>, handler: NotificationHandler3<P1, P2, P3>): Disposable;
|
||||
onNotification<P1, P2, P3, P4>(type: NotificationType4<P1, P2, P3, P4>, handler: NotificationHandler4<P1, P2, P3, P4>): Disposable;
|
||||
onNotification<P1, P2, P3, P4, P5>(type: NotificationType5<P1, P2, P3, P4, P5>, handler: NotificationHandler5<P1, P2, P3, P4, P5>): Disposable;
|
||||
onNotification<P1, P2, P3, P4, P5, P6>(type: NotificationType6<P1, P2, P3, P4, P5, P6>, handler: NotificationHandler6<P1, P2, P3, P4, P5, P6>): Disposable;
|
||||
onNotification<P1, P2, P3, P4, P5, P6, P7>(type: NotificationType7<P1, P2, P3, P4, P5, P6, P7>, handler: NotificationHandler7<P1, P2, P3, P4, P5, P6, P7>): Disposable;
|
||||
onNotification<P1, P2, P3, P4, P5, P6, P7, P8>(type: NotificationType8<P1, P2, P3, P4, P5, P6, P7, P8>, handler: NotificationHandler8<P1, P2, P3, P4, P5, P6, P7, P8>): Disposable;
|
||||
onNotification<P1, P2, P3, P4, P5, P6, P7, P8, P9>(type: NotificationType9<P1, P2, P3, P4, P5, P6, P7, P8, P9>, handler: NotificationHandler9<P1, P2, P3, P4, P5, P6, P7, P8, P9>): Disposable;
|
||||
onNotification(method: string, handler: GenericNotificationHandler): Disposable;
|
||||
onNotification(handler: StarNotificationHandler): Disposable;
|
||||
onUnhandledNotification: Event<NotificationMessage>;
|
||||
onProgress<P>(type: ProgressType<P>, token: string | number, handler: NotificationHandler<P>): Disposable;
|
||||
sendProgress<P>(type: ProgressType<P>, token: string | number, value: P): Promise<void>;
|
||||
onUnhandledProgress: Event<ProgressParams<any>>;
|
||||
trace(value: Trace, tracer: Tracer, sendNotification?: boolean): Promise<void>;
|
||||
trace(value: Trace, tracer: Tracer, traceOptions?: TraceOptions): Promise<void>;
|
||||
onError: Event<[Error, Message | undefined, number | undefined]>;
|
||||
onClose: Event<void>;
|
||||
listen(): void;
|
||||
end(): void;
|
||||
onDispose: Event<void>;
|
||||
dispose(): void;
|
||||
inspect(): void;
|
||||
}
|
||||
export declare function createMessageConnection(messageReader: MessageReader, messageWriter: MessageWriter, _logger?: Logger, options?: ConnectionOptions): MessageConnection;
|
||||
export {};
|
||||
1212
node_modules/vscode-jsonrpc/lib/common/connection.js
generated
vendored
Normal file
1212
node_modules/vscode-jsonrpc/lib/common/connection.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
node_modules/vscode-jsonrpc/lib/common/disposable.d.ts
generated
vendored
Normal file
9
node_modules/vscode-jsonrpc/lib/common/disposable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export interface Disposable {
|
||||
/**
|
||||
* Dispose this object.
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
export declare namespace Disposable {
|
||||
function create(func: () => void): Disposable;
|
||||
}
|
||||
16
node_modules/vscode-jsonrpc/lib/common/disposable.js
generated
vendored
Normal file
16
node_modules/vscode-jsonrpc/lib/common/disposable.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Disposable = void 0;
|
||||
var Disposable;
|
||||
(function (Disposable) {
|
||||
function create(func) {
|
||||
return {
|
||||
dispose: func
|
||||
};
|
||||
}
|
||||
Disposable.create = create;
|
||||
})(Disposable = exports.Disposable || (exports.Disposable = {}));
|
||||
52
node_modules/vscode-jsonrpc/lib/common/encoding.d.ts
generated
vendored
Normal file
52
node_modules/vscode-jsonrpc/lib/common/encoding.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import type RAL from './ral';
|
||||
import { Message } from './messages';
|
||||
export interface FunctionContentEncoder {
|
||||
name: string;
|
||||
encode(input: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
export interface StreamContentEncoder {
|
||||
name: string;
|
||||
create(): RAL.WritableStream;
|
||||
}
|
||||
export declare type ContentEncoder = FunctionContentEncoder | (FunctionContentEncoder & StreamContentEncoder);
|
||||
export interface FunctionContentDecoder {
|
||||
name: string;
|
||||
decode(buffer: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
export interface StreamContentDecoder {
|
||||
name: string;
|
||||
create(): RAL.WritableStream;
|
||||
}
|
||||
export declare type ContentDecoder = FunctionContentDecoder | (FunctionContentDecoder & StreamContentDecoder);
|
||||
export interface ContentTypeEncoderOptions {
|
||||
charset: RAL.MessageBufferEncoding;
|
||||
}
|
||||
export interface FunctionContentTypeEncoder {
|
||||
name: string;
|
||||
encode(msg: Message, options: ContentTypeEncoderOptions): Promise<Uint8Array>;
|
||||
}
|
||||
export interface StreamContentTypeEncoder {
|
||||
name: string;
|
||||
create(options: ContentTypeEncoderOptions): RAL.WritableStream;
|
||||
}
|
||||
export declare type ContentTypeEncoder = FunctionContentTypeEncoder | (FunctionContentTypeEncoder & StreamContentTypeEncoder);
|
||||
export interface ContentTypeDecoderOptions {
|
||||
charset: RAL.MessageBufferEncoding;
|
||||
}
|
||||
export interface FunctionContentTypeDecoder {
|
||||
name: string;
|
||||
decode(buffer: Uint8Array, options: ContentTypeDecoderOptions): Promise<Message>;
|
||||
}
|
||||
export interface StreamContentTypeDecoder {
|
||||
name: string;
|
||||
create(options: ContentTypeDecoderOptions): RAL.WritableStream;
|
||||
}
|
||||
export declare type ContentTypeDecoder = FunctionContentTypeDecoder | (FunctionContentTypeDecoder & StreamContentTypeDecoder);
|
||||
interface Named {
|
||||
name: string;
|
||||
}
|
||||
export declare namespace Encodings {
|
||||
function getEncodingHeaderValue(encodings: Named[]): string | undefined;
|
||||
function parseEncodingHeaderValue(value: string): string[];
|
||||
}
|
||||
export {};
|
||||
70
node_modules/vscode-jsonrpc/lib/common/encoding.js
generated
vendored
Normal file
70
node_modules/vscode-jsonrpc/lib/common/encoding.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Encodings = void 0;
|
||||
var Encodings;
|
||||
(function (Encodings) {
|
||||
function getEncodingHeaderValue(encodings) {
|
||||
if (encodings.length === 1) {
|
||||
return encodings[0].name;
|
||||
}
|
||||
const distribute = encodings.length - 1;
|
||||
if (distribute > 1000) {
|
||||
throw new Error(`Quality value can only have three decimal digits but trying to distribute ${encodings.length} elements.`);
|
||||
}
|
||||
const digits = Math.ceil(Math.log10(distribute));
|
||||
const factor = Math.pow(10, digits);
|
||||
const diff = Math.floor((1 / distribute) * factor) / factor;
|
||||
const result = [];
|
||||
let q = 1;
|
||||
for (const encoding of encodings) {
|
||||
result.push(`${encoding.name};q=${q === 1 || q === 0 ? q.toFixed(0) : q.toFixed(digits)}`);
|
||||
q = q - diff;
|
||||
}
|
||||
return result.join(', ');
|
||||
}
|
||||
Encodings.getEncodingHeaderValue = getEncodingHeaderValue;
|
||||
function parseEncodingHeaderValue(value) {
|
||||
const map = new Map();
|
||||
const encodings = value.split(/\s*,\s*/);
|
||||
for (const value of encodings) {
|
||||
const [encoding, q] = parseEncoding(value);
|
||||
if (encoding === '*') {
|
||||
continue;
|
||||
}
|
||||
let values = map.get(q);
|
||||
if (values === undefined) {
|
||||
values = [];
|
||||
map.set(q, values);
|
||||
}
|
||||
values.push(encoding);
|
||||
}
|
||||
const keys = Array.from(map.keys());
|
||||
keys.sort((a, b) => b - a);
|
||||
const result = [];
|
||||
for (const key of keys) {
|
||||
result.push(...map.get(key));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Encodings.parseEncodingHeaderValue = parseEncodingHeaderValue;
|
||||
function parseEncoding(value) {
|
||||
let q = 1;
|
||||
let encoding;
|
||||
const index = value.indexOf(';q=');
|
||||
if (index !== -1) {
|
||||
const parsed = parseFloat(value.substr(index));
|
||||
if (parsed !== NaN) {
|
||||
q = parsed;
|
||||
}
|
||||
encoding = value.substr(0, index);
|
||||
}
|
||||
else {
|
||||
encoding = value;
|
||||
}
|
||||
return [encoding, q];
|
||||
}
|
||||
})(Encodings = exports.Encodings || (exports.Encodings = {}));
|
||||
39
node_modules/vscode-jsonrpc/lib/common/events.d.ts
generated
vendored
Normal file
39
node_modules/vscode-jsonrpc/lib/common/events.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { Disposable } from './disposable';
|
||||
/**
|
||||
* Represents a typed event.
|
||||
*/
|
||||
export interface Event<T> {
|
||||
/**
|
||||
*
|
||||
* @param listener The listener function will be called when the event happens.
|
||||
* @param thisArgs The 'this' which will be used when calling the event listener.
|
||||
* @param disposables An array to which a {{IDisposable}} will be added.
|
||||
* @return
|
||||
*/
|
||||
(listener: (e: T) => any, thisArgs?: any, disposables?: Disposable[]): Disposable;
|
||||
}
|
||||
export declare namespace Event {
|
||||
const None: Event<any>;
|
||||
}
|
||||
export interface EmitterOptions {
|
||||
onFirstListenerAdd?: Function;
|
||||
onLastListenerRemove?: Function;
|
||||
}
|
||||
export declare class Emitter<T> {
|
||||
private _options?;
|
||||
private static _noop;
|
||||
private _event;
|
||||
private _callbacks;
|
||||
constructor(_options?: EmitterOptions | undefined);
|
||||
/**
|
||||
* For the public to allow to subscribe
|
||||
* to events from this Emitter
|
||||
*/
|
||||
get event(): Event<T>;
|
||||
/**
|
||||
* To be kept private to fire an event to
|
||||
* subscribers
|
||||
*/
|
||||
fire(event: T): any;
|
||||
dispose(): void;
|
||||
}
|
||||
128
node_modules/vscode-jsonrpc/lib/common/events.js
generated
vendored
Normal file
128
node_modules/vscode-jsonrpc/lib/common/events.js
generated
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Emitter = exports.Event = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
var Event;
|
||||
(function (Event) {
|
||||
const _disposable = { dispose() { } };
|
||||
Event.None = function () { return _disposable; };
|
||||
})(Event = exports.Event || (exports.Event = {}));
|
||||
class CallbackList {
|
||||
add(callback, context = null, bucket) {
|
||||
if (!this._callbacks) {
|
||||
this._callbacks = [];
|
||||
this._contexts = [];
|
||||
}
|
||||
this._callbacks.push(callback);
|
||||
this._contexts.push(context);
|
||||
if (Array.isArray(bucket)) {
|
||||
bucket.push({ dispose: () => this.remove(callback, context) });
|
||||
}
|
||||
}
|
||||
remove(callback, context = null) {
|
||||
if (!this._callbacks) {
|
||||
return;
|
||||
}
|
||||
let foundCallbackWithDifferentContext = false;
|
||||
for (let i = 0, len = this._callbacks.length; i < len; i++) {
|
||||
if (this._callbacks[i] === callback) {
|
||||
if (this._contexts[i] === context) {
|
||||
// callback & context match => remove it
|
||||
this._callbacks.splice(i, 1);
|
||||
this._contexts.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
foundCallbackWithDifferentContext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundCallbackWithDifferentContext) {
|
||||
throw new Error('When adding a listener with a context, you should remove it with the same context');
|
||||
}
|
||||
}
|
||||
invoke(...args) {
|
||||
if (!this._callbacks) {
|
||||
return [];
|
||||
}
|
||||
const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
|
||||
for (let i = 0, len = callbacks.length; i < len; i++) {
|
||||
try {
|
||||
ret.push(callbacks[i].apply(contexts[i], args));
|
||||
}
|
||||
catch (e) {
|
||||
// eslint-disable-next-line no-console
|
||||
(0, ral_1.default)().console.error(e);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
isEmpty() {
|
||||
return !this._callbacks || this._callbacks.length === 0;
|
||||
}
|
||||
dispose() {
|
||||
this._callbacks = undefined;
|
||||
this._contexts = undefined;
|
||||
}
|
||||
}
|
||||
class Emitter {
|
||||
constructor(_options) {
|
||||
this._options = _options;
|
||||
}
|
||||
/**
|
||||
* For the public to allow to subscribe
|
||||
* to events from this Emitter
|
||||
*/
|
||||
get event() {
|
||||
if (!this._event) {
|
||||
this._event = (listener, thisArgs, disposables) => {
|
||||
if (!this._callbacks) {
|
||||
this._callbacks = new CallbackList();
|
||||
}
|
||||
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
||||
this._options.onFirstListenerAdd(this);
|
||||
}
|
||||
this._callbacks.add(listener, thisArgs);
|
||||
const result = {
|
||||
dispose: () => {
|
||||
if (!this._callbacks) {
|
||||
// disposable is disposed after emitter is disposed.
|
||||
return;
|
||||
}
|
||||
this._callbacks.remove(listener, thisArgs);
|
||||
result.dispose = Emitter._noop;
|
||||
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
||||
this._options.onLastListenerRemove(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (Array.isArray(disposables)) {
|
||||
disposables.push(result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
return this._event;
|
||||
}
|
||||
/**
|
||||
* To be kept private to fire an event to
|
||||
* subscribers
|
||||
*/
|
||||
fire(event) {
|
||||
if (this._callbacks) {
|
||||
this._callbacks.invoke.call(this._callbacks, event);
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
if (this._callbacks) {
|
||||
this._callbacks.dispose();
|
||||
this._callbacks = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Emitter = Emitter;
|
||||
Emitter._noop = function () { };
|
||||
7
node_modules/vscode-jsonrpc/lib/common/is.d.ts
generated
vendored
Normal file
7
node_modules/vscode-jsonrpc/lib/common/is.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export declare function boolean(value: any): value is boolean;
|
||||
export declare function string(value: any): value is string;
|
||||
export declare function number(value: any): value is number;
|
||||
export declare function error(value: any): value is Error;
|
||||
export declare function func(value: any): value is Function;
|
||||
export declare function array<T>(value: any): value is T[];
|
||||
export declare function stringArray(value: any): value is string[];
|
||||
35
node_modules/vscode-jsonrpc/lib/common/is.js
generated
vendored
Normal file
35
node_modules/vscode-jsonrpc/lib/common/is.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
||||
function boolean(value) {
|
||||
return value === true || value === false;
|
||||
}
|
||||
exports.boolean = boolean;
|
||||
function string(value) {
|
||||
return typeof value === 'string' || value instanceof String;
|
||||
}
|
||||
exports.string = string;
|
||||
function number(value) {
|
||||
return typeof value === 'number' || value instanceof Number;
|
||||
}
|
||||
exports.number = number;
|
||||
function error(value) {
|
||||
return value instanceof Error;
|
||||
}
|
||||
exports.error = error;
|
||||
function func(value) {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
exports.func = func;
|
||||
function array(value) {
|
||||
return Array.isArray(value);
|
||||
}
|
||||
exports.array = array;
|
||||
function stringArray(value) {
|
||||
return array(value) && value.every(elem => string(elem));
|
||||
}
|
||||
exports.stringArray = stringArray;
|
||||
53
node_modules/vscode-jsonrpc/lib/common/linkedMap.d.ts
generated
vendored
Normal file
53
node_modules/vscode-jsonrpc/lib/common/linkedMap.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
export declare namespace Touch {
|
||||
const None: 0;
|
||||
const First: 1;
|
||||
const AsOld: 1;
|
||||
const Last: 2;
|
||||
const AsNew: 2;
|
||||
}
|
||||
export declare type Touch = 0 | 1 | 2;
|
||||
export declare class LinkedMap<K, V> implements Map<K, V> {
|
||||
readonly [Symbol.toStringTag] = "LinkedMap";
|
||||
private _map;
|
||||
private _head;
|
||||
private _tail;
|
||||
private _size;
|
||||
private _state;
|
||||
constructor();
|
||||
clear(): void;
|
||||
isEmpty(): boolean;
|
||||
get size(): number;
|
||||
get first(): V | undefined;
|
||||
get last(): V | undefined;
|
||||
has(key: K): boolean;
|
||||
get(key: K, touch?: Touch): V | undefined;
|
||||
set(key: K, value: V, touch?: Touch): this;
|
||||
delete(key: K): boolean;
|
||||
remove(key: K): V | undefined;
|
||||
shift(): V | undefined;
|
||||
forEach(callbackfn: (value: V, key: K, map: LinkedMap<K, V>) => void, thisArg?: any): void;
|
||||
keys(): IterableIterator<K>;
|
||||
values(): IterableIterator<V>;
|
||||
entries(): IterableIterator<[K, V]>;
|
||||
[Symbol.iterator](): IterableIterator<[K, V]>;
|
||||
protected trimOld(newSize: number): void;
|
||||
private addItemFirst;
|
||||
private addItemLast;
|
||||
private removeItem;
|
||||
private touch;
|
||||
toJSON(): [K, V][];
|
||||
fromJSON(data: [K, V][]): void;
|
||||
}
|
||||
export declare class LRUCache<K, V> extends LinkedMap<K, V> {
|
||||
private _limit;
|
||||
private _ratio;
|
||||
constructor(limit: number, ratio?: number);
|
||||
get limit(): number;
|
||||
set limit(limit: number);
|
||||
get ratio(): number;
|
||||
set ratio(ratio: number);
|
||||
get(key: K, touch?: Touch): V | undefined;
|
||||
peek(key: K): V | undefined;
|
||||
set(key: K, value: V): this;
|
||||
private checkTrim;
|
||||
}
|
||||
398
node_modules/vscode-jsonrpc/lib/common/linkedMap.js
generated
vendored
Normal file
398
node_modules/vscode-jsonrpc/lib/common/linkedMap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
|
||||
var Touch;
|
||||
(function (Touch) {
|
||||
Touch.None = 0;
|
||||
Touch.First = 1;
|
||||
Touch.AsOld = Touch.First;
|
||||
Touch.Last = 2;
|
||||
Touch.AsNew = Touch.Last;
|
||||
})(Touch = exports.Touch || (exports.Touch = {}));
|
||||
class LinkedMap {
|
||||
constructor() {
|
||||
this[_a] = 'LinkedMap';
|
||||
this._map = new Map();
|
||||
this._head = undefined;
|
||||
this._tail = undefined;
|
||||
this._size = 0;
|
||||
this._state = 0;
|
||||
}
|
||||
clear() {
|
||||
this._map.clear();
|
||||
this._head = undefined;
|
||||
this._tail = undefined;
|
||||
this._size = 0;
|
||||
this._state++;
|
||||
}
|
||||
isEmpty() {
|
||||
return !this._head && !this._tail;
|
||||
}
|
||||
get size() {
|
||||
return this._size;
|
||||
}
|
||||
get first() {
|
||||
return this._head?.value;
|
||||
}
|
||||
get last() {
|
||||
return this._tail?.value;
|
||||
}
|
||||
has(key) {
|
||||
return this._map.has(key);
|
||||
}
|
||||
get(key, touch = Touch.None) {
|
||||
const item = this._map.get(key);
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
if (touch !== Touch.None) {
|
||||
this.touch(item, touch);
|
||||
}
|
||||
return item.value;
|
||||
}
|
||||
set(key, value, touch = Touch.None) {
|
||||
let item = this._map.get(key);
|
||||
if (item) {
|
||||
item.value = value;
|
||||
if (touch !== Touch.None) {
|
||||
this.touch(item, touch);
|
||||
}
|
||||
}
|
||||
else {
|
||||
item = { key, value, next: undefined, previous: undefined };
|
||||
switch (touch) {
|
||||
case Touch.None:
|
||||
this.addItemLast(item);
|
||||
break;
|
||||
case Touch.First:
|
||||
this.addItemFirst(item);
|
||||
break;
|
||||
case Touch.Last:
|
||||
this.addItemLast(item);
|
||||
break;
|
||||
default:
|
||||
this.addItemLast(item);
|
||||
break;
|
||||
}
|
||||
this._map.set(key, item);
|
||||
this._size++;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
delete(key) {
|
||||
return !!this.remove(key);
|
||||
}
|
||||
remove(key) {
|
||||
const item = this._map.get(key);
|
||||
if (!item) {
|
||||
return undefined;
|
||||
}
|
||||
this._map.delete(key);
|
||||
this.removeItem(item);
|
||||
this._size--;
|
||||
return item.value;
|
||||
}
|
||||
shift() {
|
||||
if (!this._head && !this._tail) {
|
||||
return undefined;
|
||||
}
|
||||
if (!this._head || !this._tail) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
const item = this._head;
|
||||
this._map.delete(item.key);
|
||||
this.removeItem(item);
|
||||
this._size--;
|
||||
return item.value;
|
||||
}
|
||||
forEach(callbackfn, thisArg) {
|
||||
const state = this._state;
|
||||
let current = this._head;
|
||||
while (current) {
|
||||
if (thisArg) {
|
||||
callbackfn.bind(thisArg)(current.value, current.key, this);
|
||||
}
|
||||
else {
|
||||
callbackfn(current.value, current.key, this);
|
||||
}
|
||||
if (this._state !== state) {
|
||||
throw new Error(`LinkedMap got modified during iteration.`);
|
||||
}
|
||||
current = current.next;
|
||||
}
|
||||
}
|
||||
keys() {
|
||||
const state = this._state;
|
||||
let current = this._head;
|
||||
const iterator = {
|
||||
[Symbol.iterator]: () => {
|
||||
return iterator;
|
||||
},
|
||||
next: () => {
|
||||
if (this._state !== state) {
|
||||
throw new Error(`LinkedMap got modified during iteration.`);
|
||||
}
|
||||
if (current) {
|
||||
const result = { value: current.key, done: false };
|
||||
current = current.next;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
}
|
||||
};
|
||||
return iterator;
|
||||
}
|
||||
values() {
|
||||
const state = this._state;
|
||||
let current = this._head;
|
||||
const iterator = {
|
||||
[Symbol.iterator]: () => {
|
||||
return iterator;
|
||||
},
|
||||
next: () => {
|
||||
if (this._state !== state) {
|
||||
throw new Error(`LinkedMap got modified during iteration.`);
|
||||
}
|
||||
if (current) {
|
||||
const result = { value: current.value, done: false };
|
||||
current = current.next;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
}
|
||||
};
|
||||
return iterator;
|
||||
}
|
||||
entries() {
|
||||
const state = this._state;
|
||||
let current = this._head;
|
||||
const iterator = {
|
||||
[Symbol.iterator]: () => {
|
||||
return iterator;
|
||||
},
|
||||
next: () => {
|
||||
if (this._state !== state) {
|
||||
throw new Error(`LinkedMap got modified during iteration.`);
|
||||
}
|
||||
if (current) {
|
||||
const result = { value: [current.key, current.value], done: false };
|
||||
current = current.next;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
}
|
||||
};
|
||||
return iterator;
|
||||
}
|
||||
[(_a = Symbol.toStringTag, Symbol.iterator)]() {
|
||||
return this.entries();
|
||||
}
|
||||
trimOld(newSize) {
|
||||
if (newSize >= this.size) {
|
||||
return;
|
||||
}
|
||||
if (newSize === 0) {
|
||||
this.clear();
|
||||
return;
|
||||
}
|
||||
let current = this._head;
|
||||
let currentSize = this.size;
|
||||
while (current && currentSize > newSize) {
|
||||
this._map.delete(current.key);
|
||||
current = current.next;
|
||||
currentSize--;
|
||||
}
|
||||
this._head = current;
|
||||
this._size = currentSize;
|
||||
if (current) {
|
||||
current.previous = undefined;
|
||||
}
|
||||
this._state++;
|
||||
}
|
||||
addItemFirst(item) {
|
||||
// First time Insert
|
||||
if (!this._head && !this._tail) {
|
||||
this._tail = item;
|
||||
}
|
||||
else if (!this._head) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
else {
|
||||
item.next = this._head;
|
||||
this._head.previous = item;
|
||||
}
|
||||
this._head = item;
|
||||
this._state++;
|
||||
}
|
||||
addItemLast(item) {
|
||||
// First time Insert
|
||||
if (!this._head && !this._tail) {
|
||||
this._head = item;
|
||||
}
|
||||
else if (!this._tail) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
else {
|
||||
item.previous = this._tail;
|
||||
this._tail.next = item;
|
||||
}
|
||||
this._tail = item;
|
||||
this._state++;
|
||||
}
|
||||
removeItem(item) {
|
||||
if (item === this._head && item === this._tail) {
|
||||
this._head = undefined;
|
||||
this._tail = undefined;
|
||||
}
|
||||
else if (item === this._head) {
|
||||
// This can only happened if size === 1 which is handle
|
||||
// by the case above.
|
||||
if (!item.next) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
item.next.previous = undefined;
|
||||
this._head = item.next;
|
||||
}
|
||||
else if (item === this._tail) {
|
||||
// This can only happened if size === 1 which is handle
|
||||
// by the case above.
|
||||
if (!item.previous) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
item.previous.next = undefined;
|
||||
this._tail = item.previous;
|
||||
}
|
||||
else {
|
||||
const next = item.next;
|
||||
const previous = item.previous;
|
||||
if (!next || !previous) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
next.previous = previous;
|
||||
previous.next = next;
|
||||
}
|
||||
item.next = undefined;
|
||||
item.previous = undefined;
|
||||
this._state++;
|
||||
}
|
||||
touch(item, touch) {
|
||||
if (!this._head || !this._tail) {
|
||||
throw new Error('Invalid list');
|
||||
}
|
||||
if ((touch !== Touch.First && touch !== Touch.Last)) {
|
||||
return;
|
||||
}
|
||||
if (touch === Touch.First) {
|
||||
if (item === this._head) {
|
||||
return;
|
||||
}
|
||||
const next = item.next;
|
||||
const previous = item.previous;
|
||||
// Unlink the item
|
||||
if (item === this._tail) {
|
||||
// previous must be defined since item was not head but is tail
|
||||
// So there are more than on item in the map
|
||||
previous.next = undefined;
|
||||
this._tail = previous;
|
||||
}
|
||||
else {
|
||||
// Both next and previous are not undefined since item was neither head nor tail.
|
||||
next.previous = previous;
|
||||
previous.next = next;
|
||||
}
|
||||
// Insert the node at head
|
||||
item.previous = undefined;
|
||||
item.next = this._head;
|
||||
this._head.previous = item;
|
||||
this._head = item;
|
||||
this._state++;
|
||||
}
|
||||
else if (touch === Touch.Last) {
|
||||
if (item === this._tail) {
|
||||
return;
|
||||
}
|
||||
const next = item.next;
|
||||
const previous = item.previous;
|
||||
// Unlink the item.
|
||||
if (item === this._head) {
|
||||
// next must be defined since item was not tail but is head
|
||||
// So there are more than on item in the map
|
||||
next.previous = undefined;
|
||||
this._head = next;
|
||||
}
|
||||
else {
|
||||
// Both next and previous are not undefined since item was neither head nor tail.
|
||||
next.previous = previous;
|
||||
previous.next = next;
|
||||
}
|
||||
item.next = undefined;
|
||||
item.previous = this._tail;
|
||||
this._tail.next = item;
|
||||
this._tail = item;
|
||||
this._state++;
|
||||
}
|
||||
}
|
||||
toJSON() {
|
||||
const data = [];
|
||||
this.forEach((value, key) => {
|
||||
data.push([key, value]);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
fromJSON(data) {
|
||||
this.clear();
|
||||
for (const [key, value] of data) {
|
||||
this.set(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.LinkedMap = LinkedMap;
|
||||
class LRUCache extends LinkedMap {
|
||||
constructor(limit, ratio = 1) {
|
||||
super();
|
||||
this._limit = limit;
|
||||
this._ratio = Math.min(Math.max(0, ratio), 1);
|
||||
}
|
||||
get limit() {
|
||||
return this._limit;
|
||||
}
|
||||
set limit(limit) {
|
||||
this._limit = limit;
|
||||
this.checkTrim();
|
||||
}
|
||||
get ratio() {
|
||||
return this._ratio;
|
||||
}
|
||||
set ratio(ratio) {
|
||||
this._ratio = Math.min(Math.max(0, ratio), 1);
|
||||
this.checkTrim();
|
||||
}
|
||||
get(key, touch = Touch.AsNew) {
|
||||
return super.get(key, touch);
|
||||
}
|
||||
peek(key) {
|
||||
return super.get(key, Touch.None);
|
||||
}
|
||||
set(key, value) {
|
||||
super.set(key, value, Touch.Last);
|
||||
this.checkTrim();
|
||||
return this;
|
||||
}
|
||||
checkTrim() {
|
||||
if (this.size > this._limit) {
|
||||
this.trimOld(Math.round(this._limit * this._ratio));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.LRUCache = LRUCache;
|
||||
18
node_modules/vscode-jsonrpc/lib/common/messageBuffer.d.ts
generated
vendored
Normal file
18
node_modules/vscode-jsonrpc/lib/common/messageBuffer.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import RAL from './ral';
|
||||
export declare abstract class AbstractMessageBuffer implements RAL.MessageBuffer {
|
||||
private _encoding;
|
||||
private _chunks;
|
||||
private _totalLength;
|
||||
constructor(encoding?: RAL.MessageBufferEncoding);
|
||||
protected abstract emptyBuffer(): Uint8Array;
|
||||
protected abstract fromString(value: string, encoding: RAL.MessageBufferEncoding): Uint8Array;
|
||||
protected abstract toString(value: Uint8Array, encoding: RAL.MessageBufferEncoding): string;
|
||||
protected abstract asNative(buffer: Uint8Array, length?: number): Uint8Array;
|
||||
protected abstract allocNative(length: number): Uint8Array;
|
||||
get encoding(): RAL.MessageBufferEncoding;
|
||||
append(chunk: Uint8Array | string): void;
|
||||
tryReadHeaders(lowerCaseKeys?: boolean): Map<string, string> | undefined;
|
||||
tryReadBody(length: number): Uint8Array | undefined;
|
||||
get numberOfBytes(): number;
|
||||
private _read;
|
||||
}
|
||||
152
node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
generated
vendored
Normal file
152
node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AbstractMessageBuffer = void 0;
|
||||
const CR = 13;
|
||||
const LF = 10;
|
||||
const CRLF = '\r\n';
|
||||
class AbstractMessageBuffer {
|
||||
constructor(encoding = 'utf-8') {
|
||||
this._encoding = encoding;
|
||||
this._chunks = [];
|
||||
this._totalLength = 0;
|
||||
}
|
||||
get encoding() {
|
||||
return this._encoding;
|
||||
}
|
||||
append(chunk) {
|
||||
const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;
|
||||
this._chunks.push(toAppend);
|
||||
this._totalLength += toAppend.byteLength;
|
||||
}
|
||||
tryReadHeaders(lowerCaseKeys = false) {
|
||||
if (this._chunks.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
let state = 0;
|
||||
let chunkIndex = 0;
|
||||
let offset = 0;
|
||||
let chunkBytesRead = 0;
|
||||
row: while (chunkIndex < this._chunks.length) {
|
||||
const chunk = this._chunks[chunkIndex];
|
||||
offset = 0;
|
||||
column: while (offset < chunk.length) {
|
||||
const value = chunk[offset];
|
||||
switch (value) {
|
||||
case CR:
|
||||
switch (state) {
|
||||
case 0:
|
||||
state = 1;
|
||||
break;
|
||||
case 2:
|
||||
state = 3;
|
||||
break;
|
||||
default:
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
case LF:
|
||||
switch (state) {
|
||||
case 1:
|
||||
state = 2;
|
||||
break;
|
||||
case 3:
|
||||
state = 4;
|
||||
offset++;
|
||||
break row;
|
||||
default:
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
state = 0;
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
chunkBytesRead += chunk.byteLength;
|
||||
chunkIndex++;
|
||||
}
|
||||
if (state !== 4) {
|
||||
return undefined;
|
||||
}
|
||||
// The buffer contains the two CRLF at the end. So we will
|
||||
// have two empty lines after the split at the end as well.
|
||||
const buffer = this._read(chunkBytesRead + offset);
|
||||
const result = new Map();
|
||||
const headers = this.toString(buffer, 'ascii').split(CRLF);
|
||||
if (headers.length < 2) {
|
||||
return result;
|
||||
}
|
||||
for (let i = 0; i < headers.length - 2; i++) {
|
||||
const header = headers[i];
|
||||
const index = header.indexOf(':');
|
||||
if (index === -1) {
|
||||
throw new Error('Message header must separate key and value using :');
|
||||
}
|
||||
const key = header.substr(0, index);
|
||||
const value = header.substr(index + 1).trim();
|
||||
result.set(lowerCaseKeys ? key.toLowerCase() : key, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
tryReadBody(length) {
|
||||
if (this._totalLength < length) {
|
||||
return undefined;
|
||||
}
|
||||
return this._read(length);
|
||||
}
|
||||
get numberOfBytes() {
|
||||
return this._totalLength;
|
||||
}
|
||||
_read(byteCount) {
|
||||
if (byteCount === 0) {
|
||||
return this.emptyBuffer();
|
||||
}
|
||||
if (byteCount > this._totalLength) {
|
||||
throw new Error(`Cannot read so many bytes!`);
|
||||
}
|
||||
if (this._chunks[0].byteLength === byteCount) {
|
||||
// super fast path, precisely first chunk must be returned
|
||||
const chunk = this._chunks[0];
|
||||
this._chunks.shift();
|
||||
this._totalLength -= byteCount;
|
||||
return this.asNative(chunk);
|
||||
}
|
||||
if (this._chunks[0].byteLength > byteCount) {
|
||||
// fast path, the reading is entirely within the first chunk
|
||||
const chunk = this._chunks[0];
|
||||
const result = this.asNative(chunk, byteCount);
|
||||
this._chunks[0] = chunk.slice(byteCount);
|
||||
this._totalLength -= byteCount;
|
||||
return result;
|
||||
}
|
||||
const result = this.allocNative(byteCount);
|
||||
let resultOffset = 0;
|
||||
let chunkIndex = 0;
|
||||
while (byteCount > 0) {
|
||||
const chunk = this._chunks[chunkIndex];
|
||||
if (chunk.byteLength > byteCount) {
|
||||
// this chunk will survive
|
||||
const chunkPart = chunk.slice(0, byteCount);
|
||||
result.set(chunkPart, resultOffset);
|
||||
resultOffset += byteCount;
|
||||
this._chunks[chunkIndex] = chunk.slice(byteCount);
|
||||
this._totalLength -= byteCount;
|
||||
byteCount -= byteCount;
|
||||
}
|
||||
else {
|
||||
// this chunk will be entirely read
|
||||
result.set(chunk, resultOffset);
|
||||
resultOffset += chunk.byteLength;
|
||||
this._chunks.shift();
|
||||
this._totalLength -= chunk.byteLength;
|
||||
byteCount -= chunk.byteLength;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageBuffer = AbstractMessageBuffer;
|
||||
77
node_modules/vscode-jsonrpc/lib/common/messageReader.d.ts
generated
vendored
Normal file
77
node_modules/vscode-jsonrpc/lib/common/messageReader.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import RAL from './ral';
|
||||
import { Event } from './events';
|
||||
import { Message } from './messages';
|
||||
import { ContentDecoder, ContentTypeDecoder } from './encoding';
|
||||
import { Disposable } from './api';
|
||||
/**
|
||||
* A callback that receives each incoming JSON-RPC message.
|
||||
*/
|
||||
export interface DataCallback {
|
||||
(data: Message): void;
|
||||
}
|
||||
export interface PartialMessageInfo {
|
||||
readonly messageToken: number;
|
||||
readonly waitingTime: number;
|
||||
}
|
||||
/** Reads JSON-RPC messages from some underlying transport. */
|
||||
export interface MessageReader {
|
||||
/** Raised whenever an error occurs while reading a message. */
|
||||
readonly onError: Event<Error>;
|
||||
/** An event raised when the end of the underlying transport has been reached. */
|
||||
readonly onClose: Event<void>;
|
||||
/**
|
||||
* An event that *may* be raised to inform the owner that only part of a message has been received.
|
||||
* A MessageReader implementation may choose to raise this event after a timeout elapses while waiting for more of a partially received message to be received.
|
||||
*/
|
||||
readonly onPartialMessage: Event<PartialMessageInfo>;
|
||||
/**
|
||||
* Begins listening for incoming messages. To be called at most once.
|
||||
* @param callback A callback for receiving decoded messages.
|
||||
*/
|
||||
listen(callback: DataCallback): Disposable;
|
||||
/** Releases resources incurred from reading or raising events. Does NOT close the underlying transport, if any. */
|
||||
dispose(): void;
|
||||
}
|
||||
export declare namespace MessageReader {
|
||||
function is(value: any): value is MessageReader;
|
||||
}
|
||||
export declare abstract class AbstractMessageReader implements MessageReader {
|
||||
private errorEmitter;
|
||||
private closeEmitter;
|
||||
private partialMessageEmitter;
|
||||
constructor();
|
||||
dispose(): void;
|
||||
get onError(): Event<Error>;
|
||||
protected fireError(error: any): void;
|
||||
get onClose(): Event<void>;
|
||||
protected fireClose(): void;
|
||||
get onPartialMessage(): Event<PartialMessageInfo>;
|
||||
protected firePartialMessage(info: PartialMessageInfo): void;
|
||||
private asError;
|
||||
abstract listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export interface MessageReaderOptions {
|
||||
charset?: RAL.MessageBufferEncoding;
|
||||
contentDecoder?: ContentDecoder;
|
||||
contentDecoders?: ContentDecoder[];
|
||||
contentTypeDecoder?: ContentTypeDecoder;
|
||||
contentTypeDecoders?: ContentTypeDecoder[];
|
||||
}
|
||||
export declare class ReadableStreamMessageReader extends AbstractMessageReader {
|
||||
private readable;
|
||||
private options;
|
||||
private callback;
|
||||
private nextMessageLength;
|
||||
private messageToken;
|
||||
private buffer;
|
||||
private partialMessageTimer;
|
||||
private _partialMessageTimeout;
|
||||
private readSemaphore;
|
||||
constructor(readable: RAL.ReadableStream, options?: RAL.MessageBufferEncoding | MessageReaderOptions);
|
||||
set partialMessageTimeout(timeout: number);
|
||||
get partialMessageTimeout(): number;
|
||||
listen(callback: DataCallback): Disposable;
|
||||
private onData;
|
||||
private clearPartialMessageTimer;
|
||||
private setPartialMessageTimer;
|
||||
}
|
||||
192
node_modules/vscode-jsonrpc/lib/common/messageReader.js
generated
vendored
Normal file
192
node_modules/vscode-jsonrpc/lib/common/messageReader.js
generated
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
const Is = require("./is");
|
||||
const events_1 = require("./events");
|
||||
const semaphore_1 = require("./semaphore");
|
||||
var MessageReader;
|
||||
(function (MessageReader) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
|
||||
Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
|
||||
}
|
||||
MessageReader.is = is;
|
||||
})(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
|
||||
class AbstractMessageReader {
|
||||
constructor() {
|
||||
this.errorEmitter = new events_1.Emitter();
|
||||
this.closeEmitter = new events_1.Emitter();
|
||||
this.partialMessageEmitter = new events_1.Emitter();
|
||||
}
|
||||
dispose() {
|
||||
this.errorEmitter.dispose();
|
||||
this.closeEmitter.dispose();
|
||||
}
|
||||
get onError() {
|
||||
return this.errorEmitter.event;
|
||||
}
|
||||
fireError(error) {
|
||||
this.errorEmitter.fire(this.asError(error));
|
||||
}
|
||||
get onClose() {
|
||||
return this.closeEmitter.event;
|
||||
}
|
||||
fireClose() {
|
||||
this.closeEmitter.fire(undefined);
|
||||
}
|
||||
get onPartialMessage() {
|
||||
return this.partialMessageEmitter.event;
|
||||
}
|
||||
firePartialMessage(info) {
|
||||
this.partialMessageEmitter.fire(info);
|
||||
}
|
||||
asError(error) {
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageReader = AbstractMessageReader;
|
||||
var ResolvedMessageReaderOptions;
|
||||
(function (ResolvedMessageReaderOptions) {
|
||||
function fromOptions(options) {
|
||||
let charset;
|
||||
let result;
|
||||
let contentDecoder;
|
||||
const contentDecoders = new Map();
|
||||
let contentTypeDecoder;
|
||||
const contentTypeDecoders = new Map();
|
||||
if (options === undefined || typeof options === 'string') {
|
||||
charset = options ?? 'utf-8';
|
||||
}
|
||||
else {
|
||||
charset = options.charset ?? 'utf-8';
|
||||
if (options.contentDecoder !== undefined) {
|
||||
contentDecoder = options.contentDecoder;
|
||||
contentDecoders.set(contentDecoder.name, contentDecoder);
|
||||
}
|
||||
if (options.contentDecoders !== undefined) {
|
||||
for (const decoder of options.contentDecoders) {
|
||||
contentDecoders.set(decoder.name, decoder);
|
||||
}
|
||||
}
|
||||
if (options.contentTypeDecoder !== undefined) {
|
||||
contentTypeDecoder = options.contentTypeDecoder;
|
||||
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
||||
}
|
||||
if (options.contentTypeDecoders !== undefined) {
|
||||
for (const decoder of options.contentTypeDecoders) {
|
||||
contentTypeDecoders.set(decoder.name, decoder);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (contentTypeDecoder === undefined) {
|
||||
contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder;
|
||||
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
|
||||
}
|
||||
return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
|
||||
}
|
||||
ResolvedMessageReaderOptions.fromOptions = fromOptions;
|
||||
})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
|
||||
class ReadableStreamMessageReader extends AbstractMessageReader {
|
||||
constructor(readable, options) {
|
||||
super();
|
||||
this.readable = readable;
|
||||
this.options = ResolvedMessageReaderOptions.fromOptions(options);
|
||||
this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset);
|
||||
this._partialMessageTimeout = 10000;
|
||||
this.nextMessageLength = -1;
|
||||
this.messageToken = 0;
|
||||
this.readSemaphore = new semaphore_1.Semaphore(1);
|
||||
}
|
||||
set partialMessageTimeout(timeout) {
|
||||
this._partialMessageTimeout = timeout;
|
||||
}
|
||||
get partialMessageTimeout() {
|
||||
return this._partialMessageTimeout;
|
||||
}
|
||||
listen(callback) {
|
||||
this.nextMessageLength = -1;
|
||||
this.messageToken = 0;
|
||||
this.partialMessageTimer = undefined;
|
||||
this.callback = callback;
|
||||
const result = this.readable.onData((data) => {
|
||||
this.onData(data);
|
||||
});
|
||||
this.readable.onError((error) => this.fireError(error));
|
||||
this.readable.onClose(() => this.fireClose());
|
||||
return result;
|
||||
}
|
||||
onData(data) {
|
||||
this.buffer.append(data);
|
||||
while (true) {
|
||||
if (this.nextMessageLength === -1) {
|
||||
const headers = this.buffer.tryReadHeaders(true);
|
||||
if (!headers) {
|
||||
return;
|
||||
}
|
||||
const contentLength = headers.get('content-length');
|
||||
if (!contentLength) {
|
||||
this.fireError(new Error('Header must provide a Content-Length property.'));
|
||||
return;
|
||||
}
|
||||
const length = parseInt(contentLength);
|
||||
if (isNaN(length)) {
|
||||
this.fireError(new Error('Content-Length value must be a number.'));
|
||||
return;
|
||||
}
|
||||
this.nextMessageLength = length;
|
||||
}
|
||||
const body = this.buffer.tryReadBody(this.nextMessageLength);
|
||||
if (body === undefined) {
|
||||
/** We haven't received the full message yet. */
|
||||
this.setPartialMessageTimer();
|
||||
return;
|
||||
}
|
||||
this.clearPartialMessageTimer();
|
||||
this.nextMessageLength = -1;
|
||||
// Make sure that we convert one received message after the
|
||||
// other. Otherwise it could happen that a decoding of a second
|
||||
// smaller message finished before the decoding of a first larger
|
||||
// message and then we would deliver the second message first.
|
||||
this.readSemaphore.lock(async () => {
|
||||
const bytes = this.options.contentDecoder !== undefined
|
||||
? await this.options.contentDecoder.decode(body)
|
||||
: body;
|
||||
const message = await this.options.contentTypeDecoder.decode(bytes, this.options);
|
||||
this.callback(message);
|
||||
}).catch((error) => {
|
||||
this.fireError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
clearPartialMessageTimer() {
|
||||
if (this.partialMessageTimer) {
|
||||
this.partialMessageTimer.dispose();
|
||||
this.partialMessageTimer = undefined;
|
||||
}
|
||||
}
|
||||
setPartialMessageTimer() {
|
||||
this.clearPartialMessageTimer();
|
||||
if (this._partialMessageTimeout <= 0) {
|
||||
return;
|
||||
}
|
||||
this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token, timeout) => {
|
||||
this.partialMessageTimer = undefined;
|
||||
if (token === this.messageToken) {
|
||||
this.firePartialMessage({ messageToken: token, waitingTime: timeout });
|
||||
this.setPartialMessageTimer();
|
||||
}
|
||||
}, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
|
||||
}
|
||||
}
|
||||
exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
|
||||
60
node_modules/vscode-jsonrpc/lib/common/messageWriter.d.ts
generated
vendored
Normal file
60
node_modules/vscode-jsonrpc/lib/common/messageWriter.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import RAL from './ral';
|
||||
import { Message } from './messages';
|
||||
import { Event } from './events';
|
||||
import { ContentEncoder, ContentTypeEncoder } from './encoding';
|
||||
/**
|
||||
* Writes JSON-RPC messages to an underlying transport.
|
||||
*/
|
||||
export interface MessageWriter {
|
||||
/**
|
||||
* Raised whenever an error occurs while writing a message.
|
||||
*/
|
||||
readonly onError: Event<[Error, Message | undefined, number | undefined]>;
|
||||
/**
|
||||
* An event raised when the underlying transport has closed and writing is no longer possible.
|
||||
*/
|
||||
readonly onClose: Event<void>;
|
||||
/**
|
||||
* Sends a JSON-RPC message.
|
||||
* @param msg The JSON-RPC message to be sent.
|
||||
* @description Implementations should guarantee messages are transmitted in the same order that they are received by this method.
|
||||
*/
|
||||
write(msg: Message): Promise<void>;
|
||||
/**
|
||||
* Call when the connection using this message writer ends
|
||||
* (e.g. MessageConnection.end() is called)
|
||||
*/
|
||||
end(): void;
|
||||
/** Releases resources incurred from writing or raising events. Does NOT close the underlying transport, if any. */
|
||||
dispose(): void;
|
||||
}
|
||||
export declare namespace MessageWriter {
|
||||
function is(value: any): value is MessageWriter;
|
||||
}
|
||||
export declare abstract class AbstractMessageWriter {
|
||||
private errorEmitter;
|
||||
private closeEmitter;
|
||||
constructor();
|
||||
dispose(): void;
|
||||
get onError(): Event<[Error, Message | undefined, number | undefined]>;
|
||||
protected fireError(error: any, message?: Message, count?: number): void;
|
||||
get onClose(): Event<void>;
|
||||
protected fireClose(): void;
|
||||
private asError;
|
||||
}
|
||||
export interface MessageWriterOptions {
|
||||
charset?: RAL.MessageBufferEncoding;
|
||||
contentEncoder?: ContentEncoder;
|
||||
contentTypeEncoder?: ContentTypeEncoder;
|
||||
}
|
||||
export declare class WriteableStreamMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
||||
private writable;
|
||||
private options;
|
||||
private errorCount;
|
||||
private writeSemaphore;
|
||||
constructor(writable: RAL.WritableStream, options?: RAL.MessageBufferEncoding | MessageWriterOptions);
|
||||
write(msg: Message): Promise<void>;
|
||||
private doWrite;
|
||||
private handleError;
|
||||
end(): void;
|
||||
}
|
||||
115
node_modules/vscode-jsonrpc/lib/common/messageWriter.js
generated
vendored
Normal file
115
node_modules/vscode-jsonrpc/lib/common/messageWriter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
const Is = require("./is");
|
||||
const semaphore_1 = require("./semaphore");
|
||||
const events_1 = require("./events");
|
||||
const ContentLength = 'Content-Length: ';
|
||||
const CRLF = '\r\n';
|
||||
var MessageWriter;
|
||||
(function (MessageWriter) {
|
||||
function is(value) {
|
||||
let candidate = value;
|
||||
return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
|
||||
Is.func(candidate.onError) && Is.func(candidate.write);
|
||||
}
|
||||
MessageWriter.is = is;
|
||||
})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
|
||||
class AbstractMessageWriter {
|
||||
constructor() {
|
||||
this.errorEmitter = new events_1.Emitter();
|
||||
this.closeEmitter = new events_1.Emitter();
|
||||
}
|
||||
dispose() {
|
||||
this.errorEmitter.dispose();
|
||||
this.closeEmitter.dispose();
|
||||
}
|
||||
get onError() {
|
||||
return this.errorEmitter.event;
|
||||
}
|
||||
fireError(error, message, count) {
|
||||
this.errorEmitter.fire([this.asError(error), message, count]);
|
||||
}
|
||||
get onClose() {
|
||||
return this.closeEmitter.event;
|
||||
}
|
||||
fireClose() {
|
||||
this.closeEmitter.fire(undefined);
|
||||
}
|
||||
asError(error) {
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageWriter = AbstractMessageWriter;
|
||||
var ResolvedMessageWriterOptions;
|
||||
(function (ResolvedMessageWriterOptions) {
|
||||
function fromOptions(options) {
|
||||
if (options === undefined || typeof options === 'string') {
|
||||
return { charset: options ?? 'utf-8', contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder };
|
||||
}
|
||||
else {
|
||||
return { charset: options.charset ?? 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: options.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder };
|
||||
}
|
||||
}
|
||||
ResolvedMessageWriterOptions.fromOptions = fromOptions;
|
||||
})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
|
||||
class WriteableStreamMessageWriter extends AbstractMessageWriter {
|
||||
constructor(writable, options) {
|
||||
super();
|
||||
this.writable = writable;
|
||||
this.options = ResolvedMessageWriterOptions.fromOptions(options);
|
||||
this.errorCount = 0;
|
||||
this.writeSemaphore = new semaphore_1.Semaphore(1);
|
||||
this.writable.onError((error) => this.fireError(error));
|
||||
this.writable.onClose(() => this.fireClose());
|
||||
}
|
||||
async write(msg) {
|
||||
return this.writeSemaphore.lock(async () => {
|
||||
const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
|
||||
if (this.options.contentEncoder !== undefined) {
|
||||
return this.options.contentEncoder.encode(buffer);
|
||||
}
|
||||
else {
|
||||
return buffer;
|
||||
}
|
||||
});
|
||||
return payload.then((buffer) => {
|
||||
const headers = [];
|
||||
headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
|
||||
headers.push(CRLF);
|
||||
return this.doWrite(msg, headers, buffer);
|
||||
}, (error) => {
|
||||
this.fireError(error);
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
}
|
||||
async doWrite(msg, headers, data) {
|
||||
try {
|
||||
await this.writable.write(headers.join(''), 'ascii');
|
||||
return this.writable.write(data);
|
||||
}
|
||||
catch (error) {
|
||||
this.handleError(error, msg);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
handleError(error, msg) {
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
end() {
|
||||
this.writable.end();
|
||||
}
|
||||
}
|
||||
exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
|
||||
369
node_modules/vscode-jsonrpc/lib/common/messages.d.ts
generated
vendored
Normal file
369
node_modules/vscode-jsonrpc/lib/common/messages.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,369 @@
|
|||
/**
|
||||
* A language server message
|
||||
*/
|
||||
export interface Message {
|
||||
jsonrpc: string;
|
||||
}
|
||||
/**
|
||||
* Request message
|
||||
*/
|
||||
export interface RequestMessage extends Message {
|
||||
/**
|
||||
* The request id.
|
||||
*/
|
||||
id: number | string | null;
|
||||
/**
|
||||
* The method to be invoked.
|
||||
*/
|
||||
method: string;
|
||||
/**
|
||||
* The method's params.
|
||||
*/
|
||||
params?: any[] | object;
|
||||
}
|
||||
/**
|
||||
* Predefined error codes.
|
||||
*/
|
||||
export declare namespace ErrorCodes {
|
||||
const ParseError: -32700;
|
||||
const InvalidRequest: -32600;
|
||||
const MethodNotFound: -32601;
|
||||
const InvalidParams: -32602;
|
||||
const InternalError: -32603;
|
||||
/**
|
||||
* This is the start range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code. No application error codes should
|
||||
* be defined between the start and end range. For backwards
|
||||
* compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
|
||||
* are left in the range.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
const jsonrpcReservedErrorRangeStart: -32099;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeStart */
|
||||
const serverErrorStart: -32099;
|
||||
/**
|
||||
* An error occurred when write a message to the transport layer.
|
||||
*/
|
||||
const MessageWriteError: -32099;
|
||||
/**
|
||||
* An error occurred when reading a message from the transport layer.
|
||||
*/
|
||||
const MessageReadError: -32098;
|
||||
/**
|
||||
* The connection got disposed or lost and all pending responses got
|
||||
* rejected.
|
||||
*/
|
||||
const PendingResponseRejected: -32097;
|
||||
/**
|
||||
* The connection is inactive and a use of it failed.
|
||||
*/
|
||||
const ConnectionInactive: -32096;
|
||||
/**
|
||||
* Error code indicating that a server received a notification or
|
||||
* request before the server has received the `initialize` request.
|
||||
*/
|
||||
const ServerNotInitialized: -32002;
|
||||
const UnknownErrorCode: -32001;
|
||||
/**
|
||||
* This is the end range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
const jsonrpcReservedErrorRangeEnd: -32000;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeEnd */
|
||||
const serverErrorEnd: -32000;
|
||||
}
|
||||
declare type integer = number;
|
||||
export declare type ErrorCodes = integer;
|
||||
export interface ResponseErrorLiteral<D = void> {
|
||||
/**
|
||||
* A number indicating the error type that occurred.
|
||||
*/
|
||||
code: number;
|
||||
/**
|
||||
* A string providing a short description of the error.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* A Primitive or Structured value that contains additional
|
||||
* information about the error. Can be omitted.
|
||||
*/
|
||||
data?: D;
|
||||
}
|
||||
/**
|
||||
* An error object return in a response in case a request
|
||||
* has failed.
|
||||
*/
|
||||
export declare class ResponseError<D = void> extends Error {
|
||||
readonly code: number;
|
||||
readonly data: D | undefined;
|
||||
constructor(code: number, message: string, data?: D);
|
||||
toJson(): ResponseErrorLiteral<D>;
|
||||
}
|
||||
/**
|
||||
* A response message.
|
||||
*/
|
||||
export interface ResponseMessage extends Message {
|
||||
/**
|
||||
* The request id.
|
||||
*/
|
||||
id: number | string | null;
|
||||
/**
|
||||
* The result of a request. This member is REQUIRED on success.
|
||||
* This member MUST NOT exist if there was an error invoking the method.
|
||||
*/
|
||||
result?: string | number | boolean | object | any[] | null;
|
||||
/**
|
||||
* The error object in case a request fails.
|
||||
*/
|
||||
error?: ResponseErrorLiteral<any>;
|
||||
}
|
||||
/**
|
||||
* A LSP Log Entry.
|
||||
*/
|
||||
export declare type LSPMessageType = 'send-request' | 'receive-request' | 'send-response' | 'receive-response' | 'send-notification' | 'receive-notification';
|
||||
export interface LSPLogMessage {
|
||||
type: LSPMessageType;
|
||||
message: RequestMessage | ResponseMessage | NotificationMessage;
|
||||
timestamp: number;
|
||||
}
|
||||
export declare class ParameterStructures {
|
||||
private readonly kind;
|
||||
/**
|
||||
* The parameter structure is automatically inferred on the number of parameters
|
||||
* and the parameter type in case of a single param.
|
||||
*/
|
||||
static readonly auto: ParameterStructures;
|
||||
/**
|
||||
* Forces `byPosition` parameter structure. This is useful if you have a single
|
||||
* parameter which has a literal type.
|
||||
*/
|
||||
static readonly byPosition: ParameterStructures;
|
||||
/**
|
||||
* Forces `byName` parameter structure. This is only useful when having a single
|
||||
* parameter. The library will report errors if used with a different number of
|
||||
* parameters.
|
||||
*/
|
||||
static readonly byName: ParameterStructures;
|
||||
private constructor();
|
||||
static is(value: any): value is ParameterStructures;
|
||||
toString(): string;
|
||||
}
|
||||
/**
|
||||
* An interface to type messages.
|
||||
*/
|
||||
export interface MessageSignature {
|
||||
readonly method: string;
|
||||
readonly numberOfParams: number;
|
||||
readonly parameterStructures: ParameterStructures;
|
||||
}
|
||||
/**
|
||||
* An abstract implementation of a MessageType.
|
||||
*/
|
||||
export declare abstract class AbstractMessageSignature implements MessageSignature {
|
||||
readonly method: string;
|
||||
readonly numberOfParams: number;
|
||||
constructor(method: string, numberOfParams: number);
|
||||
get parameterStructures(): ParameterStructures;
|
||||
}
|
||||
/**
|
||||
* End marker interface for request and notification types.
|
||||
*/
|
||||
export interface _EM {
|
||||
_$endMarker$_: number;
|
||||
}
|
||||
/**
|
||||
* Classes to type request response pairs
|
||||
*/
|
||||
export declare class RequestType0<R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType<P, R, E> extends AbstractMessageSignature {
|
||||
private _parameterStructures;
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P, R, E, _EM] | undefined;
|
||||
constructor(method: string, _parameterStructures?: ParameterStructures);
|
||||
get parameterStructures(): ParameterStructures;
|
||||
}
|
||||
export declare class RequestType1<P1, R, E> extends AbstractMessageSignature {
|
||||
private _parameterStructures;
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, R, E, _EM] | undefined;
|
||||
constructor(method: string, _parameterStructures?: ParameterStructures);
|
||||
get parameterStructures(): ParameterStructures;
|
||||
}
|
||||
export declare class RequestType2<P1, P2, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType3<P1, P2, P3, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType4<P1, P2, P3, P4, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType5<P1, P2, P3, P4, P5, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType6<P1, P2, P3, P4, P5, P6, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType7<P1, P2, P3, P4, P5, P6, P7, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType8<P1, P2, P3, P4, P5, P6, P7, P8, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class RequestType9<P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, P9, R, E, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
/**
|
||||
* Notification Message
|
||||
*/
|
||||
export interface NotificationMessage extends Message {
|
||||
/**
|
||||
* The method to be invoked.
|
||||
*/
|
||||
method: string;
|
||||
/**
|
||||
* The notification's params.
|
||||
*/
|
||||
params?: any[] | object;
|
||||
}
|
||||
export declare class NotificationType<P> extends AbstractMessageSignature {
|
||||
private _parameterStructures;
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P, _EM] | undefined;
|
||||
constructor(method: string, _parameterStructures?: ParameterStructures);
|
||||
get parameterStructures(): ParameterStructures;
|
||||
}
|
||||
export declare class NotificationType0 extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [_EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType1<P1> extends AbstractMessageSignature {
|
||||
private _parameterStructures;
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, _EM] | undefined;
|
||||
constructor(method: string, _parameterStructures?: ParameterStructures);
|
||||
get parameterStructures(): ParameterStructures;
|
||||
}
|
||||
export declare class NotificationType2<P1, P2> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType3<P1, P2, P3> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType4<P1, P2, P3, P4> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType5<P1, P2, P3, P4, P5> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType6<P1, P2, P3, P4, P5, P6> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType7<P1, P2, P3, P4, P5, P6, P7> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType8<P1, P2, P3, P4, P5, P6, P7, P8> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare class NotificationType9<P1, P2, P3, P4, P5, P6, P7, P8, P9> extends AbstractMessageSignature {
|
||||
/**
|
||||
* Clients must not use this property. It is here to ensure correct typing.
|
||||
*/
|
||||
readonly _: [P1, P2, P3, P4, P5, P6, P7, P8, P9, _EM] | undefined;
|
||||
constructor(method: string);
|
||||
}
|
||||
export declare namespace Message {
|
||||
/**
|
||||
* Tests if the given message is a request message
|
||||
*/
|
||||
function isRequest(message: Message | undefined): message is RequestMessage;
|
||||
/**
|
||||
* Tests if the given message is a notification message
|
||||
*/
|
||||
function isNotification(message: Message | undefined): message is NotificationMessage;
|
||||
/**
|
||||
* Tests if the given message is a response message
|
||||
*/
|
||||
function isResponse(message: Message | undefined): message is ResponseMessage;
|
||||
}
|
||||
export {};
|
||||
306
node_modules/vscode-jsonrpc/lib/common/messages.js
generated
vendored
Normal file
306
node_modules/vscode-jsonrpc/lib/common/messages.js
generated
vendored
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Message = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
|
||||
const is = require("./is");
|
||||
/**
|
||||
* Predefined error codes.
|
||||
*/
|
||||
var ErrorCodes;
|
||||
(function (ErrorCodes) {
|
||||
// Defined by JSON RPC
|
||||
ErrorCodes.ParseError = -32700;
|
||||
ErrorCodes.InvalidRequest = -32600;
|
||||
ErrorCodes.MethodNotFound = -32601;
|
||||
ErrorCodes.InvalidParams = -32602;
|
||||
ErrorCodes.InternalError = -32603;
|
||||
/**
|
||||
* This is the start range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code. No application error codes should
|
||||
* be defined between the start and end range. For backwards
|
||||
* compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
|
||||
* are left in the range.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeStart */
|
||||
ErrorCodes.serverErrorStart = -32099;
|
||||
/**
|
||||
* An error occurred when write a message to the transport layer.
|
||||
*/
|
||||
ErrorCodes.MessageWriteError = -32099;
|
||||
/**
|
||||
* An error occurred when reading a message from the transport layer.
|
||||
*/
|
||||
ErrorCodes.MessageReadError = -32098;
|
||||
/**
|
||||
* The connection got disposed or lost and all pending responses got
|
||||
* rejected.
|
||||
*/
|
||||
ErrorCodes.PendingResponseRejected = -32097;
|
||||
/**
|
||||
* The connection is inactive and a use of it failed.
|
||||
*/
|
||||
ErrorCodes.ConnectionInactive = -32096;
|
||||
/**
|
||||
* Error code indicating that a server received a notification or
|
||||
* request before the server has received the `initialize` request.
|
||||
*/
|
||||
ErrorCodes.ServerNotInitialized = -32002;
|
||||
ErrorCodes.UnknownErrorCode = -32001;
|
||||
/**
|
||||
* This is the end range of JSON RPC reserved error codes.
|
||||
* It doesn't denote a real error code.
|
||||
*
|
||||
* @since 3.16.0
|
||||
*/
|
||||
ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;
|
||||
/** @deprecated use jsonrpcReservedErrorRangeEnd */
|
||||
ErrorCodes.serverErrorEnd = -32000;
|
||||
})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
|
||||
/**
|
||||
* An error object return in a response in case a request
|
||||
* has failed.
|
||||
*/
|
||||
class ResponseError extends Error {
|
||||
constructor(code, message, data) {
|
||||
super(message);
|
||||
this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
|
||||
this.data = data;
|
||||
Object.setPrototypeOf(this, ResponseError.prototype);
|
||||
}
|
||||
toJson() {
|
||||
const result = {
|
||||
code: this.code,
|
||||
message: this.message
|
||||
};
|
||||
if (this.data !== undefined) {
|
||||
result.data = this.data;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.ResponseError = ResponseError;
|
||||
class ParameterStructures {
|
||||
constructor(kind) {
|
||||
this.kind = kind;
|
||||
}
|
||||
static is(value) {
|
||||
return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
|
||||
}
|
||||
toString() {
|
||||
return this.kind;
|
||||
}
|
||||
}
|
||||
exports.ParameterStructures = ParameterStructures;
|
||||
/**
|
||||
* The parameter structure is automatically inferred on the number of parameters
|
||||
* and the parameter type in case of a single param.
|
||||
*/
|
||||
ParameterStructures.auto = new ParameterStructures('auto');
|
||||
/**
|
||||
* Forces `byPosition` parameter structure. This is useful if you have a single
|
||||
* parameter which has a literal type.
|
||||
*/
|
||||
ParameterStructures.byPosition = new ParameterStructures('byPosition');
|
||||
/**
|
||||
* Forces `byName` parameter structure. This is only useful when having a single
|
||||
* parameter. The library will report errors if used with a different number of
|
||||
* parameters.
|
||||
*/
|
||||
ParameterStructures.byName = new ParameterStructures('byName');
|
||||
/**
|
||||
* An abstract implementation of a MessageType.
|
||||
*/
|
||||
class AbstractMessageSignature {
|
||||
constructor(method, numberOfParams) {
|
||||
this.method = method;
|
||||
this.numberOfParams = numberOfParams;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return ParameterStructures.auto;
|
||||
}
|
||||
}
|
||||
exports.AbstractMessageSignature = AbstractMessageSignature;
|
||||
/**
|
||||
* Classes to type request response pairs
|
||||
*/
|
||||
class RequestType0 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 0);
|
||||
}
|
||||
}
|
||||
exports.RequestType0 = RequestType0;
|
||||
class RequestType extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.RequestType = RequestType;
|
||||
class RequestType1 extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.RequestType1 = RequestType1;
|
||||
class RequestType2 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 2);
|
||||
}
|
||||
}
|
||||
exports.RequestType2 = RequestType2;
|
||||
class RequestType3 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 3);
|
||||
}
|
||||
}
|
||||
exports.RequestType3 = RequestType3;
|
||||
class RequestType4 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 4);
|
||||
}
|
||||
}
|
||||
exports.RequestType4 = RequestType4;
|
||||
class RequestType5 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 5);
|
||||
}
|
||||
}
|
||||
exports.RequestType5 = RequestType5;
|
||||
class RequestType6 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 6);
|
||||
}
|
||||
}
|
||||
exports.RequestType6 = RequestType6;
|
||||
class RequestType7 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 7);
|
||||
}
|
||||
}
|
||||
exports.RequestType7 = RequestType7;
|
||||
class RequestType8 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 8);
|
||||
}
|
||||
}
|
||||
exports.RequestType8 = RequestType8;
|
||||
class RequestType9 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 9);
|
||||
}
|
||||
}
|
||||
exports.RequestType9 = RequestType9;
|
||||
class NotificationType extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.NotificationType = NotificationType;
|
||||
class NotificationType0 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 0);
|
||||
}
|
||||
}
|
||||
exports.NotificationType0 = NotificationType0;
|
||||
class NotificationType1 extends AbstractMessageSignature {
|
||||
constructor(method, _parameterStructures = ParameterStructures.auto) {
|
||||
super(method, 1);
|
||||
this._parameterStructures = _parameterStructures;
|
||||
}
|
||||
get parameterStructures() {
|
||||
return this._parameterStructures;
|
||||
}
|
||||
}
|
||||
exports.NotificationType1 = NotificationType1;
|
||||
class NotificationType2 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 2);
|
||||
}
|
||||
}
|
||||
exports.NotificationType2 = NotificationType2;
|
||||
class NotificationType3 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 3);
|
||||
}
|
||||
}
|
||||
exports.NotificationType3 = NotificationType3;
|
||||
class NotificationType4 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 4);
|
||||
}
|
||||
}
|
||||
exports.NotificationType4 = NotificationType4;
|
||||
class NotificationType5 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 5);
|
||||
}
|
||||
}
|
||||
exports.NotificationType5 = NotificationType5;
|
||||
class NotificationType6 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 6);
|
||||
}
|
||||
}
|
||||
exports.NotificationType6 = NotificationType6;
|
||||
class NotificationType7 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 7);
|
||||
}
|
||||
}
|
||||
exports.NotificationType7 = NotificationType7;
|
||||
class NotificationType8 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 8);
|
||||
}
|
||||
}
|
||||
exports.NotificationType8 = NotificationType8;
|
||||
class NotificationType9 extends AbstractMessageSignature {
|
||||
constructor(method) {
|
||||
super(method, 9);
|
||||
}
|
||||
}
|
||||
exports.NotificationType9 = NotificationType9;
|
||||
var Message;
|
||||
(function (Message) {
|
||||
/**
|
||||
* Tests if the given message is a request message
|
||||
*/
|
||||
function isRequest(message) {
|
||||
const candidate = message;
|
||||
return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
|
||||
}
|
||||
Message.isRequest = isRequest;
|
||||
/**
|
||||
* Tests if the given message is a notification message
|
||||
*/
|
||||
function isNotification(message) {
|
||||
const candidate = message;
|
||||
return candidate && is.string(candidate.method) && message.id === void 0;
|
||||
}
|
||||
Message.isNotification = isNotification;
|
||||
/**
|
||||
* Tests if the given message is a response message
|
||||
*/
|
||||
function isResponse(message) {
|
||||
const candidate = message;
|
||||
return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
|
||||
}
|
||||
Message.isResponse = isResponse;
|
||||
})(Message = exports.Message || (exports.Message = {}));
|
||||
74
node_modules/vscode-jsonrpc/lib/common/ral.d.ts
generated
vendored
Normal file
74
node_modules/vscode-jsonrpc/lib/common/ral.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import type { Disposable } from './disposable';
|
||||
import type { ContentTypeEncoder, ContentTypeDecoder } from './encoding';
|
||||
interface _MessageBuffer {
|
||||
readonly encoding: RAL.MessageBufferEncoding;
|
||||
/**
|
||||
* Append data to the message buffer.
|
||||
*
|
||||
* @param chunk the data to append.
|
||||
*/
|
||||
append(chunk: Uint8Array | string): void;
|
||||
/**
|
||||
* Tries to read the headers from the buffer
|
||||
*
|
||||
* @param lowerCaseKeys Whether the keys should be stored lower case. Doing
|
||||
* so is recommended since HTTP headers are case insensitive.
|
||||
*
|
||||
* @returns the header properties or undefined in not enough data can be read.
|
||||
*/
|
||||
tryReadHeaders(lowerCaseKeys?: boolean): Map<string, string> | undefined;
|
||||
/**
|
||||
* Tries to read the body of the given length.
|
||||
*
|
||||
* @param length the amount of bytes to read.
|
||||
* @returns the data or undefined int less data is available.
|
||||
*/
|
||||
tryReadBody(length: number): Uint8Array | undefined;
|
||||
}
|
||||
declare type _MessageBufferEncoding = 'ascii' | 'utf-8';
|
||||
interface _ReadableStream {
|
||||
onData(listener: (data: Uint8Array) => void): Disposable;
|
||||
onClose(listener: () => void): Disposable;
|
||||
onError(listener: (error: any) => void): Disposable;
|
||||
onEnd(listener: () => void): Disposable;
|
||||
}
|
||||
interface _WritableStream {
|
||||
onClose(listener: () => void): Disposable;
|
||||
onError(listener: (error: any) => void): Disposable;
|
||||
onEnd(listener: () => void): Disposable;
|
||||
write(data: Uint8Array): Promise<void>;
|
||||
write(data: string, encoding: _MessageBufferEncoding): Promise<void>;
|
||||
end(): void;
|
||||
}
|
||||
interface _DuplexStream extends _ReadableStream, _WritableStream {
|
||||
}
|
||||
interface RAL {
|
||||
readonly applicationJson: {
|
||||
readonly encoder: ContentTypeEncoder;
|
||||
readonly decoder: ContentTypeDecoder;
|
||||
};
|
||||
readonly messageBuffer: {
|
||||
create(encoding: RAL.MessageBufferEncoding): RAL.MessageBuffer;
|
||||
};
|
||||
readonly console: {
|
||||
info(message?: any, ...optionalParams: any[]): void;
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
error(message?: any, ...optionalParams: any[]): void;
|
||||
};
|
||||
readonly timer: {
|
||||
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
setImmediate(callback: (...args: any[]) => void, ...args: any[]): Disposable;
|
||||
setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): Disposable;
|
||||
};
|
||||
}
|
||||
declare function RAL(): RAL;
|
||||
declare namespace RAL {
|
||||
type MessageBuffer = _MessageBuffer;
|
||||
type MessageBufferEncoding = _MessageBufferEncoding;
|
||||
type ReadableStream = _ReadableStream;
|
||||
type WritableStream = _WritableStream;
|
||||
type DuplexStream = _DuplexStream;
|
||||
function install(ral: RAL): void;
|
||||
}
|
||||
export default RAL;
|
||||
23
node_modules/vscode-jsonrpc/lib/common/ral.js
generated
vendored
Normal file
23
node_modules/vscode-jsonrpc/lib/common/ral.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let _ral;
|
||||
function RAL() {
|
||||
if (_ral === undefined) {
|
||||
throw new Error(`No runtime abstraction layer installed`);
|
||||
}
|
||||
return _ral;
|
||||
}
|
||||
(function (RAL) {
|
||||
function install(ral) {
|
||||
if (ral === undefined) {
|
||||
throw new Error(`No runtime abstraction layer provided`);
|
||||
}
|
||||
_ral = ral;
|
||||
}
|
||||
RAL.install = install;
|
||||
})(RAL || (RAL = {}));
|
||||
exports.default = RAL;
|
||||
10
node_modules/vscode-jsonrpc/lib/common/semaphore.d.ts
generated
vendored
Normal file
10
node_modules/vscode-jsonrpc/lib/common/semaphore.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export declare class Semaphore<T = void> {
|
||||
private _capacity;
|
||||
private _active;
|
||||
private _waiting;
|
||||
constructor(capacity?: number);
|
||||
lock(thunk: () => T | PromiseLike<T>): Promise<T>;
|
||||
get active(): number;
|
||||
private runNext;
|
||||
private doRunNext;
|
||||
}
|
||||
68
node_modules/vscode-jsonrpc/lib/common/semaphore.js
generated
vendored
Normal file
68
node_modules/vscode-jsonrpc/lib/common/semaphore.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Semaphore = void 0;
|
||||
const ral_1 = require("./ral");
|
||||
class Semaphore {
|
||||
constructor(capacity = 1) {
|
||||
if (capacity <= 0) {
|
||||
throw new Error('Capacity must be greater than 0');
|
||||
}
|
||||
this._capacity = capacity;
|
||||
this._active = 0;
|
||||
this._waiting = [];
|
||||
}
|
||||
lock(thunk) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this._waiting.push({ thunk, resolve, reject });
|
||||
this.runNext();
|
||||
});
|
||||
}
|
||||
get active() {
|
||||
return this._active;
|
||||
}
|
||||
runNext() {
|
||||
if (this._waiting.length === 0 || this._active === this._capacity) {
|
||||
return;
|
||||
}
|
||||
(0, ral_1.default)().timer.setImmediate(() => this.doRunNext());
|
||||
}
|
||||
doRunNext() {
|
||||
if (this._waiting.length === 0 || this._active === this._capacity) {
|
||||
return;
|
||||
}
|
||||
const next = this._waiting.shift();
|
||||
this._active++;
|
||||
if (this._active > this._capacity) {
|
||||
throw new Error(`To many thunks active`);
|
||||
}
|
||||
try {
|
||||
const result = next.thunk();
|
||||
if (result instanceof Promise) {
|
||||
result.then((value) => {
|
||||
this._active--;
|
||||
next.resolve(value);
|
||||
this.runNext();
|
||||
}, (err) => {
|
||||
this._active--;
|
||||
next.reject(err);
|
||||
this.runNext();
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._active--;
|
||||
next.resolve(result);
|
||||
this.runNext();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
this._active--;
|
||||
next.reject(err);
|
||||
this.runNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Semaphore = Semaphore;
|
||||
15
node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts
generated
vendored
Normal file
15
node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { RequestMessage } from './messages';
|
||||
import { AbstractCancellationTokenSource } from './cancellation';
|
||||
import { CancellationId, RequestCancellationReceiverStrategy, CancellationSenderStrategy, MessageConnection } from './connection';
|
||||
export declare class SharedArraySenderStrategy implements CancellationSenderStrategy {
|
||||
private readonly buffers;
|
||||
constructor();
|
||||
enableCancellation(request: RequestMessage): void;
|
||||
sendCancellation(_conn: MessageConnection, id: CancellationId): Promise<void>;
|
||||
cleanup(id: CancellationId): void;
|
||||
dispose(): void;
|
||||
}
|
||||
export declare class SharedArrayReceiverStrategy implements RequestCancellationReceiverStrategy {
|
||||
readonly kind: "request";
|
||||
createCancellationTokenSource(request: RequestMessage): AbstractCancellationTokenSource;
|
||||
}
|
||||
76
node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js
generated
vendored
Normal file
76
node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SharedArrayReceiverStrategy = exports.SharedArraySenderStrategy = void 0;
|
||||
const cancellation_1 = require("./cancellation");
|
||||
var CancellationState;
|
||||
(function (CancellationState) {
|
||||
CancellationState.Continue = 0;
|
||||
CancellationState.Cancelled = 1;
|
||||
})(CancellationState || (CancellationState = {}));
|
||||
class SharedArraySenderStrategy {
|
||||
constructor() {
|
||||
this.buffers = new Map();
|
||||
}
|
||||
enableCancellation(request) {
|
||||
if (request.id === null) {
|
||||
return;
|
||||
}
|
||||
const buffer = new SharedArrayBuffer(4);
|
||||
const data = new Int32Array(buffer, 0, 1);
|
||||
data[0] = CancellationState.Continue;
|
||||
this.buffers.set(request.id, buffer);
|
||||
request.$cancellationData = buffer;
|
||||
}
|
||||
async sendCancellation(_conn, id) {
|
||||
const buffer = this.buffers.get(id);
|
||||
if (buffer === undefined) {
|
||||
return;
|
||||
}
|
||||
const data = new Int32Array(buffer, 0, 1);
|
||||
Atomics.store(data, 0, CancellationState.Cancelled);
|
||||
}
|
||||
cleanup(id) {
|
||||
this.buffers.delete(id);
|
||||
}
|
||||
dispose() {
|
||||
this.buffers.clear();
|
||||
}
|
||||
}
|
||||
exports.SharedArraySenderStrategy = SharedArraySenderStrategy;
|
||||
class SharedArrayBufferCancellationToken {
|
||||
constructor(buffer) {
|
||||
this.data = new Int32Array(buffer, 0, 1);
|
||||
}
|
||||
get isCancellationRequested() {
|
||||
return Atomics.load(this.data, 0) === CancellationState.Cancelled;
|
||||
}
|
||||
get onCancellationRequested() {
|
||||
throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`);
|
||||
}
|
||||
}
|
||||
class SharedArrayBufferCancellationTokenSource {
|
||||
constructor(buffer) {
|
||||
this.token = new SharedArrayBufferCancellationToken(buffer);
|
||||
}
|
||||
cancel() {
|
||||
}
|
||||
dispose() {
|
||||
}
|
||||
}
|
||||
class SharedArrayReceiverStrategy {
|
||||
constructor() {
|
||||
this.kind = 'request';
|
||||
}
|
||||
createCancellationTokenSource(request) {
|
||||
const buffer = request.$cancellationData;
|
||||
if (buffer === undefined) {
|
||||
return new cancellation_1.CancellationTokenSource();
|
||||
}
|
||||
return new SharedArrayBufferCancellationTokenSource(buffer);
|
||||
}
|
||||
}
|
||||
exports.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;
|
||||
63
node_modules/vscode-jsonrpc/lib/node/main.d.ts
generated
vendored
Normal file
63
node_modules/vscode-jsonrpc/lib/node/main.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { ChildProcess } from 'child_process';
|
||||
import { Socket } from 'net';
|
||||
import { MessagePort, Worker } from 'worker_threads';
|
||||
import { RAL, AbstractMessageReader, DataCallback, AbstractMessageWriter, Message, ReadableStreamMessageReader, WriteableStreamMessageWriter, MessageWriterOptions, MessageReaderOptions, MessageReader, MessageWriter, ConnectionStrategy, ConnectionOptions, MessageConnection, Logger, Disposable } from '../common/api';
|
||||
export * from '../common/api';
|
||||
export declare class IPCMessageReader extends AbstractMessageReader {
|
||||
private process;
|
||||
constructor(process: NodeJS.Process | ChildProcess);
|
||||
listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export declare class IPCMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
||||
private readonly process;
|
||||
private errorCount;
|
||||
constructor(process: NodeJS.Process | ChildProcess);
|
||||
write(msg: Message): Promise<void>;
|
||||
private handleError;
|
||||
end(): void;
|
||||
}
|
||||
export declare class PortMessageReader extends AbstractMessageReader implements MessageReader {
|
||||
private onData;
|
||||
constructor(port: MessagePort | Worker);
|
||||
listen(callback: DataCallback): Disposable;
|
||||
}
|
||||
export declare class PortMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
||||
private readonly port;
|
||||
private errorCount;
|
||||
constructor(port: MessagePort | Worker);
|
||||
write(msg: Message): Promise<void>;
|
||||
private handleError;
|
||||
end(): void;
|
||||
}
|
||||
export declare class SocketMessageReader extends ReadableStreamMessageReader {
|
||||
constructor(socket: Socket, encoding?: RAL.MessageBufferEncoding);
|
||||
}
|
||||
export declare class SocketMessageWriter extends WriteableStreamMessageWriter {
|
||||
private socket;
|
||||
constructor(socket: Socket, options?: RAL.MessageBufferEncoding | MessageWriterOptions);
|
||||
dispose(): void;
|
||||
}
|
||||
export declare class StreamMessageReader extends ReadableStreamMessageReader {
|
||||
constructor(readable: NodeJS.ReadableStream, encoding?: RAL.MessageBufferEncoding | MessageReaderOptions);
|
||||
}
|
||||
export declare class StreamMessageWriter extends WriteableStreamMessageWriter {
|
||||
constructor(writable: NodeJS.WritableStream, options?: RAL.MessageBufferEncoding | MessageWriterOptions);
|
||||
}
|
||||
export declare function generateRandomPipeName(): string;
|
||||
export interface PipeTransport {
|
||||
onConnected(): Promise<[MessageReader, MessageWriter]>;
|
||||
}
|
||||
export declare function createClientPipeTransport(pipeName: string, encoding?: RAL.MessageBufferEncoding): Promise<PipeTransport>;
|
||||
export declare function createServerPipeTransport(pipeName: string, encoding?: RAL.MessageBufferEncoding): [MessageReader, MessageWriter];
|
||||
export interface SocketTransport {
|
||||
onConnected(): Promise<[MessageReader, MessageWriter]>;
|
||||
}
|
||||
export declare function createClientSocketTransport(port: number, encoding?: RAL.MessageBufferEncoding): Promise<SocketTransport>;
|
||||
export declare function createServerSocketTransport(port: number, encoding?: RAL.MessageBufferEncoding): [MessageReader, MessageWriter];
|
||||
export declare function createMessageConnection(reader: MessageReader, writer: MessageWriter, logger?: Logger, options?: ConnectionStrategy | ConnectionOptions): MessageConnection;
|
||||
export declare function createMessageConnection(inputStream: NodeJS.ReadableStream, outputStream: NodeJS.WritableStream, logger?: Logger, options?: ConnectionStrategy | ConnectionOptions): MessageConnection;
|
||||
257
node_modules/vscode-jsonrpc/lib/node/main.js
generated
vendored
Normal file
257
node_modules/vscode-jsonrpc/lib/node/main.js
generated
vendored
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.PortMessageWriter = exports.PortMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
const ril_1 = require("./ril");
|
||||
// Install the node runtime abstract.
|
||||
ril_1.default.install();
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
const crypto_1 = require("crypto");
|
||||
const net_1 = require("net");
|
||||
const api_1 = require("../common/api");
|
||||
__exportStar(require("../common/api"), exports);
|
||||
class IPCMessageReader extends api_1.AbstractMessageReader {
|
||||
constructor(process) {
|
||||
super();
|
||||
this.process = process;
|
||||
let eventEmitter = this.process;
|
||||
eventEmitter.on('error', (error) => this.fireError(error));
|
||||
eventEmitter.on('close', () => this.fireClose());
|
||||
}
|
||||
listen(callback) {
|
||||
this.process.on('message', callback);
|
||||
return api_1.Disposable.create(() => this.process.off('message', callback));
|
||||
}
|
||||
}
|
||||
exports.IPCMessageReader = IPCMessageReader;
|
||||
class IPCMessageWriter extends api_1.AbstractMessageWriter {
|
||||
constructor(process) {
|
||||
super();
|
||||
this.process = process;
|
||||
this.errorCount = 0;
|
||||
const eventEmitter = this.process;
|
||||
eventEmitter.on('error', (error) => this.fireError(error));
|
||||
eventEmitter.on('close', () => this.fireClose);
|
||||
}
|
||||
write(msg) {
|
||||
try {
|
||||
if (typeof this.process.send === 'function') {
|
||||
this.process.send(msg, undefined, undefined, (error) => {
|
||||
if (error) {
|
||||
this.errorCount++;
|
||||
this.handleError(error, msg);
|
||||
}
|
||||
else {
|
||||
this.errorCount = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
catch (error) {
|
||||
this.handleError(error, msg);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
handleError(error, msg) {
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
end() {
|
||||
}
|
||||
}
|
||||
exports.IPCMessageWriter = IPCMessageWriter;
|
||||
class PortMessageReader extends api_1.AbstractMessageReader {
|
||||
constructor(port) {
|
||||
super();
|
||||
this.onData = new api_1.Emitter;
|
||||
port.on('close', () => this.fireClose);
|
||||
port.on('error', (error) => this.fireError(error));
|
||||
port.on('message', (message) => {
|
||||
this.onData.fire(message);
|
||||
});
|
||||
}
|
||||
listen(callback) {
|
||||
return this.onData.event(callback);
|
||||
}
|
||||
}
|
||||
exports.PortMessageReader = PortMessageReader;
|
||||
class PortMessageWriter extends api_1.AbstractMessageWriter {
|
||||
constructor(port) {
|
||||
super();
|
||||
this.port = port;
|
||||
this.errorCount = 0;
|
||||
port.on('close', () => this.fireClose());
|
||||
port.on('error', (error) => this.fireError(error));
|
||||
}
|
||||
write(msg) {
|
||||
try {
|
||||
this.port.postMessage(msg);
|
||||
return Promise.resolve();
|
||||
}
|
||||
catch (error) {
|
||||
this.handleError(error, msg);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
}
|
||||
handleError(error, msg) {
|
||||
this.errorCount++;
|
||||
this.fireError(error, msg, this.errorCount);
|
||||
}
|
||||
end() {
|
||||
}
|
||||
}
|
||||
exports.PortMessageWriter = PortMessageWriter;
|
||||
class SocketMessageReader extends api_1.ReadableStreamMessageReader {
|
||||
constructor(socket, encoding = 'utf-8') {
|
||||
super((0, ril_1.default)().stream.asReadableStream(socket), encoding);
|
||||
}
|
||||
}
|
||||
exports.SocketMessageReader = SocketMessageReader;
|
||||
class SocketMessageWriter extends api_1.WriteableStreamMessageWriter {
|
||||
constructor(socket, options) {
|
||||
super((0, ril_1.default)().stream.asWritableStream(socket), options);
|
||||
this.socket = socket;
|
||||
}
|
||||
dispose() {
|
||||
super.dispose();
|
||||
this.socket.destroy();
|
||||
}
|
||||
}
|
||||
exports.SocketMessageWriter = SocketMessageWriter;
|
||||
class StreamMessageReader extends api_1.ReadableStreamMessageReader {
|
||||
constructor(readable, encoding) {
|
||||
super((0, ril_1.default)().stream.asReadableStream(readable), encoding);
|
||||
}
|
||||
}
|
||||
exports.StreamMessageReader = StreamMessageReader;
|
||||
class StreamMessageWriter extends api_1.WriteableStreamMessageWriter {
|
||||
constructor(writable, options) {
|
||||
super((0, ril_1.default)().stream.asWritableStream(writable), options);
|
||||
}
|
||||
}
|
||||
exports.StreamMessageWriter = StreamMessageWriter;
|
||||
const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR'];
|
||||
const safeIpcPathLengths = new Map([
|
||||
['linux', 107],
|
||||
['darwin', 103]
|
||||
]);
|
||||
function generateRandomPipeName() {
|
||||
const randomSuffix = (0, crypto_1.randomBytes)(21).toString('hex');
|
||||
if (process.platform === 'win32') {
|
||||
return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
|
||||
}
|
||||
let result;
|
||||
if (XDG_RUNTIME_DIR) {
|
||||
result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
|
||||
}
|
||||
else {
|
||||
result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
|
||||
}
|
||||
const limit = safeIpcPathLengths.get(process.platform);
|
||||
if (limit !== undefined && result.length > limit) {
|
||||
(0, ril_1.default)().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.generateRandomPipeName = generateRandomPipeName;
|
||||
function createClientPipeTransport(pipeName, encoding = 'utf-8') {
|
||||
let connectResolve;
|
||||
const connected = new Promise((resolve, _reject) => {
|
||||
connectResolve = resolve;
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
let server = (0, net_1.createServer)((socket) => {
|
||||
server.close();
|
||||
connectResolve([
|
||||
new SocketMessageReader(socket, encoding),
|
||||
new SocketMessageWriter(socket, encoding)
|
||||
]);
|
||||
});
|
||||
server.on('error', reject);
|
||||
server.listen(pipeName, () => {
|
||||
server.removeListener('error', reject);
|
||||
resolve({
|
||||
onConnected: () => { return connected; }
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.createClientPipeTransport = createClientPipeTransport;
|
||||
function createServerPipeTransport(pipeName, encoding = 'utf-8') {
|
||||
const socket = (0, net_1.createConnection)(pipeName);
|
||||
return [
|
||||
new SocketMessageReader(socket, encoding),
|
||||
new SocketMessageWriter(socket, encoding)
|
||||
];
|
||||
}
|
||||
exports.createServerPipeTransport = createServerPipeTransport;
|
||||
function createClientSocketTransport(port, encoding = 'utf-8') {
|
||||
let connectResolve;
|
||||
const connected = new Promise((resolve, _reject) => {
|
||||
connectResolve = resolve;
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
const server = (0, net_1.createServer)((socket) => {
|
||||
server.close();
|
||||
connectResolve([
|
||||
new SocketMessageReader(socket, encoding),
|
||||
new SocketMessageWriter(socket, encoding)
|
||||
]);
|
||||
});
|
||||
server.on('error', reject);
|
||||
server.listen(port, '127.0.0.1', () => {
|
||||
server.removeListener('error', reject);
|
||||
resolve({
|
||||
onConnected: () => { return connected; }
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.createClientSocketTransport = createClientSocketTransport;
|
||||
function createServerSocketTransport(port, encoding = 'utf-8') {
|
||||
const socket = (0, net_1.createConnection)(port, '127.0.0.1');
|
||||
return [
|
||||
new SocketMessageReader(socket, encoding),
|
||||
new SocketMessageWriter(socket, encoding)
|
||||
];
|
||||
}
|
||||
exports.createServerSocketTransport = createServerSocketTransport;
|
||||
function isReadableStream(value) {
|
||||
const candidate = value;
|
||||
return candidate.read !== undefined && candidate.addListener !== undefined;
|
||||
}
|
||||
function isWritableStream(value) {
|
||||
const candidate = value;
|
||||
return candidate.write !== undefined && candidate.addListener !== undefined;
|
||||
}
|
||||
function createMessageConnection(input, output, logger, options) {
|
||||
if (!logger) {
|
||||
logger = api_1.NullLogger;
|
||||
}
|
||||
const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
|
||||
const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
|
||||
if (api_1.ConnectionStrategy.is(options)) {
|
||||
options = { connectionStrategy: options };
|
||||
}
|
||||
return (0, api_1.createMessageConnection)(reader, writer, logger, options);
|
||||
}
|
||||
exports.createMessageConnection = createMessageConnection;
|
||||
13
node_modules/vscode-jsonrpc/lib/node/ril.d.ts
generated
vendored
Normal file
13
node_modules/vscode-jsonrpc/lib/node/ril.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/// <reference types="node" />
|
||||
import { RAL } from '../common/api';
|
||||
interface RIL extends RAL {
|
||||
readonly stream: {
|
||||
readonly asReadableStream: (stream: NodeJS.ReadableStream) => RAL.ReadableStream;
|
||||
readonly asWritableStream: (stream: NodeJS.WritableStream) => RAL.WritableStream;
|
||||
};
|
||||
}
|
||||
declare function RIL(): RIL;
|
||||
declare namespace RIL {
|
||||
function install(): void;
|
||||
}
|
||||
export default RIL;
|
||||
161
node_modules/vscode-jsonrpc/lib/node/ril.js
generated
vendored
Normal file
161
node_modules/vscode-jsonrpc/lib/node/ril.js
generated
vendored
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
"use strict";
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const util_1 = require("util");
|
||||
const api_1 = require("../common/api");
|
||||
class MessageBuffer extends api_1.AbstractMessageBuffer {
|
||||
constructor(encoding = 'utf-8') {
|
||||
super(encoding);
|
||||
}
|
||||
emptyBuffer() {
|
||||
return MessageBuffer.emptyBuffer;
|
||||
}
|
||||
fromString(value, encoding) {
|
||||
return Buffer.from(value, encoding);
|
||||
}
|
||||
toString(value, encoding) {
|
||||
if (value instanceof Buffer) {
|
||||
return value.toString(encoding);
|
||||
}
|
||||
else {
|
||||
return new util_1.TextDecoder(encoding).decode(value);
|
||||
}
|
||||
}
|
||||
asNative(buffer, length) {
|
||||
if (length === undefined) {
|
||||
return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
|
||||
}
|
||||
else {
|
||||
return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
|
||||
}
|
||||
}
|
||||
allocNative(length) {
|
||||
return Buffer.allocUnsafe(length);
|
||||
}
|
||||
}
|
||||
MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
|
||||
class ReadableStreamWrapper {
|
||||
constructor(stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
onClose(listener) {
|
||||
this.stream.on('close', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.stream.on('error', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.stream.on('end', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('end', listener));
|
||||
}
|
||||
onData(listener) {
|
||||
this.stream.on('data', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('data', listener));
|
||||
}
|
||||
}
|
||||
class WritableStreamWrapper {
|
||||
constructor(stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
onClose(listener) {
|
||||
this.stream.on('close', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('close', listener));
|
||||
}
|
||||
onError(listener) {
|
||||
this.stream.on('error', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('error', listener));
|
||||
}
|
||||
onEnd(listener) {
|
||||
this.stream.on('end', listener);
|
||||
return api_1.Disposable.create(() => this.stream.off('end', listener));
|
||||
}
|
||||
write(data, encoding) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const callback = (error) => {
|
||||
if (error === undefined || error === null) {
|
||||
resolve();
|
||||
}
|
||||
else {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
if (typeof data === 'string') {
|
||||
this.stream.write(data, encoding, callback);
|
||||
}
|
||||
else {
|
||||
this.stream.write(data, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
end() {
|
||||
this.stream.end();
|
||||
}
|
||||
}
|
||||
const _ril = Object.freeze({
|
||||
messageBuffer: Object.freeze({
|
||||
create: (encoding) => new MessageBuffer(encoding)
|
||||
}),
|
||||
applicationJson: Object.freeze({
|
||||
encoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
encode: (msg, options) => {
|
||||
try {
|
||||
return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
}),
|
||||
decoder: Object.freeze({
|
||||
name: 'application/json',
|
||||
decode: (buffer, options) => {
|
||||
try {
|
||||
if (buffer instanceof Buffer) {
|
||||
return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
|
||||
}
|
||||
else {
|
||||
return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
stream: Object.freeze({
|
||||
asReadableStream: (stream) => new ReadableStreamWrapper(stream),
|
||||
asWritableStream: (stream) => new WritableStreamWrapper(stream)
|
||||
}),
|
||||
console: console,
|
||||
timer: Object.freeze({
|
||||
setTimeout(callback, ms, ...args) {
|
||||
const handle = setTimeout(callback, ms, ...args);
|
||||
return { dispose: () => clearTimeout(handle) };
|
||||
},
|
||||
setImmediate(callback, ...args) {
|
||||
const handle = setImmediate(callback, ...args);
|
||||
return { dispose: () => clearImmediate(handle) };
|
||||
},
|
||||
setInterval(callback, ms, ...args) {
|
||||
const handle = setInterval(callback, ms, ...args);
|
||||
return { dispose: () => clearInterval(handle) };
|
||||
}
|
||||
})
|
||||
});
|
||||
function RIL() {
|
||||
return _ril;
|
||||
}
|
||||
(function (RIL) {
|
||||
function install() {
|
||||
api_1.RAL.install(_ril);
|
||||
}
|
||||
RIL.install = install;
|
||||
})(RIL || (RIL = {}));
|
||||
exports.default = RIL;
|
||||
5
node_modules/vscode-jsonrpc/node.cmd
generated
vendored
Normal file
5
node_modules/vscode-jsonrpc/node.cmd
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
@echo off
|
||||
REM This file is necessary to ensure that under Windows we don't
|
||||
REM run the node.js file in the Windows Script Host when using
|
||||
REM node in packakge.json scripts. See also PATHEXT setting
|
||||
node.exe %*
|
||||
6
node_modules/vscode-jsonrpc/node.d.ts
generated
vendored
Normal file
6
node_modules/vscode-jsonrpc/node.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
|
||||
export * from './lib/node/main';
|
||||
7
node_modules/vscode-jsonrpc/node.js
generated
vendored
Normal file
7
node_modules/vscode-jsonrpc/node.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ----------------------------------------------------------------------------------------- */
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/node/main');
|
||||
45
node_modules/vscode-jsonrpc/package.json
generated
vendored
Normal file
45
node_modules/vscode-jsonrpc/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "vscode-jsonrpc",
|
||||
"description": "A json rpc implementation over streams",
|
||||
"version": "8.1.0",
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode-languageserver-node.git",
|
||||
"directory": "jsonrpc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode-languageserver-node/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"main": "./lib/node/main.js",
|
||||
"browser": {
|
||||
"./lib/node/main.js": "./lib/browser/main.js"
|
||||
},
|
||||
"typings": "./lib/common/api.d.ts",
|
||||
"devDependencies": {
|
||||
"@types/msgpack-lite": "^0.1.7",
|
||||
"msgpack-lite": "^0.1.26"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "echo \"⛔ Can only publish from a secure pipeline ⛔\" && node ../build/npm/fail",
|
||||
"prepack": "npm run all:publish",
|
||||
"preversion": "npm test",
|
||||
"compile": "node ../build/bin/tsc -b ./tsconfig.json",
|
||||
"watch": "node ../build/bin/tsc -b ./tsconfig.watch.json -w",
|
||||
"clean": "node ../node_modules/rimraf/bin.js lib && node ../node_modules/rimraf/bin.js dist",
|
||||
"lint": "node ../node_modules/eslint/bin/eslint.js --ext ts src",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:node": "node ../node_modules/mocha/bin/_mocha",
|
||||
"test:browser": "npm run webpack:test:silent && node ../build/bin/runBrowserTests.js http://127.0.0.1:8080/jsonrpc/src/browser/test/",
|
||||
"webpack": "node ../build/bin/webpack --mode none --config ./webpack.config.js",
|
||||
"webpack:test": "node ../build/bin/webpack --mode none --config ./src/browser/test/webpack.config.js",
|
||||
"webpack:test:silent": "node ../build/bin/webpack --no-stats --mode none --config ./src/browser/test/webpack.config.js",
|
||||
"all": "npm run clean && npm run compile && npm run lint && npm run test",
|
||||
"compile:publish": "node ../build/bin/tsc -b ./tsconfig.publish.json",
|
||||
"all:publish": "git clean -xfd . && npm install && npm run compile:publish && npm run lint && npm run test"
|
||||
}
|
||||
}
|
||||
16
node_modules/vscode-jsonrpc/thirdpartynotices.txt
generated
vendored
Normal file
16
node_modules/vscode-jsonrpc/thirdpartynotices.txt
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
NOTICES AND INFORMATION
|
||||
Do Not Translate or Localize
|
||||
|
||||
This software incorporates material from third parties.
|
||||
Microsoft makes certain open source code available at https://3rdpartysource.microsoft.com,
|
||||
or you may send a check or money order for US $5.00, including the product name,
|
||||
the open source component name, platform, and version number, to:
|
||||
|
||||
Source Code Compliance Team
|
||||
Microsoft Corporation
|
||||
One Microsoft Way
|
||||
Redmond, WA 98052
|
||||
USA
|
||||
|
||||
Notwithstanding any other terms, you may reverse engineer this software to the extent
|
||||
required to debug changes to any libraries licensed under the GNU Lesser General Public License.
|
||||
5
node_modules/vscode-jsonrpc/typings/thenable.d.ts
generated
vendored
Normal file
5
node_modules/vscode-jsonrpc/typings/thenable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* --------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
interface Thenable<T> extends PromiseLike<T> { }
|
||||
Loading…
Add table
Add a link
Reference in a new issue