@codingame/monaco-languageclient-wrapper 1.1.7 → 1.2.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/dist/index.d.ts +2 -1
- package/dist/main.js +66 -16
- package/dist/monaco-languageclient-wrapper.d.ts +1478 -0
- package/dist/staticOptions.d.ts +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +1 -1
- package/stats.html +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import 'proxy-polyfill';
|
|
2
2
|
import './hacks';
|
|
3
3
|
import { createLanguageClientManager, StatusChangeEvent } from './languageClient';
|
|
4
|
+
import { LanguageClientId } from './staticOptions';
|
|
4
5
|
export { createLanguageClientManager };
|
|
5
|
-
export type { StatusChangeEvent };
|
|
6
|
+
export type { StatusChangeEvent, LanguageClientId };
|
package/dist/main.js
CHANGED
|
@@ -20732,8 +20732,7 @@ async function openConnection(url, errorHandler, closeHandler) {
|
|
|
20732
20732
|
webSocketConnection.onDispose(() => {
|
|
20733
20733
|
webSocket.close();
|
|
20734
20734
|
});
|
|
20735
|
-
const
|
|
20736
|
-
const connection = lib$1.createConnection(webSocketConnection, errorHandler, onceCloseHandler);
|
|
20735
|
+
const connection = lib$1.createConnection(webSocketConnection, errorHandler, closeHandler);
|
|
20737
20736
|
const existingRegistrations = new Set();
|
|
20738
20737
|
|
|
20739
20738
|
const fixedConnection = _objectSpread2(_objectSpread2({}, connection), {}, {
|
|
@@ -20802,13 +20801,13 @@ async function openConnection(url, errorHandler, closeHandler) {
|
|
|
20802
20801
|
// The language client is then still active but without a proper connection and errors will occurs
|
|
20803
20802
|
|
|
20804
20803
|
|
|
20805
|
-
|
|
20804
|
+
closeHandler();
|
|
20806
20805
|
},
|
|
20807
20806
|
shutdown: async () => {
|
|
20808
20807
|
// The shutdown should NEVER fail or the connection is not closed and the lsp client is not properly cleaned
|
|
20809
20808
|
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3103
|
|
20810
20809
|
try {
|
|
20811
|
-
await connection.
|
|
20810
|
+
await connection.shutdown();
|
|
20812
20811
|
} catch (error) {
|
|
20813
20812
|
console.warn('[LSP]', 'Error while shutdown lsp', error);
|
|
20814
20813
|
}
|
|
@@ -20836,15 +20835,20 @@ class CGLSPConnectionProvider {
|
|
|
20836
20835
|
}
|
|
20837
20836
|
|
|
20838
20837
|
async get(errorHandler, closeHandler) {
|
|
20838
|
+
const onceDelayedCloseHandler = once(() => {
|
|
20839
|
+
setTimeout(() => {
|
|
20840
|
+
closeHandler();
|
|
20841
|
+
}, RETRY_DELAY);
|
|
20842
|
+
});
|
|
20843
|
+
|
|
20839
20844
|
try {
|
|
20840
20845
|
const path = this.sessionId != null ? "run/".concat(this.sessionId, "/").concat(this.id) : "run/".concat(this.id);
|
|
20841
20846
|
const url = new URL(path, this.serverAddress);
|
|
20842
20847
|
this.libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
20843
20848
|
url.searchParams.append('token', await this.getSecurityToken());
|
|
20844
|
-
return await openConnection(url, errorHandler,
|
|
20849
|
+
return await openConnection(url, errorHandler, onceDelayedCloseHandler);
|
|
20845
20850
|
} catch (err) {
|
|
20846
|
-
|
|
20847
|
-
await delay$1(1000);
|
|
20851
|
+
onceDelayedCloseHandler();
|
|
20848
20852
|
throw err;
|
|
20849
20853
|
}
|
|
20850
20854
|
}
|
|
@@ -21092,7 +21096,14 @@ const staticOptions = asLanguageClientOptionsById({
|
|
|
21092
21096
|
sql: {
|
|
21093
21097
|
documentSelector: [{
|
|
21094
21098
|
language: 'sql'
|
|
21095
|
-
}]
|
|
21099
|
+
}],
|
|
21100
|
+
// Disable code actions
|
|
21101
|
+
middleware: {
|
|
21102
|
+
provideCodeActions() {
|
|
21103
|
+
return [];
|
|
21104
|
+
}
|
|
21105
|
+
|
|
21106
|
+
}
|
|
21096
21107
|
},
|
|
21097
21108
|
swift: {
|
|
21098
21109
|
// https://github.com/apple/sourcekit-lsp/blob/59b5e68f7f8408b5bc44bd47f71ef1afdc63e7a6/Editors/vscode/src/extension.ts#L22
|
|
@@ -21206,38 +21217,71 @@ class LanguageClientManager {
|
|
|
21206
21217
|
}
|
|
21207
21218
|
|
|
21208
21219
|
start() {
|
|
21220
|
+
var _this$languageServerO;
|
|
21221
|
+
|
|
21209
21222
|
const onServerResponse = new lib$1.Emitter();
|
|
21210
21223
|
const languageClient = createLanguageClient(this.id, this.sessionId, this.languageServerOptions, this.languageServerAddress, this.getSecurityToken, this.libraryUrls, {
|
|
21211
21224
|
error: this.handleError,
|
|
21212
21225
|
closed: this.handleClose
|
|
21213
|
-
}, {
|
|
21226
|
+
}, _objectSpread2(_objectSpread2({}, (_this$languageServerO = this.languageServerOptions.middleware) !== null && _this$languageServerO !== void 0 ? _this$languageServerO : {}), {}, {
|
|
21214
21227
|
handleDiagnostics: (uri, diagnostics, next) => {
|
|
21215
|
-
|
|
21228
|
+
var _this$languageServerO2;
|
|
21229
|
+
|
|
21230
|
+
if (((_this$languageServerO2 = this.languageServerOptions.middleware) === null || _this$languageServerO2 === void 0 ? void 0 : _this$languageServerO2.handleDiagnostics) != null) {
|
|
21231
|
+
this.languageServerOptions.middleware.handleDiagnostics(uri, diagnostics, next);
|
|
21232
|
+
} else {
|
|
21233
|
+
next(uri, diagnostics);
|
|
21234
|
+
}
|
|
21235
|
+
|
|
21216
21236
|
onServerResponse.fire();
|
|
21217
21237
|
},
|
|
21218
21238
|
provideCodeActions: async (document, range, context, token, next) => {
|
|
21219
21239
|
try {
|
|
21220
|
-
|
|
21240
|
+
var _this$languageServerO3;
|
|
21241
|
+
|
|
21242
|
+
if (((_this$languageServerO3 = this.languageServerOptions.middleware) === null || _this$languageServerO3 === void 0 ? void 0 : _this$languageServerO3.provideCodeActions) != null) {
|
|
21243
|
+
return await this.languageServerOptions.middleware.provideCodeActions(document, range, context, token, next);
|
|
21244
|
+
} else {
|
|
21245
|
+
return await next(document, range, context, token);
|
|
21246
|
+
}
|
|
21221
21247
|
} finally {
|
|
21222
21248
|
onServerResponse.fire();
|
|
21223
21249
|
}
|
|
21224
21250
|
},
|
|
21225
21251
|
provideDocumentRangeSemanticTokens: async (document, range, token, next) => {
|
|
21226
21252
|
try {
|
|
21227
|
-
|
|
21253
|
+
var _this$languageServerO4;
|
|
21254
|
+
|
|
21255
|
+
if (((_this$languageServerO4 = this.languageServerOptions.middleware) === null || _this$languageServerO4 === void 0 ? void 0 : _this$languageServerO4.provideDocumentRangeSemanticTokens) != null) {
|
|
21256
|
+
return await this.languageServerOptions.middleware.provideDocumentRangeSemanticTokens(document, range, token, next);
|
|
21257
|
+
} else {
|
|
21258
|
+
return await next(document, range, token);
|
|
21259
|
+
}
|
|
21228
21260
|
} finally {
|
|
21229
21261
|
onServerResponse.fire();
|
|
21230
21262
|
}
|
|
21231
21263
|
},
|
|
21232
21264
|
provideDocumentSemanticTokens: async (document, token, next) => {
|
|
21233
21265
|
try {
|
|
21234
|
-
|
|
21266
|
+
var _this$languageServerO5;
|
|
21267
|
+
|
|
21268
|
+
if (((_this$languageServerO5 = this.languageServerOptions.middleware) === null || _this$languageServerO5 === void 0 ? void 0 : _this$languageServerO5.provideDocumentSemanticTokens) != null) {
|
|
21269
|
+
return await this.languageServerOptions.middleware.provideDocumentSemanticTokens(document, token, next);
|
|
21270
|
+
} else {
|
|
21271
|
+
return await next(document, token);
|
|
21272
|
+
}
|
|
21235
21273
|
} finally {
|
|
21236
21274
|
onServerResponse.fire();
|
|
21237
21275
|
}
|
|
21238
21276
|
},
|
|
21239
21277
|
handleWorkDoneProgress: async (token, params, next) => {
|
|
21240
|
-
|
|
21278
|
+
var _this$languageServerO6;
|
|
21279
|
+
|
|
21280
|
+
if (((_this$languageServerO6 = this.languageServerOptions.middleware) === null || _this$languageServerO6 === void 0 ? void 0 : _this$languageServerO6.handleWorkDoneProgress) != null) {
|
|
21281
|
+
this.languageServerOptions.middleware.handleWorkDoneProgress(token, params, next);
|
|
21282
|
+
} else {
|
|
21283
|
+
next(token, params);
|
|
21284
|
+
}
|
|
21241
21285
|
|
|
21242
21286
|
if (params.kind === 'end') {
|
|
21243
21287
|
onServerResponse.fire();
|
|
@@ -21245,12 +21289,18 @@ class LanguageClientManager {
|
|
|
21245
21289
|
},
|
|
21246
21290
|
provideHover: async (document, position, token, next) => {
|
|
21247
21291
|
try {
|
|
21248
|
-
|
|
21292
|
+
var _this$languageServerO7;
|
|
21293
|
+
|
|
21294
|
+
if (((_this$languageServerO7 = this.languageServerOptions.middleware) === null || _this$languageServerO7 === void 0 ? void 0 : _this$languageServerO7.provideHover) != null) {
|
|
21295
|
+
return await this.languageServerOptions.middleware.provideHover(document, position, token, next);
|
|
21296
|
+
} else {
|
|
21297
|
+
return await next(document, position, token);
|
|
21298
|
+
}
|
|
21249
21299
|
} finally {
|
|
21250
21300
|
onServerResponse.fire();
|
|
21251
21301
|
}
|
|
21252
21302
|
}
|
|
21253
|
-
});
|
|
21303
|
+
}));
|
|
21254
21304
|
this.languageClient = languageClient;
|
|
21255
21305
|
let readyPromise = null;
|
|
21256
21306
|
languageClient.onDidChangeState(async state => {
|