@codingame/monaco-languageclient-wrapper 2.1.3 → 2.2.1
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 +53 -52
- package/dist/index.js +234 -194
- package/package.json +45 -10
- package/stats.html +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toSocket, createWebSocketConnection, ConsoleLogger } from '@codingame/monaco-jsonrpc';
|
|
2
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
3
|
+
import { Uri } from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
2
4
|
import * as vscodeLanguageserverProtocol from 'vscode-languageserver-protocol';
|
|
3
|
-
import { ProtocolNotificationType, ProtocolRequestType, RenameFile, CreateFile } from 'vscode-languageserver-protocol';
|
|
5
|
+
import { ProtocolNotificationType, ProtocolRequestType, Disposable, RenameFile, CreateFile } from 'vscode-languageserver-protocol';
|
|
6
|
+
import { loadConfigurationForExtension } from '@codingame/monaco-editor-wrapper/dist/features/extensionConfigurations';
|
|
4
7
|
import * as api$1 from 'vscode-languageserver-protocol/lib/common/api';
|
|
5
8
|
import * as is$2 from 'vscode-languageserver-protocol/lib/common/utils/is';
|
|
6
|
-
import * as monaco from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
7
|
-
import { Uri } from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
8
|
-
import { toSocket, createWebSocketConnection, ConsoleLogger } from '@codingame/monaco-jsonrpc';
|
|
9
9
|
import { registerTextModelContentProvider } from '@codingame/monaco-editor-wrapper';
|
|
10
10
|
import swal from 'sweetalert';
|
|
11
11
|
import once$1 from 'once';
|
|
@@ -294,13 +294,153 @@ var proxy = function proxyPolyfill() {
|
|
|
294
294
|
: self
|
|
295
295
|
);
|
|
296
296
|
|
|
297
|
+
function ownKeys(object, enumerableOnly) {
|
|
298
|
+
var keys = Object.keys(object);
|
|
299
|
+
|
|
300
|
+
if (Object.getOwnPropertySymbols) {
|
|
301
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
302
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
303
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
304
|
+
})), keys.push.apply(keys, symbols);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return keys;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function _objectSpread2(target) {
|
|
311
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
312
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
313
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
314
|
+
_defineProperty(target, key, source[key]);
|
|
315
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
316
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return target;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function _defineProperty(obj, key, value) {
|
|
324
|
+
if (key in obj) {
|
|
325
|
+
Object.defineProperty(obj, key, {
|
|
326
|
+
value: value,
|
|
327
|
+
enumerable: true,
|
|
328
|
+
configurable: true,
|
|
329
|
+
writable: true
|
|
330
|
+
});
|
|
331
|
+
} else {
|
|
332
|
+
obj[key] = value;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return obj;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
const willShutdownNotificationType = new ProtocolNotificationType('willShutdown');
|
|
339
|
+
const saveTextDocumentRequestType = new ProtocolRequestType('textDocument/save');
|
|
340
|
+
const getTextDocumentRequestType = new ProtocolRequestType('textDocument/get');
|
|
341
|
+
function updateFile(uri, text, languageClient) {
|
|
342
|
+
return languageClient.sendRequest(saveTextDocumentRequestType, {
|
|
343
|
+
textDocument: {
|
|
344
|
+
uri,
|
|
345
|
+
text
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function getFile(uri, languageClient) {
|
|
350
|
+
return languageClient.sendRequest(getTextDocumentRequestType, {
|
|
351
|
+
textDocument: {
|
|
352
|
+
uri
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function openWebsocketConnection(url) {
|
|
358
|
+
return new Promise((resolve, reject) => {
|
|
359
|
+
const webSocket = new WebSocket(url);
|
|
360
|
+
|
|
361
|
+
webSocket.onopen = () => {
|
|
362
|
+
const socket = toSocket(webSocket);
|
|
363
|
+
const webSocketConnection = createWebSocketConnection(socket, new ConsoleLogger());
|
|
364
|
+
webSocketConnection.onDispose(() => {
|
|
365
|
+
webSocket.close();
|
|
366
|
+
});
|
|
367
|
+
resolve(webSocketConnection);
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
webSocket.onerror = () => {
|
|
371
|
+
reject(new Error('Unable to connect to server'));
|
|
372
|
+
};
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
class CodinGameInfrastructure {
|
|
377
|
+
constructor(
|
|
378
|
+
/**
|
|
379
|
+
* The domain of the server
|
|
380
|
+
*/
|
|
381
|
+
serverAddress, useMutualizedProxy,
|
|
382
|
+
/**
|
|
383
|
+
* An optional sessionId when connecting to the session-mutualized server
|
|
384
|
+
*/
|
|
385
|
+
sessionId,
|
|
386
|
+
/**
|
|
387
|
+
* A list of urls which link to zip files containing libraries/resources
|
|
388
|
+
*/
|
|
389
|
+
libraryUrls) {
|
|
390
|
+
this.serverAddress = serverAddress;
|
|
391
|
+
this.useMutualizedProxy = useMutualizedProxy;
|
|
392
|
+
this.sessionId = sessionId;
|
|
393
|
+
this.libraryUrls = libraryUrls;
|
|
394
|
+
|
|
395
|
+
_defineProperty(this, "automaticTextDocumentUpdate", false);
|
|
396
|
+
|
|
397
|
+
_defineProperty(this, "rootUri", 'file:///tmp/project');
|
|
398
|
+
|
|
399
|
+
_defineProperty(this, "workspaceFolders", [{
|
|
400
|
+
uri: monaco.Uri.file('/tmp/project'),
|
|
401
|
+
index: 0,
|
|
402
|
+
name: 'main'
|
|
403
|
+
}]);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async saveFileContent(document, reason, languageClient) {
|
|
407
|
+
if (languageClient.isConnected()) {
|
|
408
|
+
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
async getFileContent(resource, languageClient) {
|
|
413
|
+
try {
|
|
414
|
+
return (await getFile(resource.toString(true), languageClient)).text;
|
|
415
|
+
} catch (error) {
|
|
416
|
+
console.error('File not found', resource.toString());
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* A function which returns a valid JWT token to use to connect to the server
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
async openConnection(id) {
|
|
426
|
+
var _this$libraryUrls;
|
|
427
|
+
|
|
428
|
+
const url = new URL(this.sessionId != null ? "run/".concat(this.sessionId, "/").concat(id) : "run/".concat(id), this.serverAddress);
|
|
429
|
+
(_this$libraryUrls = this.libraryUrls) === null || _this$libraryUrls === void 0 ? void 0 : _this$libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
430
|
+
url.searchParams.append('token', await this.getSecurityToken());
|
|
431
|
+
const connection = await openWebsocketConnection(url);
|
|
432
|
+
return connection;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
}
|
|
436
|
+
|
|
297
437
|
var lib = {};
|
|
298
438
|
|
|
299
439
|
var disposable$1 = {};
|
|
300
440
|
|
|
301
441
|
var services$1 = {};
|
|
302
442
|
|
|
303
|
-
var require$$0 = /*@__PURE__*/getAugmentedNamespace(vscodeLanguageserverProtocol);
|
|
443
|
+
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(vscodeLanguageserverProtocol);
|
|
304
444
|
|
|
305
445
|
/* --------------------------------------------------------------------------------------------
|
|
306
446
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -557,7 +697,7 @@ var main$1 = /*#__PURE__*/Object.freeze({
|
|
|
557
697
|
get TextDocument () { return TextDocument; }
|
|
558
698
|
});
|
|
559
699
|
|
|
560
|
-
var require$$1$
|
|
700
|
+
var require$$1$2 = /*@__PURE__*/getAugmentedNamespace(main$1);
|
|
561
701
|
|
|
562
702
|
var main = {};
|
|
563
703
|
|
|
@@ -1418,7 +1558,7 @@ var util$1 = /*#__PURE__*/Object.freeze({
|
|
|
1418
1558
|
'default': util
|
|
1419
1559
|
});
|
|
1420
1560
|
|
|
1421
|
-
var require$$1$
|
|
1561
|
+
var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(util$1);
|
|
1422
1562
|
|
|
1423
1563
|
var disposable = {};
|
|
1424
1564
|
|
|
@@ -1600,7 +1740,7 @@ messageBuffer.AbstractMessageBuffer = AbstractMessageBuffer;
|
|
|
1600
1740
|
* ------------------------------------------------------------------------------------------ */
|
|
1601
1741
|
Object.defineProperty(ril, "__esModule", { value: true });
|
|
1602
1742
|
const ral_1$1 = ral;
|
|
1603
|
-
const util_1 = require$$1$
|
|
1743
|
+
const util_1 = require$$1$1;
|
|
1604
1744
|
const disposable_1$2 = disposable;
|
|
1605
1745
|
const messageBuffer_1 = messageBuffer;
|
|
1606
1746
|
class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer {
|
|
@@ -4915,8 +5055,8 @@ var require$$3 = /*@__PURE__*/getAugmentedNamespace(api$1);
|
|
|
4915
5055
|
value: true
|
|
4916
5056
|
});
|
|
4917
5057
|
exports.ConfigurationTarget = exports.DocumentIdentifier = exports.ProgressLocation = exports.VsCodeDiagnosticSeverity = exports.SignatureHelpTriggerKind = exports.isDocumentSelector = exports.Services = exports.TextDocument = exports.Emitter = exports.Event = exports.CancellationToken = exports.Disposable = void 0;
|
|
4918
|
-
const vscode_languageserver_protocol_1 = require$$0;
|
|
4919
|
-
const vscode_languageserver_textdocument_1 = require$$1$
|
|
5058
|
+
const vscode_languageserver_protocol_1 = require$$0$1;
|
|
5059
|
+
const vscode_languageserver_textdocument_1 = require$$1$2;
|
|
4920
5060
|
Object.defineProperty(exports, "TextDocument", {
|
|
4921
5061
|
enumerable: true,
|
|
4922
5062
|
get: function () {
|
|
@@ -5073,7 +5213,7 @@ var require$$3 = /*@__PURE__*/getAugmentedNamespace(api$1);
|
|
|
5073
5213
|
|
|
5074
5214
|
var connection = {};
|
|
5075
5215
|
|
|
5076
|
-
var require$$1
|
|
5216
|
+
var require$$1 = /*@__PURE__*/getAugmentedNamespace(is$2);
|
|
5077
5217
|
|
|
5078
5218
|
/* --------------------------------------------------------------------------------------------
|
|
5079
5219
|
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
@@ -5116,8 +5256,8 @@ Object.defineProperty(connection, "__esModule", {
|
|
|
5116
5256
|
value: true
|
|
5117
5257
|
});
|
|
5118
5258
|
connection.createConnection = void 0;
|
|
5119
|
-
const vscode_languageserver_protocol_1$f = require$$0;
|
|
5120
|
-
const Is$4 = require$$1
|
|
5259
|
+
const vscode_languageserver_protocol_1$f = require$$0$1;
|
|
5260
|
+
const Is$4 = require$$1;
|
|
5121
5261
|
|
|
5122
5262
|
function createConnection(connection, errorHandler, closeHandler) {
|
|
5123
5263
|
connection.onError(data => {
|
|
@@ -5194,7 +5334,7 @@ var esm = /*#__PURE__*/Object.freeze({
|
|
|
5194
5334
|
Utils: Utils
|
|
5195
5335
|
});
|
|
5196
5336
|
|
|
5197
|
-
var require$$
|
|
5337
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(esm);
|
|
5198
5338
|
|
|
5199
5339
|
/* --------------------------------------------------------------------------------------------
|
|
5200
5340
|
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
@@ -5238,12 +5378,11 @@ Object.defineProperty(vscodeApi, "__esModule", {
|
|
|
5238
5378
|
value: true
|
|
5239
5379
|
});
|
|
5240
5380
|
vscodeApi.createVSCodeApi = void 0;
|
|
5241
|
-
const
|
|
5242
|
-
const vscode_uri_1 = require$$1;
|
|
5381
|
+
const vscode_uri_1 = require$$0;
|
|
5243
5382
|
const disposable_1$1 = disposable$1;
|
|
5244
5383
|
const services_1$3 = services$1;
|
|
5245
5384
|
const ServicesModule = services$1;
|
|
5246
|
-
const vscode_languageserver_protocol_1$e = require$$0;
|
|
5385
|
+
const vscode_languageserver_protocol_1$e = require$$0$1;
|
|
5247
5386
|
|
|
5248
5387
|
function createVSCodeApi(servicesProvider) {
|
|
5249
5388
|
const unsupported = () => {
|
|
@@ -5386,6 +5525,16 @@ function createVSCodeApi(servicesProvider) {
|
|
|
5386
5525
|
|
|
5387
5526
|
}
|
|
5388
5527
|
|
|
5528
|
+
let TextDocumentChangeReason;
|
|
5529
|
+
|
|
5530
|
+
(function (TextDocumentChangeReason) {
|
|
5531
|
+
/** The text change is caused by an undo operation. */
|
|
5532
|
+
TextDocumentChangeReason[TextDocumentChangeReason["Undo"] = 1] = "Undo";
|
|
5533
|
+
/** The text change is caused by an redo operation. */
|
|
5534
|
+
|
|
5535
|
+
TextDocumentChangeReason[TextDocumentChangeReason["Redo"] = 2] = "Redo";
|
|
5536
|
+
})(TextDocumentChangeReason || (TextDocumentChangeReason = {}));
|
|
5537
|
+
|
|
5389
5538
|
const workspace = {
|
|
5390
5539
|
fs: new EmptyFileSystem(),
|
|
5391
5540
|
workspaceFile: undefined,
|
|
@@ -5512,7 +5661,7 @@ function createVSCodeApi(servicesProvider) {
|
|
|
5512
5661
|
l({
|
|
5513
5662
|
document: textDocument,
|
|
5514
5663
|
contentChanges: contentChanges,
|
|
5515
|
-
reason: isUndoing ?
|
|
5664
|
+
reason: isUndoing ? TextDocumentChangeReason.Undo : isRedoing ? TextDocumentChangeReason.Redo : undefined
|
|
5516
5665
|
});
|
|
5517
5666
|
}, undefined, disposables);
|
|
5518
5667
|
};
|
|
@@ -6606,7 +6755,8 @@ function createVSCodeApi(servicesProvider) {
|
|
|
6606
6755
|
DiagnosticSeverity: ServicesModule.DiagnosticSeverity,
|
|
6607
6756
|
EventEmitter: ServicesModule.Emitter,
|
|
6608
6757
|
CancellationTokenSource: vscode_languageserver_protocol_1$e.CancellationTokenSource,
|
|
6609
|
-
ProgressLocation: ServicesModule.ProgressLocation
|
|
6758
|
+
ProgressLocation: ServicesModule.ProgressLocation,
|
|
6759
|
+
TextDocumentChangeReason
|
|
6610
6760
|
};
|
|
6611
6761
|
return partialApi;
|
|
6612
6762
|
}
|
|
@@ -6636,7 +6786,7 @@ Object.defineProperty(configuration, "__esModule", {
|
|
|
6636
6786
|
});
|
|
6637
6787
|
configuration.toJSONObject = configuration.ConfigurationFeature = void 0;
|
|
6638
6788
|
const vscode_1$8 = vscodeCompatibility;
|
|
6639
|
-
const vscode_languageserver_protocol_1$d = require$$0;
|
|
6789
|
+
const vscode_languageserver_protocol_1$d = require$$0$1;
|
|
6640
6790
|
|
|
6641
6791
|
class ConfigurationFeature {
|
|
6642
6792
|
constructor(_client) {
|
|
@@ -6973,7 +7123,7 @@ Object.defineProperty(codeConverter, "__esModule", {
|
|
|
6973
7123
|
});
|
|
6974
7124
|
codeConverter.createConverter = void 0;
|
|
6975
7125
|
const code$1 = vscodeCompatibility;
|
|
6976
|
-
const proto = require$$0;
|
|
7126
|
+
const proto = require$$0$1;
|
|
6977
7127
|
const Is$3 = is;
|
|
6978
7128
|
const protocolCompletionItem_1$1 = protocolCompletionItem;
|
|
6979
7129
|
const protocolCodeLens_1$1 = protocolCodeLens;
|
|
@@ -6981,7 +7131,7 @@ const protocolDocumentLink_1$1 = protocolDocumentLink;
|
|
|
6981
7131
|
const protocolCodeAction_1$1 = protocolCodeAction;
|
|
6982
7132
|
const protocolDiagnostic_1$1 = protocolDiagnostic;
|
|
6983
7133
|
const protocolCallHierarchyItem_1$1 = protocolCallHierarchyItem;
|
|
6984
|
-
const vscode_languageserver_protocol_1$c = require$$0;
|
|
7134
|
+
const vscode_languageserver_protocol_1$c = require$$0$1;
|
|
6985
7135
|
var InsertReplaceRange;
|
|
6986
7136
|
|
|
6987
7137
|
(function (InsertReplaceRange) {
|
|
@@ -7886,7 +8036,7 @@ Object.defineProperty(protocolConverter, "__esModule", {
|
|
|
7886
8036
|
});
|
|
7887
8037
|
protocolConverter.createConverter = void 0;
|
|
7888
8038
|
const code = vscodeCompatibility;
|
|
7889
|
-
const ls = require$$0;
|
|
8039
|
+
const ls = require$$0$1;
|
|
7890
8040
|
const Is$2 = is;
|
|
7891
8041
|
const protocolCompletionItem_1 = protocolCompletionItem;
|
|
7892
8042
|
const protocolCodeLens_1 = protocolCodeLens;
|
|
@@ -7894,7 +8044,7 @@ const protocolDocumentLink_1 = protocolDocumentLink;
|
|
|
7894
8044
|
const protocolCodeAction_1 = protocolCodeAction;
|
|
7895
8045
|
const protocolDiagnostic_1 = protocolDiagnostic;
|
|
7896
8046
|
const protocolCallHierarchyItem_1 = protocolCallHierarchyItem;
|
|
7897
|
-
const vscode_languageserver_protocol_1$b = require$$0;
|
|
8047
|
+
const vscode_languageserver_protocol_1$b = require$$0$1;
|
|
7898
8048
|
var CodeBlock;
|
|
7899
8049
|
|
|
7900
8050
|
(function (CodeBlock) {
|
|
@@ -9033,7 +9183,7 @@ Object.defineProperty(async, "__esModule", {
|
|
|
9033
9183
|
value: true
|
|
9034
9184
|
});
|
|
9035
9185
|
async.Delayer = void 0;
|
|
9036
|
-
const vscode_languageserver_protocol_1$a = require$$0;
|
|
9186
|
+
const vscode_languageserver_protocol_1$a = require$$0$1;
|
|
9037
9187
|
|
|
9038
9188
|
class Delayer {
|
|
9039
9189
|
constructor(defaultDelay) {
|
|
@@ -9204,7 +9354,7 @@ Object.defineProperty(progressPart, "__esModule", {
|
|
|
9204
9354
|
});
|
|
9205
9355
|
progressPart.ProgressPart = void 0;
|
|
9206
9356
|
const vscode_1$7 = vscodeCompatibility;
|
|
9207
|
-
const vscode_languageserver_protocol_1$9 = require$$0;
|
|
9357
|
+
const vscode_languageserver_protocol_1$9 = require$$0$1;
|
|
9208
9358
|
const Is$1 = is;
|
|
9209
9359
|
|
|
9210
9360
|
class ProgressPart {
|
|
@@ -9318,7 +9468,7 @@ progressPart.ProgressPart = ProgressPart;
|
|
|
9318
9468
|
});
|
|
9319
9469
|
exports.BaseLanguageClient = exports.MessageTransports = exports.TextDocumentFeature = exports.State = exports.RevealOutputChannelOn = exports.CloseAction = exports.ErrorAction = void 0;
|
|
9320
9470
|
const vscode_1 = vscodeCompatibility;
|
|
9321
|
-
const vscode_languageserver_protocol_1 = require$$0;
|
|
9471
|
+
const vscode_languageserver_protocol_1 = require$$0$1;
|
|
9322
9472
|
const configuration_1 = configuration;
|
|
9323
9473
|
const c2p = codeConverter;
|
|
9324
9474
|
const p2c = protocolConverter;
|
|
@@ -12570,7 +12720,7 @@ Object.defineProperty(typeDefinition, "__esModule", {
|
|
|
12570
12720
|
});
|
|
12571
12721
|
typeDefinition.TypeDefinitionFeature = void 0;
|
|
12572
12722
|
const vscode_1$6 = vscodeCompatibility;
|
|
12573
|
-
const vscode_languageserver_protocol_1$8 = require$$0;
|
|
12723
|
+
const vscode_languageserver_protocol_1$8 = require$$0$1;
|
|
12574
12724
|
const client_1$6 = client;
|
|
12575
12725
|
|
|
12576
12726
|
function ensure$7(target, key) {
|
|
@@ -12641,7 +12791,7 @@ Object.defineProperty(implementation, "__esModule", {
|
|
|
12641
12791
|
});
|
|
12642
12792
|
implementation.ImplementationFeature = void 0;
|
|
12643
12793
|
const vscode_1$5 = vscodeCompatibility;
|
|
12644
|
-
const vscode_languageserver_protocol_1$7 = require$$0;
|
|
12794
|
+
const vscode_languageserver_protocol_1$7 = require$$0$1;
|
|
12645
12795
|
const client_1$5 = client;
|
|
12646
12796
|
|
|
12647
12797
|
function ensure$6(target, key) {
|
|
@@ -12711,7 +12861,7 @@ Object.defineProperty(colorProvider, "__esModule", {
|
|
|
12711
12861
|
});
|
|
12712
12862
|
colorProvider.ColorProviderFeature = void 0;
|
|
12713
12863
|
const vscode_1$4 = vscodeCompatibility;
|
|
12714
|
-
const vscode_languageserver_protocol_1$6 = require$$0;
|
|
12864
|
+
const vscode_languageserver_protocol_1$6 = require$$0$1;
|
|
12715
12865
|
const client_1$4 = client;
|
|
12716
12866
|
|
|
12717
12867
|
function ensure$5(target, key) {
|
|
@@ -12827,7 +12977,7 @@ Object.defineProperty(workspaceFolders, "__esModule", {
|
|
|
12827
12977
|
workspaceFolders.WorkspaceFoldersFeature = workspaceFolders.arrayDiff = void 0;
|
|
12828
12978
|
const UUID = uuid;
|
|
12829
12979
|
const vscode_1$3 = vscodeCompatibility;
|
|
12830
|
-
const vscode_languageserver_protocol_1$5 = require$$0;
|
|
12980
|
+
const vscode_languageserver_protocol_1$5 = require$$0$1;
|
|
12831
12981
|
|
|
12832
12982
|
function access(target, key) {
|
|
12833
12983
|
if (target === void 0) {
|
|
@@ -13000,7 +13150,7 @@ Object.defineProperty(foldingRange, "__esModule", {
|
|
|
13000
13150
|
});
|
|
13001
13151
|
foldingRange.FoldingRangeFeature = void 0;
|
|
13002
13152
|
const vscode_1$2 = vscodeCompatibility;
|
|
13003
|
-
const vscode_languageserver_protocol_1$4 = require$$0;
|
|
13153
|
+
const vscode_languageserver_protocol_1$4 = require$$0$1;
|
|
13004
13154
|
const client_1$3 = client;
|
|
13005
13155
|
|
|
13006
13156
|
function ensure$4(target, key) {
|
|
@@ -13101,7 +13251,7 @@ Object.defineProperty(callHierarchy, "__esModule", {
|
|
|
13101
13251
|
});
|
|
13102
13252
|
callHierarchy.CallHierarchyFeature = void 0;
|
|
13103
13253
|
const vscode_1$1 = vscodeCompatibility;
|
|
13104
|
-
const vscode_languageserver_protocol_1$3 = require$$0;
|
|
13254
|
+
const vscode_languageserver_protocol_1$3 = require$$0$1;
|
|
13105
13255
|
const client_1$2 = client;
|
|
13106
13256
|
|
|
13107
13257
|
function ensure$3(target, key) {
|
|
@@ -13218,7 +13368,7 @@ Object.defineProperty(progress, "__esModule", {
|
|
|
13218
13368
|
value: true
|
|
13219
13369
|
});
|
|
13220
13370
|
progress.ProgressFeature = void 0;
|
|
13221
|
-
const vscode_languageserver_protocol_1$2 = require$$0;
|
|
13371
|
+
const vscode_languageserver_protocol_1$2 = require$$0$1;
|
|
13222
13372
|
const progressPart_1 = progressPart;
|
|
13223
13373
|
|
|
13224
13374
|
function ensure$2(target, key) {
|
|
@@ -13279,7 +13429,7 @@ Object.defineProperty(semanticTokens, "__esModule", {
|
|
|
13279
13429
|
semanticTokens.SemanticTokensFeature = void 0;
|
|
13280
13430
|
const vscode = vscodeCompatibility;
|
|
13281
13431
|
const client_1$1 = client;
|
|
13282
|
-
const vscode_languageserver_protocol_1$1 = require$$0;
|
|
13432
|
+
const vscode_languageserver_protocol_1$1 = require$$0$1;
|
|
13283
13433
|
const Is = is;
|
|
13284
13434
|
|
|
13285
13435
|
function ensure$1(target, key) {
|
|
@@ -13434,7 +13584,7 @@ Object.defineProperty(declaration, "__esModule", {
|
|
|
13434
13584
|
});
|
|
13435
13585
|
declaration.DeclarationFeature = void 0;
|
|
13436
13586
|
const vscode_1 = vscodeCompatibility;
|
|
13437
|
-
const vscode_languageserver_protocol_1 = require$$0;
|
|
13587
|
+
const vscode_languageserver_protocol_1 = require$$0$1;
|
|
13438
13588
|
const client_1 = client;
|
|
13439
13589
|
|
|
13440
13590
|
function ensure(target, key) {
|
|
@@ -14497,7 +14647,7 @@ Object.defineProperty(monacoWorkspace, "__esModule", {
|
|
|
14497
14647
|
});
|
|
14498
14648
|
monacoWorkspace.MonacoWorkspace = void 0;
|
|
14499
14649
|
const services_1 = services$1;
|
|
14500
|
-
const vscode_languageserver_textdocument_1 = require$$1$
|
|
14650
|
+
const vscode_languageserver_textdocument_1 = require$$1$2;
|
|
14501
14651
|
|
|
14502
14652
|
class MonacoWorkspace {
|
|
14503
14653
|
constructor(_monaco, p2m, m2p) {
|
|
@@ -14652,8 +14802,8 @@ var monacoConverter = {};
|
|
|
14652
14802
|
value: true
|
|
14653
14803
|
});
|
|
14654
14804
|
exports.ProtocolToMonacoConverter = exports.MonacoToProtocolConverter = exports.ProtocolCodeAction = exports.ProtocolIMarkerData = exports.ProtocolCompletionItem = exports.ProtocolCodeLens = exports.ProtocolDocumentLink = void 0;
|
|
14655
|
-
const ls = require$$0;
|
|
14656
|
-
const Is = require$$1
|
|
14805
|
+
const ls = require$$0$1;
|
|
14806
|
+
const Is = require$$1;
|
|
14657
14807
|
const services_1 = services$1;
|
|
14658
14808
|
var ProtocolDocumentLink;
|
|
14659
14809
|
|
|
@@ -16646,146 +16796,6 @@ monaco.editor.onWillDisposeModel(model => {
|
|
|
16646
16796
|
});
|
|
16647
16797
|
});
|
|
16648
16798
|
|
|
16649
|
-
function ownKeys(object, enumerableOnly) {
|
|
16650
|
-
var keys = Object.keys(object);
|
|
16651
|
-
|
|
16652
|
-
if (Object.getOwnPropertySymbols) {
|
|
16653
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
16654
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
16655
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
16656
|
-
})), keys.push.apply(keys, symbols);
|
|
16657
|
-
}
|
|
16658
|
-
|
|
16659
|
-
return keys;
|
|
16660
|
-
}
|
|
16661
|
-
|
|
16662
|
-
function _objectSpread2(target) {
|
|
16663
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
16664
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
16665
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
16666
|
-
_defineProperty(target, key, source[key]);
|
|
16667
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
16668
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
16669
|
-
});
|
|
16670
|
-
}
|
|
16671
|
-
|
|
16672
|
-
return target;
|
|
16673
|
-
}
|
|
16674
|
-
|
|
16675
|
-
function _defineProperty(obj, key, value) {
|
|
16676
|
-
if (key in obj) {
|
|
16677
|
-
Object.defineProperty(obj, key, {
|
|
16678
|
-
value: value,
|
|
16679
|
-
enumerable: true,
|
|
16680
|
-
configurable: true,
|
|
16681
|
-
writable: true
|
|
16682
|
-
});
|
|
16683
|
-
} else {
|
|
16684
|
-
obj[key] = value;
|
|
16685
|
-
}
|
|
16686
|
-
|
|
16687
|
-
return obj;
|
|
16688
|
-
}
|
|
16689
|
-
|
|
16690
|
-
const willShutdownNotificationType = new ProtocolNotificationType('willShutdown');
|
|
16691
|
-
const saveTextDocumentRequestType = new ProtocolRequestType('textDocument/save');
|
|
16692
|
-
const getTextDocumentRequestType = new ProtocolRequestType('textDocument/get');
|
|
16693
|
-
function updateFile(uri, text, languageClient) {
|
|
16694
|
-
return languageClient.sendRequest(saveTextDocumentRequestType, {
|
|
16695
|
-
textDocument: {
|
|
16696
|
-
uri,
|
|
16697
|
-
text
|
|
16698
|
-
}
|
|
16699
|
-
});
|
|
16700
|
-
}
|
|
16701
|
-
function getFile(uri, languageClient) {
|
|
16702
|
-
return languageClient.sendRequest(getTextDocumentRequestType, {
|
|
16703
|
-
textDocument: {
|
|
16704
|
-
uri
|
|
16705
|
-
}
|
|
16706
|
-
});
|
|
16707
|
-
}
|
|
16708
|
-
|
|
16709
|
-
function openWebsocketConnection(url) {
|
|
16710
|
-
return new Promise((resolve, reject) => {
|
|
16711
|
-
const webSocket = new WebSocket(url);
|
|
16712
|
-
|
|
16713
|
-
webSocket.onopen = () => {
|
|
16714
|
-
const socket = toSocket(webSocket);
|
|
16715
|
-
const webSocketConnection = createWebSocketConnection(socket, new ConsoleLogger());
|
|
16716
|
-
webSocketConnection.onDispose(() => {
|
|
16717
|
-
webSocket.close();
|
|
16718
|
-
});
|
|
16719
|
-
resolve(webSocketConnection);
|
|
16720
|
-
};
|
|
16721
|
-
|
|
16722
|
-
webSocket.onerror = () => {
|
|
16723
|
-
reject(new Error('Unable to connect to server'));
|
|
16724
|
-
};
|
|
16725
|
-
});
|
|
16726
|
-
}
|
|
16727
|
-
|
|
16728
|
-
class CodinGameInfrastructure {
|
|
16729
|
-
constructor(
|
|
16730
|
-
/**
|
|
16731
|
-
* The domain of the server
|
|
16732
|
-
*/
|
|
16733
|
-
serverAddress, useMutualizedProxy,
|
|
16734
|
-
/**
|
|
16735
|
-
* An optional sessionId when connecting to the session-mutualized server
|
|
16736
|
-
*/
|
|
16737
|
-
sessionId,
|
|
16738
|
-
/**
|
|
16739
|
-
* A list of urls which link to zip files containing libraries/resources
|
|
16740
|
-
*/
|
|
16741
|
-
libraryUrls) {
|
|
16742
|
-
this.serverAddress = serverAddress;
|
|
16743
|
-
this.useMutualizedProxy = useMutualizedProxy;
|
|
16744
|
-
this.sessionId = sessionId;
|
|
16745
|
-
this.libraryUrls = libraryUrls;
|
|
16746
|
-
|
|
16747
|
-
_defineProperty(this, "automaticTextDocumentUpdate", false);
|
|
16748
|
-
|
|
16749
|
-
_defineProperty(this, "rootUri", 'file:///tmp/project');
|
|
16750
|
-
|
|
16751
|
-
_defineProperty(this, "workspaceFolders", [{
|
|
16752
|
-
uri: monaco.Uri.file('/tmp/project'),
|
|
16753
|
-
index: 0,
|
|
16754
|
-
name: 'main'
|
|
16755
|
-
}]);
|
|
16756
|
-
}
|
|
16757
|
-
|
|
16758
|
-
async saveFileContent(document, reason, languageClient) {
|
|
16759
|
-
if (languageClient.isReady()) {
|
|
16760
|
-
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
16761
|
-
}
|
|
16762
|
-
}
|
|
16763
|
-
|
|
16764
|
-
async getFileContent(resource, languageClient) {
|
|
16765
|
-
try {
|
|
16766
|
-
return (await getFile(resource.toString(true), languageClient)).text;
|
|
16767
|
-
} catch (error) {
|
|
16768
|
-
console.error('File not found', resource.toString());
|
|
16769
|
-
return null;
|
|
16770
|
-
}
|
|
16771
|
-
}
|
|
16772
|
-
/**
|
|
16773
|
-
* A function which returns a valid JWT token to use to connect to the server
|
|
16774
|
-
*/
|
|
16775
|
-
|
|
16776
|
-
|
|
16777
|
-
async openConnection(id) {
|
|
16778
|
-
var _this$libraryUrls;
|
|
16779
|
-
|
|
16780
|
-
const url = new URL(this.sessionId != null ? "run/".concat(this.sessionId, "/").concat(id) : "run/".concat(id), this.serverAddress);
|
|
16781
|
-
(_this$libraryUrls = this.libraryUrls) === null || _this$libraryUrls === void 0 ? void 0 : _this$libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
16782
|
-
url.searchParams.append('token', await this.getSecurityToken());
|
|
16783
|
-
const connection = await openWebsocketConnection(url);
|
|
16784
|
-
return connection;
|
|
16785
|
-
}
|
|
16786
|
-
|
|
16787
|
-
}
|
|
16788
|
-
|
|
16789
16799
|
var delay$2 = {exports: {}};
|
|
16790
16800
|
|
|
16791
16801
|
// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15
|
|
@@ -17120,7 +17130,7 @@ function installCommands(services) {
|
|
|
17120
17130
|
// Comes from https://github.com/redhat-developer/vscode-java/blob/9b0f0aca80cbefabad4c034fb5dd365d029f6170/src/extension.ts#L155-L160
|
|
17121
17131
|
// Other commands needs to be implemented as well?
|
|
17122
17132
|
// (https://github.com/eclipse/eclipse.jdt.ls/issues/376#issuecomment-333923685)
|
|
17123
|
-
services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
17133
|
+
return services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
17124
17134
|
if (edit.documentChanges != null && edit.documentChanges.some(change => RenameFile.is(change) || CreateFile.is(change))) {
|
|
17125
17135
|
alert('Unimplemented command');
|
|
17126
17136
|
return;
|
|
@@ -17131,8 +17141,9 @@ function installCommands(services) {
|
|
|
17131
17141
|
}
|
|
17132
17142
|
|
|
17133
17143
|
function autoSaveModels(services) {
|
|
17144
|
+
const disposableCollection = new lib.DisposableCollection();
|
|
17134
17145
|
const timeoutMap = new Map();
|
|
17135
|
-
services.workspace.onDidChangeTextDocument(e => {
|
|
17146
|
+
disposableCollection.push(services.workspace.onDidChangeTextDocument(e => {
|
|
17136
17147
|
const timeout = timeoutMap.get(e.textDocument.uri);
|
|
17137
17148
|
|
|
17138
17149
|
if (timeout != null) {
|
|
@@ -17146,31 +17157,60 @@ function autoSaveModels(services) {
|
|
|
17146
17157
|
console.error('[LSP]', "Unable to save the document ".concat(e.textDocument.uri.toString()), err);
|
|
17147
17158
|
});
|
|
17148
17159
|
}, 500));
|
|
17149
|
-
});
|
|
17160
|
+
}));
|
|
17161
|
+
disposableCollection.push(Disposable.create(() => {
|
|
17162
|
+
for (const timeout of Array.from(timeoutMap.values())) {
|
|
17163
|
+
window.clearTimeout(timeout);
|
|
17164
|
+
}
|
|
17165
|
+
}));
|
|
17166
|
+
return disposableCollection;
|
|
17150
17167
|
}
|
|
17151
17168
|
|
|
17152
17169
|
let services = null;
|
|
17170
|
+
let serviceDisposable = null;
|
|
17171
|
+
let serviceReferenceCount = 0;
|
|
17153
17172
|
|
|
17154
17173
|
function installServices(infrastructure) {
|
|
17155
|
-
const m2p = new lib.MonacoToProtocolConverter(monaco);
|
|
17156
|
-
const p2m = new lib.ProtocolToMonacoConverter(monaco);
|
|
17157
|
-
|
|
17158
17174
|
if (services == null) {
|
|
17175
|
+
// FIXME: we can't recreate services because MonacoWorkspace can't be disposed without memory leaks
|
|
17176
|
+
// fix me as soon as https://github.com/TypeFox/monaco-languageclient/pull/330/files is released
|
|
17177
|
+
const m2p = new lib.MonacoToProtocolConverter(monaco);
|
|
17178
|
+
const p2m = new lib.ProtocolToMonacoConverter(monaco);
|
|
17159
17179
|
services = {
|
|
17160
17180
|
commands: new lib.MonacoCommands(monaco),
|
|
17161
17181
|
languages: new lib.MonacoLanguages(monaco, p2m, m2p),
|
|
17162
17182
|
workspace: new CodinGameMonacoWorkspace(p2m, m2p, infrastructure.rootUri, infrastructure.workspaceFolders),
|
|
17163
17183
|
window: new WatchableConsoleWindow()
|
|
17164
17184
|
};
|
|
17165
|
-
|
|
17166
|
-
|
|
17185
|
+
}
|
|
17186
|
+
|
|
17187
|
+
if (serviceReferenceCount === 0) {
|
|
17188
|
+
const disposableCollection = new lib.DisposableCollection();
|
|
17189
|
+
disposableCollection.push(installCommands(services));
|
|
17190
|
+
disposableCollection.push(lib.Services.install(services));
|
|
17167
17191
|
|
|
17168
17192
|
if (!infrastructure.automaticTextDocumentUpdate) {
|
|
17169
|
-
autoSaveModels(services);
|
|
17193
|
+
disposableCollection.push(autoSaveModels(services));
|
|
17170
17194
|
}
|
|
17195
|
+
|
|
17196
|
+
serviceDisposable = disposableCollection;
|
|
17171
17197
|
}
|
|
17172
17198
|
|
|
17173
|
-
|
|
17199
|
+
serviceReferenceCount++;
|
|
17200
|
+
return Disposable.create(() => {
|
|
17201
|
+
serviceReferenceCount--;
|
|
17202
|
+
|
|
17203
|
+
if (serviceReferenceCount <= 0) {
|
|
17204
|
+
var _serviceDisposable;
|
|
17205
|
+
|
|
17206
|
+
(_serviceDisposable = serviceDisposable) === null || _serviceDisposable === void 0 ? void 0 : _serviceDisposable.dispose();
|
|
17207
|
+
serviceDisposable = null;
|
|
17208
|
+
}
|
|
17209
|
+
});
|
|
17210
|
+
}
|
|
17211
|
+
|
|
17212
|
+
function getServices() {
|
|
17213
|
+
return lib.Services.get();
|
|
17174
17214
|
}
|
|
17175
17215
|
|
|
17176
17216
|
// Initialize the file content into the lsp server for implementations that don't support open/close notifications
|
|
@@ -17464,8 +17504,8 @@ class LanguageClientManager {
|
|
|
17464
17504
|
});
|
|
17465
17505
|
}
|
|
17466
17506
|
|
|
17467
|
-
|
|
17468
|
-
return
|
|
17507
|
+
isConnected() {
|
|
17508
|
+
return ['connected', 'ready'].includes(this.currentStatus);
|
|
17469
17509
|
}
|
|
17470
17510
|
|
|
17471
17511
|
async dispose() {
|
|
@@ -17684,8 +17724,8 @@ function createLanguageClientManager(id, infrastructure) {
|
|
|
17684
17724
|
});
|
|
17685
17725
|
}
|
|
17686
17726
|
|
|
17687
|
-
const services = installServices(infrastructure);
|
|
17688
17727
|
const disposableCollection = new lib.DisposableCollection();
|
|
17728
|
+
disposableCollection.push(installServices(infrastructure));
|
|
17689
17729
|
const languageClientManager = new LanguageClientManager(id, languageServerOptions, infrastructure);
|
|
17690
17730
|
languageClientManagerByLanguageId[id] = languageClientManager;
|
|
17691
17731
|
disposableCollection.push(lib.Disposable.create(() => {
|
|
@@ -17698,7 +17738,7 @@ function createLanguageClientManager(id, infrastructure) {
|
|
|
17698
17738
|
}
|
|
17699
17739
|
|
|
17700
17740
|
}));
|
|
17701
|
-
disposableCollection.push(
|
|
17741
|
+
disposableCollection.push(getServices().workspace.registerSaveDocumentHandler({
|
|
17702
17742
|
async saveTextContent(textDocument, reason) {
|
|
17703
17743
|
var _infrastructure$saveF;
|
|
17704
17744
|
|