@codingame/monaco-vscode-api 12.0.1 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,175 +0,0 @@
1
- import { VSBuffer } from "../../../common/buffer.js";
2
- import { CancellationToken } from "../../../common/cancellation.js";
3
- import { Event } from "../../../common/event.js";
4
- import { DisposableStore, IDisposable } from "../../../common/lifecycle.js";
5
- export interface IChannel {
6
- call<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
7
- listen<T>(event: string, arg?: any): Event<T>;
8
- }
9
- export interface IServerChannel<TContext = string> {
10
- call<T>(ctx: TContext, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T>;
11
- listen<T>(ctx: TContext, event: string, arg?: any): Event<T>;
12
- }
13
- export interface IMessagePassingProtocol {
14
- send(buffer: VSBuffer): void;
15
- onMessage: Event<VSBuffer>;
16
- drain?(): Promise<void>;
17
- }
18
- export interface IChannelServer<TContext = string> {
19
- registerChannel(channelName: string, channel: IServerChannel<TContext>): void;
20
- }
21
- export interface IChannelClient {
22
- getChannel<T extends IChannel>(channelName: string): T;
23
- }
24
- export interface Client<TContext> {
25
- readonly ctx: TContext;
26
- }
27
- export interface IConnectionHub<TContext> {
28
- readonly connections: Connection<TContext>[];
29
- readonly onDidAddConnection: Event<Connection<TContext>>;
30
- readonly onDidRemoveConnection: Event<Connection<TContext>>;
31
- }
32
- export interface IClientRouter<TContext = string> {
33
- routeCall(hub: IConnectionHub<TContext>, command: string, arg?: any, cancellationToken?: CancellationToken): Promise<Client<TContext>>;
34
- routeEvent(hub: IConnectionHub<TContext>, event: string, arg?: any): Promise<Client<TContext>>;
35
- }
36
- export interface IRoutingChannelClient<TContext = string> {
37
- getChannel<T extends IChannel>(channelName: string, router?: IClientRouter<TContext>): T;
38
- }
39
- interface IReader {
40
- read(bytes: number): VSBuffer;
41
- }
42
- interface IWriter {
43
- write(buffer: VSBuffer): void;
44
- }
45
- export declare class BufferReader implements IReader {
46
- private buffer;
47
- private pos;
48
- constructor(buffer: VSBuffer);
49
- read(bytes: number): VSBuffer;
50
- }
51
- export declare class BufferWriter implements IWriter {
52
- private buffers;
53
- get buffer(): VSBuffer;
54
- write(buffer: VSBuffer): void;
55
- }
56
- export declare function serialize(writer: IWriter, data: any): void;
57
- export declare function deserialize(reader: IReader): any;
58
- export declare class ChannelServer<TContext = string> implements IChannelServer<TContext>, IDisposable {
59
- private protocol;
60
- private ctx;
61
- private logger;
62
- private timeoutDelay;
63
- private channels;
64
- private activeRequests;
65
- private protocolListener;
66
- private pendingRequests;
67
- constructor(protocol: IMessagePassingProtocol, ctx: TContext, logger?: IIPCLogger | null, timeoutDelay?: number);
68
- registerChannel(channelName: string, channel: IServerChannel<TContext>): void;
69
- private sendResponse;
70
- private send;
71
- private sendBuffer;
72
- private onRawMessage;
73
- private onPromise;
74
- private onEventListen;
75
- private disposeActiveRequest;
76
- private collectPendingRequest;
77
- private flushPendingRequests;
78
- dispose(): void;
79
- }
80
- export declare enum RequestInitiator {
81
- LocalSide = 0,
82
- OtherSide = 1
83
- }
84
- export interface IIPCLogger {
85
- logIncoming(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;
86
- logOutgoing(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;
87
- }
88
- export declare class ChannelClient implements IChannelClient, IDisposable {
89
- private protocol;
90
- private isDisposed;
91
- private state;
92
- private activeRequests;
93
- private handlers;
94
- private lastRequestId;
95
- private protocolListener;
96
- private logger;
97
- private readonly _onDidInitialize;
98
- readonly onDidInitialize: Event<void>;
99
- constructor(protocol: IMessagePassingProtocol, logger?: IIPCLogger | null);
100
- getChannel<T extends IChannel>(channelName: string): T;
101
- private requestPromise;
102
- private requestEvent;
103
- private sendRequest;
104
- private send;
105
- private sendBuffer;
106
- private onBuffer;
107
- private onResponse;
108
- get onDidInitializePromise(): Promise<void>;
109
- private whenInitialized;
110
- dispose(): void;
111
- }
112
- export interface ClientConnectionEvent {
113
- protocol: IMessagePassingProtocol;
114
- onDidClientDisconnect: Event<void>;
115
- }
116
- interface Connection<TContext> extends Client<TContext> {
117
- readonly channelServer: ChannelServer<TContext>;
118
- readonly channelClient: ChannelClient;
119
- }
120
- export declare class IPCServer<TContext = string> implements IChannelServer<TContext>, IRoutingChannelClient<TContext>, IConnectionHub<TContext>, IDisposable {
121
- private channels;
122
- private _connections;
123
- private readonly _onDidAddConnection;
124
- readonly onDidAddConnection: Event<Connection<TContext>>;
125
- private readonly _onDidRemoveConnection;
126
- readonly onDidRemoveConnection: Event<Connection<TContext>>;
127
- private readonly disposables;
128
- get connections(): Connection<TContext>[];
129
- constructor(onDidClientConnect: Event<ClientConnectionEvent>, ipcLogger?: IIPCLogger | null, timeoutDelay?: number);
130
- getChannel<T extends IChannel>(channelName: string, router: IClientRouter<TContext>): T;
131
- getChannel<T extends IChannel>(channelName: string, clientFilter: (client: Client<TContext>) => boolean): T;
132
- private getMulticastEvent;
133
- registerChannel(channelName: string, channel: IServerChannel<TContext>): void;
134
- dispose(): void;
135
- }
136
- export declare class IPCClient<TContext = string> implements IChannelClient, IChannelServer<TContext>, IDisposable {
137
- private channelClient;
138
- private channelServer;
139
- constructor(protocol: IMessagePassingProtocol, ctx: TContext, ipcLogger?: IIPCLogger | null);
140
- getChannel<T extends IChannel>(channelName: string): T;
141
- registerChannel(channelName: string, channel: IServerChannel<TContext>): void;
142
- dispose(): void;
143
- }
144
- export declare function getDelayedChannel<T extends IChannel>(promise: Promise<T>): T;
145
- export declare function getNextTickChannel<T extends IChannel>(channel: T): T;
146
- export declare class StaticRouter<TContext = string> implements IClientRouter<TContext> {
147
- private fn;
148
- constructor(fn: (ctx: TContext) => boolean | Promise<boolean>);
149
- routeCall(hub: IConnectionHub<TContext>): Promise<Client<TContext>>;
150
- routeEvent(hub: IConnectionHub<TContext>): Promise<Client<TContext>>;
151
- private route;
152
- }
153
- export declare namespace ProxyChannel {
154
- interface IProxyOptions {
155
- disableMarshalling?: boolean;
156
- }
157
- interface ICreateServiceChannelOptions extends IProxyOptions {
158
- }
159
- function fromService<TContext>(service: unknown, disposables: DisposableStore, options?: ICreateServiceChannelOptions): IServerChannel<TContext>;
160
- interface ICreateProxyServiceOptions extends IProxyOptions {
161
- context?: unknown;
162
- properties?: Map<string, unknown>;
163
- }
164
- function toService<T extends object>(channel: IChannel, options?: ICreateProxyServiceOptions): T;
165
- }
166
- export declare class IPCLogger implements IIPCLogger {
167
- private readonly _outgoingPrefix;
168
- private readonly _incomingPrefix;
169
- private _totalIncoming;
170
- private _totalOutgoing;
171
- constructor(_outgoingPrefix: string, _incomingPrefix: string);
172
- logOutgoing(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;
173
- logIncoming(msgLength: number, requestId: number, initiator: RequestInitiator, str: string, data?: any): void;
174
- }
175
- export {};