@difizen/libro-lsp 0.1.2
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.
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/es/adapters/adapter.d.ts +255 -0
- package/es/adapters/adapter.d.ts.map +1 -0
- package/es/adapters/adapter.js +647 -0
- package/es/adapters/notebook-adapter.d.ts +150 -0
- package/es/adapters/notebook-adapter.d.ts.map +1 -0
- package/es/adapters/notebook-adapter.js +588 -0
- package/es/adapters/status-message.d.ts +48 -0
- package/es/adapters/status-message.d.ts.map +1 -0
- package/es/adapters/status-message.js +110 -0
- package/es/connection-manager.d.ts +199 -0
- package/es/connection-manager.d.ts.map +1 -0
- package/es/connection-manager.js +685 -0
- package/es/connection.d.ts +149 -0
- package/es/connection.d.ts.map +1 -0
- package/es/connection.js +591 -0
- package/es/extractors/index.d.ts +4 -0
- package/es/extractors/index.d.ts.map +1 -0
- package/es/extractors/index.js +6 -0
- package/es/extractors/manager.d.ts +31 -0
- package/es/extractors/manager.d.ts.map +1 -0
- package/es/extractors/manager.js +90 -0
- package/es/extractors/text-extractor.d.ts +56 -0
- package/es/extractors/text-extractor.d.ts.map +1 -0
- package/es/extractors/text-extractor.js +72 -0
- package/es/extractors/types.d.ts +68 -0
- package/es/extractors/types.d.ts.map +1 -0
- package/es/extractors/types.js +1 -0
- package/es/feature.d.ts +29 -0
- package/es/feature.d.ts.map +1 -0
- package/es/feature.js +85 -0
- package/es/index.d.ts +19 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +21 -0
- package/es/lsp-app-contribution.d.ts +19 -0
- package/es/lsp-app-contribution.d.ts.map +1 -0
- package/es/lsp-app-contribution.js +155 -0
- package/es/lsp-protocol.d.ts +10 -0
- package/es/lsp-protocol.d.ts.map +1 -0
- package/es/lsp-protocol.js +1 -0
- package/es/lsp.d.ts +136 -0
- package/es/lsp.d.ts.map +1 -0
- package/es/lsp.js +141 -0
- package/es/manager.d.ts +142 -0
- package/es/manager.d.ts.map +1 -0
- package/es/manager.js +423 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +21 -0
- package/es/plugin.d.ts +56 -0
- package/es/plugin.d.ts.map +1 -0
- package/es/plugin.js +0 -0
- package/es/positioning.d.ts +66 -0
- package/es/positioning.d.ts.map +1 -0
- package/es/positioning.js +96 -0
- package/es/schema.d.ts +240 -0
- package/es/schema.d.ts.map +1 -0
- package/es/schema.js +0 -0
- package/es/tokens.d.ts +677 -0
- package/es/tokens.d.ts.map +1 -0
- package/es/tokens.js +183 -0
- package/es/utils.d.ts +33 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +168 -0
- package/es/virtual/document.d.ts +546 -0
- package/es/virtual/document.d.ts.map +1 -0
- package/es/virtual/document.js +1263 -0
- package/es/ws-connection/server-capability-registration.d.ts +19 -0
- package/es/ws-connection/server-capability-registration.d.ts.map +1 -0
- package/es/ws-connection/server-capability-registration.js +51 -0
- package/es/ws-connection/types.d.ts +76 -0
- package/es/ws-connection/types.d.ts.map +1 -0
- package/es/ws-connection/types.js +1 -0
- package/es/ws-connection/ws-connection.d.ts +105 -0
- package/es/ws-connection/ws-connection.d.ts.map +1 -0
- package/es/ws-connection/ws-connection.js +301 -0
- package/package.json +67 -0
- package/src/adapters/adapter.ts +611 -0
- package/src/adapters/notebook-adapter.ts +463 -0
- package/src/adapters/status-message.ts +93 -0
- package/src/connection-manager.ts +626 -0
- package/src/connection.ts +570 -0
- package/src/extractors/index.ts +6 -0
- package/src/extractors/manager.ts +82 -0
- package/src/extractors/text-extractor.ts +94 -0
- package/src/extractors/types.ts +78 -0
- package/src/feature.ts +60 -0
- package/src/index.spec.ts +10 -0
- package/src/index.ts +21 -0
- package/src/lsp-app-contribution.ts +83 -0
- package/src/lsp-protocol.ts +10 -0
- package/src/lsp.ts +160 -0
- package/src/manager.ts +358 -0
- package/src/module.ts +32 -0
- package/src/plugin.ts +62 -0
- package/src/positioning.ts +121 -0
- package/src/schema.ts +249 -0
- package/src/tokens.ts +843 -0
- package/src/utils.ts +109 -0
- package/src/virtual/document.ts +1250 -0
- package/src/ws-connection/server-capability-registration.ts +77 -0
- package/src/ws-connection/types.ts +102 -0
- package/src/ws-connection/ws-connection.ts +320 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { Event } from '@difizen/mana-app';
|
|
2
|
+
import { Emitter } from '@difizen/mana-app';
|
|
3
|
+
import type * as lsp from 'vscode-languageserver-protocol';
|
|
4
|
+
import { Method } from './tokens.js';
|
|
5
|
+
import type { ClientNotifications, ClientRequests, IDocumentInfo, ILSPConnection, ILSPOptions, ServerNotifications, ServerRequests } from './tokens.js';
|
|
6
|
+
import { LspWsConnection } from './ws-connection/ws-connection.js';
|
|
7
|
+
export declare const Provider: Record<string, keyof lsp.ServerCapabilities>;
|
|
8
|
+
type AnyMethod = Method.ServerNotification | Method.ClientNotification | Method.ClientRequest | Method.ServerRequest;
|
|
9
|
+
declare enum MessageKind {
|
|
10
|
+
clientNotifiedServer = 0,
|
|
11
|
+
serverNotifiedClient = 1,
|
|
12
|
+
serverRequested = 2,
|
|
13
|
+
clientRequested = 3,
|
|
14
|
+
resultForClient = 4,
|
|
15
|
+
responseForServer = 5
|
|
16
|
+
}
|
|
17
|
+
interface IMessageLog<T extends AnyMethod = AnyMethod> {
|
|
18
|
+
method: T;
|
|
19
|
+
message: any;
|
|
20
|
+
}
|
|
21
|
+
export declare class LSPConnection extends LspWsConnection implements ILSPConnection {
|
|
22
|
+
constructor(options: ILSPOptions);
|
|
23
|
+
/**
|
|
24
|
+
* Identifier of the language server
|
|
25
|
+
*/
|
|
26
|
+
readonly serverIdentifier?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Language of the language server
|
|
29
|
+
*/
|
|
30
|
+
readonly serverLanguage?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Notifications comes from the client.
|
|
33
|
+
*/
|
|
34
|
+
readonly clientNotifications: ClientNotifications;
|
|
35
|
+
/**
|
|
36
|
+
* Notifications comes from the server.
|
|
37
|
+
*/
|
|
38
|
+
readonly serverNotifications: ServerNotifications;
|
|
39
|
+
/**
|
|
40
|
+
* Requests comes from the client.
|
|
41
|
+
*/
|
|
42
|
+
clientRequests: ClientRequests;
|
|
43
|
+
/**
|
|
44
|
+
* Responses comes from the server.
|
|
45
|
+
*/
|
|
46
|
+
serverRequests: ServerRequests;
|
|
47
|
+
/**
|
|
48
|
+
* Should log all communication?
|
|
49
|
+
*/
|
|
50
|
+
logAllCommunication: boolean;
|
|
51
|
+
get capabilities(): lsp.ServerCapabilities<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Signal emitted when the connection is closed.
|
|
54
|
+
*/
|
|
55
|
+
get closeSignal(): Event<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Signal emitted when the connection receives an error
|
|
58
|
+
* message..
|
|
59
|
+
*/
|
|
60
|
+
get errorSignal(): Event<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Signal emitted when the connection is initialized.
|
|
63
|
+
*/
|
|
64
|
+
get serverInitialized(): Event<lsp.ServerCapabilities<any>>;
|
|
65
|
+
/**
|
|
66
|
+
* Dispose the connection.
|
|
67
|
+
*/
|
|
68
|
+
dispose(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Helper to print the logs to logger, for now we are using
|
|
71
|
+
* directly the browser's console.
|
|
72
|
+
*/
|
|
73
|
+
log(kind: MessageKind, message: IMessageLog): void;
|
|
74
|
+
/**
|
|
75
|
+
* Send the open request to the backend when the server is
|
|
76
|
+
* ready.
|
|
77
|
+
*/
|
|
78
|
+
sendOpenWhenReady(documentInfo: IDocumentInfo): void;
|
|
79
|
+
/**
|
|
80
|
+
* Send the document changes to the server.
|
|
81
|
+
*/
|
|
82
|
+
sendSelectiveChange(changeEvent: lsp.TextDocumentContentChangeEvent, documentInfo: IDocumentInfo): void;
|
|
83
|
+
/**
|
|
84
|
+
* Send all changes to the server.
|
|
85
|
+
*/
|
|
86
|
+
sendFullTextChange(text: string, documentInfo: IDocumentInfo): void;
|
|
87
|
+
/**
|
|
88
|
+
* Check if a provider is available in the registered capabilities.
|
|
89
|
+
*/
|
|
90
|
+
provides(provider: keyof lsp.ServerCapabilities): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Close the connection to the server.
|
|
93
|
+
*/
|
|
94
|
+
close(): void;
|
|
95
|
+
/**
|
|
96
|
+
* initialize a connection over a web socket that speaks the LSP
|
|
97
|
+
*/
|
|
98
|
+
connect(socket: WebSocket): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get send request to the server to get completion results
|
|
101
|
+
* from a completion item
|
|
102
|
+
*/
|
|
103
|
+
getCompletionResolve(completionItem: lsp.CompletionItem): Promise<lsp.CompletionItem | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* List of documents waiting to be opened once the connection
|
|
106
|
+
* is ready.
|
|
107
|
+
*/
|
|
108
|
+
protected documentsToOpen: IDocumentInfo[];
|
|
109
|
+
/**
|
|
110
|
+
* Generate the notification handlers
|
|
111
|
+
*/
|
|
112
|
+
protected constructNotificationHandlers<T extends ServerNotifications | ClientNotifications>(methods: typeof Method.ServerNotification | typeof Method.ClientNotification): T;
|
|
113
|
+
/**
|
|
114
|
+
* Generate the client request handler
|
|
115
|
+
*/
|
|
116
|
+
protected constructClientRequestHandler<T extends ClientRequests, U extends keyof T = keyof T>(methods: typeof Method.ClientRequest): T;
|
|
117
|
+
/**
|
|
118
|
+
* Generate the server response handler
|
|
119
|
+
*/
|
|
120
|
+
protected constructServerRequestHandler<T extends ServerRequests, U extends keyof T = keyof T>(methods: typeof Method.ServerRequest): T;
|
|
121
|
+
/**
|
|
122
|
+
* Initialization parameters to be sent to the language server.
|
|
123
|
+
* Subclasses can overload this when adding more features.
|
|
124
|
+
*/
|
|
125
|
+
protected initializeParams(): lsp.InitializeParams;
|
|
126
|
+
/**
|
|
127
|
+
* Callback called when the server is initialized.
|
|
128
|
+
*/
|
|
129
|
+
protected onServerInitialized(params: lsp.InitializeResult): void;
|
|
130
|
+
/**
|
|
131
|
+
* Once the server is initialized, this method generates the
|
|
132
|
+
* client and server handlers
|
|
133
|
+
*/
|
|
134
|
+
protected afterInitialized(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Is the connection is closed manually?
|
|
137
|
+
*/
|
|
138
|
+
protected _closingManually: boolean;
|
|
139
|
+
protected _options: ILSPOptions;
|
|
140
|
+
protected _closeSignal: Emitter<boolean>;
|
|
141
|
+
protected _errorSignal: Emitter<any>;
|
|
142
|
+
protected _serverInitialized: Emitter<lsp.ServerCapabilities<any>>;
|
|
143
|
+
/**
|
|
144
|
+
* Send the document changed data to the server.
|
|
145
|
+
*/
|
|
146
|
+
protected _sendChange(changeEvents: lsp.TextDocumentContentChangeEvent[], documentInfo: IDocumentInfo): void;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,KAAK,GAAG,MAAM,gCAAgC,CAAC;AAG3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EAId,aAAa,EACb,cAAc,EACd,WAAW,EAIX,mBAAmB,EACnB,cAAc,EACf,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAyFnE,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,kBAAkB,CAyBjE,CAAC;AAOF,KAAK,SAAS,GACV,MAAM,CAAC,kBAAkB,GACzB,MAAM,CAAC,kBAAkB,GACzB,MAAM,CAA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