@codingame/monaco-languageclient-wrapper 1.7.2 → 2.0.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/createLanguageClient.d.ts +4 -0
- package/dist/customRequests.d.ts +5 -0
- package/dist/extensionConfiguration.d.ts +7 -0
- package/dist/extensions.d.ts +14 -0
- package/dist/hacks.d.ts +1 -0
- package/dist/index.d.ts +6836 -203
- package/dist/index.js +958 -660
- package/dist/languageClient.d.ts +58 -0
- package/dist/languageClientOptions.d.ts +9 -0
- package/dist/main.js +21393 -0
- package/dist/monaco-languageclient-wrapper.d.ts +1478 -0
- package/dist/services/CodinGameMonacoWorkspace.d.ts +13 -0
- package/dist/services/Configuration.d.ts +14 -0
- package/dist/services/WatchableConsoleWindow.d.ts +24 -0
- package/dist/services.d.ts +4 -0
- package/dist/staticOptions.d.ts +5 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +7 -7
- package/stats.html +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as monaco from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
|
3
3
|
import { Uri } from 'monaco-editor/esm/vs/editor/edcore.main';
|
|
4
4
|
import { registerTextModelContentProvider } from '@codingame/monaco-editor-wrapper';
|
|
5
5
|
import swal from 'sweetalert';
|
|
6
|
-
import once from 'once';
|
|
6
|
+
import once$1 from 'once';
|
|
7
7
|
|
|
8
8
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
9
9
|
|
|
@@ -338,16 +338,227 @@ function RAL() {
|
|
|
338
338
|
ral.default = RAL;
|
|
339
339
|
|
|
340
340
|
// shim for using process in browser
|
|
341
|
+
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
342
|
+
|
|
343
|
+
function defaultSetTimout() {
|
|
344
|
+
throw new Error('setTimeout has not been defined');
|
|
345
|
+
}
|
|
346
|
+
function defaultClearTimeout () {
|
|
347
|
+
throw new Error('clearTimeout has not been defined');
|
|
348
|
+
}
|
|
349
|
+
var cachedSetTimeout = defaultSetTimout;
|
|
350
|
+
var cachedClearTimeout = defaultClearTimeout;
|
|
351
|
+
if (typeof global.setTimeout === 'function') {
|
|
352
|
+
cachedSetTimeout = setTimeout;
|
|
353
|
+
}
|
|
354
|
+
if (typeof global.clearTimeout === 'function') {
|
|
355
|
+
cachedClearTimeout = clearTimeout;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function runTimeout(fun) {
|
|
359
|
+
if (cachedSetTimeout === setTimeout) {
|
|
360
|
+
//normal enviroments in sane situations
|
|
361
|
+
return setTimeout(fun, 0);
|
|
362
|
+
}
|
|
363
|
+
// if setTimeout wasn't available but was latter defined
|
|
364
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
365
|
+
cachedSetTimeout = setTimeout;
|
|
366
|
+
return setTimeout(fun, 0);
|
|
367
|
+
}
|
|
368
|
+
try {
|
|
369
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
370
|
+
return cachedSetTimeout(fun, 0);
|
|
371
|
+
} catch(e){
|
|
372
|
+
try {
|
|
373
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
374
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
375
|
+
} catch(e){
|
|
376
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
377
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
}
|
|
383
|
+
function runClearTimeout(marker) {
|
|
384
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
385
|
+
//normal enviroments in sane situations
|
|
386
|
+
return clearTimeout(marker);
|
|
387
|
+
}
|
|
388
|
+
// if clearTimeout wasn't available but was latter defined
|
|
389
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
390
|
+
cachedClearTimeout = clearTimeout;
|
|
391
|
+
return clearTimeout(marker);
|
|
392
|
+
}
|
|
393
|
+
try {
|
|
394
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
395
|
+
return cachedClearTimeout(marker);
|
|
396
|
+
} catch (e){
|
|
397
|
+
try {
|
|
398
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
399
|
+
return cachedClearTimeout.call(null, marker);
|
|
400
|
+
} catch (e){
|
|
401
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
402
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
403
|
+
return cachedClearTimeout.call(this, marker);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
}
|
|
410
|
+
var queue = [];
|
|
411
|
+
var draining = false;
|
|
412
|
+
var currentQueue;
|
|
413
|
+
var queueIndex = -1;
|
|
414
|
+
|
|
415
|
+
function cleanUpNextTick() {
|
|
416
|
+
if (!draining || !currentQueue) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
draining = false;
|
|
420
|
+
if (currentQueue.length) {
|
|
421
|
+
queue = currentQueue.concat(queue);
|
|
422
|
+
} else {
|
|
423
|
+
queueIndex = -1;
|
|
424
|
+
}
|
|
425
|
+
if (queue.length) {
|
|
426
|
+
drainQueue();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function drainQueue() {
|
|
431
|
+
if (draining) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
435
|
+
draining = true;
|
|
436
|
+
|
|
437
|
+
var len = queue.length;
|
|
438
|
+
while(len) {
|
|
439
|
+
currentQueue = queue;
|
|
440
|
+
queue = [];
|
|
441
|
+
while (++queueIndex < len) {
|
|
442
|
+
if (currentQueue) {
|
|
443
|
+
currentQueue[queueIndex].run();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
queueIndex = -1;
|
|
447
|
+
len = queue.length;
|
|
448
|
+
}
|
|
449
|
+
currentQueue = null;
|
|
450
|
+
draining = false;
|
|
451
|
+
runClearTimeout(timeout);
|
|
452
|
+
}
|
|
453
|
+
function nextTick(fun) {
|
|
454
|
+
var args = new Array(arguments.length - 1);
|
|
455
|
+
if (arguments.length > 1) {
|
|
456
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
457
|
+
args[i - 1] = arguments[i];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
queue.push(new Item(fun, args));
|
|
461
|
+
if (queue.length === 1 && !draining) {
|
|
462
|
+
runTimeout(drainQueue);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
// v8 likes predictible objects
|
|
466
|
+
function Item(fun, array) {
|
|
467
|
+
this.fun = fun;
|
|
468
|
+
this.array = array;
|
|
469
|
+
}
|
|
470
|
+
Item.prototype.run = function () {
|
|
471
|
+
this.fun.apply(null, this.array);
|
|
472
|
+
};
|
|
473
|
+
var title = 'browser';
|
|
474
|
+
var platform$1 = 'browser';
|
|
475
|
+
var browser = true;
|
|
476
|
+
var env = {};
|
|
477
|
+
var argv = [];
|
|
478
|
+
var version = ''; // empty string to avoid regexp issues
|
|
479
|
+
var versions = {};
|
|
480
|
+
var release$1 = {};
|
|
481
|
+
var config = {};
|
|
482
|
+
|
|
483
|
+
function noop() {}
|
|
484
|
+
|
|
485
|
+
var on = noop;
|
|
486
|
+
var addListener = noop;
|
|
487
|
+
var once = noop;
|
|
488
|
+
var off = noop;
|
|
489
|
+
var removeListener = noop;
|
|
490
|
+
var removeAllListeners = noop;
|
|
491
|
+
var emit = noop;
|
|
492
|
+
|
|
493
|
+
function binding(name) {
|
|
494
|
+
throw new Error('process.binding is not supported');
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function cwd () { return '/' }
|
|
498
|
+
function chdir (dir) {
|
|
499
|
+
throw new Error('process.chdir is not supported');
|
|
500
|
+
}function umask() { return 0; }
|
|
341
501
|
|
|
342
502
|
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
343
503
|
var performance = global.performance || {};
|
|
344
|
-
|
|
504
|
+
var performanceNow =
|
|
505
|
+
performance.now ||
|
|
345
506
|
performance.mozNow ||
|
|
346
507
|
performance.msNow ||
|
|
347
508
|
performance.oNow ||
|
|
348
509
|
performance.webkitNow ||
|
|
349
510
|
function(){ return (new Date()).getTime() };
|
|
350
511
|
|
|
512
|
+
// generate timestamp or delta
|
|
513
|
+
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
514
|
+
function hrtime(previousTimestamp){
|
|
515
|
+
var clocktime = performanceNow.call(performance)*1e-3;
|
|
516
|
+
var seconds = Math.floor(clocktime);
|
|
517
|
+
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
|
518
|
+
if (previousTimestamp) {
|
|
519
|
+
seconds = seconds - previousTimestamp[0];
|
|
520
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
521
|
+
if (nanoseconds<0) {
|
|
522
|
+
seconds--;
|
|
523
|
+
nanoseconds += 1e9;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return [seconds,nanoseconds]
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var startTime = new Date();
|
|
530
|
+
function uptime$1() {
|
|
531
|
+
var currentTime = new Date();
|
|
532
|
+
var dif = currentTime - startTime;
|
|
533
|
+
return dif / 1000;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
var process$1 = {
|
|
537
|
+
nextTick: nextTick,
|
|
538
|
+
title: title,
|
|
539
|
+
browser: browser,
|
|
540
|
+
env: env,
|
|
541
|
+
argv: argv,
|
|
542
|
+
version: version,
|
|
543
|
+
versions: versions,
|
|
544
|
+
on: on,
|
|
545
|
+
addListener: addListener,
|
|
546
|
+
once: once,
|
|
547
|
+
off: off,
|
|
548
|
+
removeListener: removeListener,
|
|
549
|
+
removeAllListeners: removeAllListeners,
|
|
550
|
+
emit: emit,
|
|
551
|
+
binding: binding,
|
|
552
|
+
cwd: cwd,
|
|
553
|
+
chdir: chdir,
|
|
554
|
+
umask: umask,
|
|
555
|
+
hrtime: hrtime,
|
|
556
|
+
platform: platform$1,
|
|
557
|
+
release: release$1,
|
|
558
|
+
config: config,
|
|
559
|
+
uptime: uptime$1
|
|
560
|
+
};
|
|
561
|
+
|
|
351
562
|
var inherits;
|
|
352
563
|
if (typeof Object.create === 'function'){
|
|
353
564
|
inherits = function inherits(ctor, superCtor) {
|
|
@@ -424,10 +635,18 @@ function deprecate(fn, msg) {
|
|
|
424
635
|
};
|
|
425
636
|
}
|
|
426
637
|
|
|
638
|
+
if (process$1.noDeprecation === true) {
|
|
639
|
+
return fn;
|
|
640
|
+
}
|
|
641
|
+
|
|
427
642
|
var warned = false;
|
|
428
643
|
function deprecated() {
|
|
429
644
|
if (!warned) {
|
|
430
|
-
{
|
|
645
|
+
if (process$1.throwDeprecation) {
|
|
646
|
+
throw new Error(msg);
|
|
647
|
+
} else if (process$1.traceDeprecation) {
|
|
648
|
+
console.trace(msg);
|
|
649
|
+
} else {
|
|
431
650
|
console.error(msg);
|
|
432
651
|
}
|
|
433
652
|
warned = true;
|
|
@@ -442,7 +661,7 @@ var debugs = {};
|
|
|
442
661
|
var debugEnviron;
|
|
443
662
|
function debuglog(set) {
|
|
444
663
|
if (isUndefined(debugEnviron))
|
|
445
|
-
debugEnviron = '';
|
|
664
|
+
debugEnviron = process$1.env.NODE_DEBUG || '';
|
|
446
665
|
set = set.toUpperCase();
|
|
447
666
|
if (!debugs[set]) {
|
|
448
667
|
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
|
@@ -19924,15 +20143,15 @@ const staticOptions = asLanguageClientOptionsById({
|
|
|
19924
20143
|
synchronize: {
|
|
19925
20144
|
configurationSection: 'serenata'
|
|
19926
20145
|
},
|
|
19927
|
-
initializationOptions: {
|
|
20146
|
+
initializationOptions: () => ({
|
|
19928
20147
|
configuration: {
|
|
19929
|
-
uris: [
|
|
20148
|
+
uris: [lib$1.Services.get().workspace.rootUri],
|
|
19930
20149
|
phpVersion: 7.3,
|
|
19931
20150
|
fileExtensions: ['php'],
|
|
19932
20151
|
indexDatabaseUri: 'file:///tmp/index.sqlite',
|
|
19933
20152
|
excludedPathExpressions: ['file:///opt/serenata']
|
|
19934
20153
|
}
|
|
19935
|
-
},
|
|
20154
|
+
}),
|
|
19936
20155
|
mutualizable: true
|
|
19937
20156
|
},
|
|
19938
20157
|
php: {
|
|
@@ -20047,6 +20266,13 @@ const staticOptions = asLanguageClientOptionsById({
|
|
|
20047
20266
|
mutualizable: true,
|
|
20048
20267
|
vscodeExtensionIds: ['typescript-language-features']
|
|
20049
20268
|
},
|
|
20269
|
+
verilog: {
|
|
20270
|
+
documentSelector: [{
|
|
20271
|
+
language: 'verilog'
|
|
20272
|
+
}],
|
|
20273
|
+
mutualizable: false,
|
|
20274
|
+
vscodeExtensionIds: ['svlangserver']
|
|
20275
|
+
},
|
|
20050
20276
|
vue: {
|
|
20051
20277
|
documentSelector: [{
|
|
20052
20278
|
pattern: '**/*.js',
|
|
@@ -20145,79 +20371,470 @@ function _defineProperty(obj, key, value) {
|
|
|
20145
20371
|
return obj;
|
|
20146
20372
|
}
|
|
20147
20373
|
|
|
20148
|
-
var
|
|
20149
|
-
|
|
20150
|
-
// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15
|
|
20151
|
-
const randomInteger = (minimum, maximum) => Math.floor((Math.random() * (maximum - minimum + 1)) + minimum);
|
|
20152
|
-
|
|
20153
|
-
const createAbortError = () => {
|
|
20154
|
-
const error = new Error('Delay aborted');
|
|
20155
|
-
error.name = 'AbortError';
|
|
20156
|
-
return error;
|
|
20157
|
-
};
|
|
20374
|
+
var lib = {};
|
|
20158
20375
|
|
|
20159
|
-
|
|
20160
|
-
if (signal && signal.aborted) {
|
|
20161
|
-
return Promise.reject(createAbortError());
|
|
20162
|
-
}
|
|
20376
|
+
var disposable = {};
|
|
20163
20377
|
|
|
20164
|
-
|
|
20165
|
-
|
|
20166
|
-
|
|
20167
|
-
|
|
20378
|
+
(function (exports) {
|
|
20379
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20380
|
+
exports.DisposableCollection = exports.Disposable = void 0;
|
|
20381
|
+
/* --------------------------------------------------------------------------------------------
|
|
20382
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20383
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20384
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20385
|
+
const disposable_1 = disposable$1;
|
|
20386
|
+
Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable_1.Disposable; } });
|
|
20387
|
+
class DisposableCollection {
|
|
20388
|
+
constructor() {
|
|
20389
|
+
this.disposables = [];
|
|
20390
|
+
}
|
|
20391
|
+
dispose() {
|
|
20392
|
+
while (this.disposables.length !== 0) {
|
|
20393
|
+
this.disposables.pop().dispose();
|
|
20394
|
+
}
|
|
20395
|
+
}
|
|
20396
|
+
push(disposable) {
|
|
20397
|
+
const disposables = this.disposables;
|
|
20398
|
+
disposables.push(disposable);
|
|
20399
|
+
return {
|
|
20400
|
+
dispose() {
|
|
20401
|
+
const index = disposables.indexOf(disposable);
|
|
20402
|
+
if (index !== -1) {
|
|
20403
|
+
disposables.splice(index, 1);
|
|
20404
|
+
}
|
|
20405
|
+
}
|
|
20406
|
+
};
|
|
20407
|
+
}
|
|
20408
|
+
}
|
|
20409
|
+
exports.DisposableCollection = DisposableCollection;
|
|
20168
20410
|
|
|
20169
|
-
|
|
20170
|
-
clear(timeoutId);
|
|
20171
|
-
rejectFn(createAbortError());
|
|
20172
|
-
};
|
|
20411
|
+
}(disposable));
|
|
20173
20412
|
|
|
20174
|
-
|
|
20175
|
-
if (signal) {
|
|
20176
|
-
signal.removeEventListener('abort', signalListener);
|
|
20177
|
-
}
|
|
20178
|
-
};
|
|
20413
|
+
var socket$1 = {};
|
|
20179
20414
|
|
|
20180
|
-
|
|
20181
|
-
settle = () => {
|
|
20182
|
-
cleanup();
|
|
20183
|
-
if (willResolve) {
|
|
20184
|
-
resolve(value);
|
|
20185
|
-
} else {
|
|
20186
|
-
reject(value);
|
|
20187
|
-
}
|
|
20188
|
-
};
|
|
20415
|
+
var socket = {};
|
|
20189
20416
|
|
|
20190
|
-
|
|
20191
|
-
timeoutId = (set || setTimeout)(settle, ms);
|
|
20192
|
-
});
|
|
20417
|
+
Object.defineProperty(socket, "__esModule", { value: true });
|
|
20193
20418
|
|
|
20194
|
-
|
|
20195
|
-
signal.addEventListener('abort', signalListener, {once: true});
|
|
20196
|
-
}
|
|
20419
|
+
var reader = {};
|
|
20197
20420
|
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20421
|
+
/* --------------------------------------------------------------------------------------------
|
|
20422
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20423
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20424
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20425
|
+
Object.defineProperty(reader, "__esModule", { value: true });
|
|
20426
|
+
reader.WebSocketMessageReader = void 0;
|
|
20427
|
+
const messageReader_1 = messageReader;
|
|
20428
|
+
class WebSocketMessageReader extends messageReader_1.AbstractMessageReader {
|
|
20429
|
+
constructor(socket) {
|
|
20430
|
+
super();
|
|
20431
|
+
this.socket = socket;
|
|
20432
|
+
this.state = 'initial';
|
|
20433
|
+
this.events = [];
|
|
20434
|
+
this.socket.onMessage(message => this.readMessage(message));
|
|
20435
|
+
this.socket.onError(error => this.fireError(error));
|
|
20436
|
+
this.socket.onClose((code, reason) => {
|
|
20437
|
+
if (code !== 1000) {
|
|
20438
|
+
const error = {
|
|
20439
|
+
name: '' + code,
|
|
20440
|
+
message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
|
|
20441
|
+
};
|
|
20442
|
+
this.fireError(error);
|
|
20443
|
+
}
|
|
20444
|
+
this.fireClose();
|
|
20445
|
+
});
|
|
20446
|
+
}
|
|
20447
|
+
listen(callback) {
|
|
20448
|
+
if (this.state === 'initial') {
|
|
20449
|
+
this.state = 'listening';
|
|
20450
|
+
this.callback = callback;
|
|
20451
|
+
while (this.events.length !== 0) {
|
|
20452
|
+
const event = this.events.pop();
|
|
20453
|
+
if (event.message) {
|
|
20454
|
+
this.readMessage(event.message);
|
|
20455
|
+
}
|
|
20456
|
+
else if (event.error) {
|
|
20457
|
+
this.fireError(event.error);
|
|
20458
|
+
}
|
|
20459
|
+
else {
|
|
20460
|
+
this.fireClose();
|
|
20461
|
+
}
|
|
20462
|
+
}
|
|
20463
|
+
}
|
|
20464
|
+
return {
|
|
20465
|
+
dispose: () => {
|
|
20466
|
+
if (this.callback === callback) {
|
|
20467
|
+
this.callback = undefined;
|
|
20468
|
+
}
|
|
20469
|
+
}
|
|
20470
|
+
};
|
|
20471
|
+
}
|
|
20472
|
+
readMessage(message) {
|
|
20473
|
+
if (this.state === 'initial') {
|
|
20474
|
+
this.events.splice(0, 0, { message });
|
|
20475
|
+
}
|
|
20476
|
+
else if (this.state === 'listening') {
|
|
20477
|
+
const data = JSON.parse(message);
|
|
20478
|
+
this.callback(data);
|
|
20479
|
+
}
|
|
20480
|
+
}
|
|
20481
|
+
fireError(error) {
|
|
20482
|
+
if (this.state === 'initial') {
|
|
20483
|
+
this.events.splice(0, 0, { error });
|
|
20484
|
+
}
|
|
20485
|
+
else if (this.state === 'listening') {
|
|
20486
|
+
super.fireError(error);
|
|
20487
|
+
}
|
|
20488
|
+
}
|
|
20489
|
+
fireClose() {
|
|
20490
|
+
if (this.state === 'initial') {
|
|
20491
|
+
this.events.splice(0, 0, {});
|
|
20492
|
+
}
|
|
20493
|
+
else if (this.state === 'listening') {
|
|
20494
|
+
super.fireClose();
|
|
20495
|
+
}
|
|
20496
|
+
this.state = 'closed';
|
|
20497
|
+
}
|
|
20498
|
+
}
|
|
20499
|
+
reader.WebSocketMessageReader = WebSocketMessageReader;
|
|
20203
20500
|
|
|
20204
|
-
|
|
20205
|
-
};
|
|
20501
|
+
var writer = {};
|
|
20206
20502
|
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20503
|
+
/* --------------------------------------------------------------------------------------------
|
|
20504
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20505
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20506
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20507
|
+
var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20508
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
20509
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20510
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20511
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20512
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20513
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20514
|
+
});
|
|
20212
20515
|
};
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
20219
|
-
|
|
20220
|
-
|
|
20516
|
+
Object.defineProperty(writer, "__esModule", { value: true });
|
|
20517
|
+
writer.WebSocketMessageWriter = void 0;
|
|
20518
|
+
const messageWriter_1 = messageWriter;
|
|
20519
|
+
class WebSocketMessageWriter extends messageWriter_1.AbstractMessageWriter {
|
|
20520
|
+
constructor(socket) {
|
|
20521
|
+
super();
|
|
20522
|
+
this.socket = socket;
|
|
20523
|
+
this.errorCount = 0;
|
|
20524
|
+
}
|
|
20525
|
+
end() {
|
|
20526
|
+
}
|
|
20527
|
+
write(msg) {
|
|
20528
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20529
|
+
try {
|
|
20530
|
+
const content = JSON.stringify(msg);
|
|
20531
|
+
this.socket.send(content);
|
|
20532
|
+
}
|
|
20533
|
+
catch (e) {
|
|
20534
|
+
this.errorCount++;
|
|
20535
|
+
this.fireError(e, msg, this.errorCount);
|
|
20536
|
+
}
|
|
20537
|
+
});
|
|
20538
|
+
}
|
|
20539
|
+
}
|
|
20540
|
+
writer.WebSocketMessageWriter = WebSocketMessageWriter;
|
|
20541
|
+
|
|
20542
|
+
var connection$1 = {};
|
|
20543
|
+
|
|
20544
|
+
Object.defineProperty(connection$1, "__esModule", { value: true });
|
|
20545
|
+
connection$1.createWebSocketConnection = void 0;
|
|
20546
|
+
/* --------------------------------------------------------------------------------------------
|
|
20547
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20548
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20549
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20550
|
+
const vscode_jsonrpc_1 = main$2;
|
|
20551
|
+
const reader_1 = reader;
|
|
20552
|
+
const writer_1 = writer;
|
|
20553
|
+
function createWebSocketConnection(socket, logger) {
|
|
20554
|
+
const messageReader = new reader_1.WebSocketMessageReader(socket);
|
|
20555
|
+
const messageWriter = new writer_1.WebSocketMessageWriter(socket);
|
|
20556
|
+
const connection = vscode_jsonrpc_1.createMessageConnection(messageReader, messageWriter, logger);
|
|
20557
|
+
connection.onClose(() => connection.dispose());
|
|
20558
|
+
return connection;
|
|
20559
|
+
}
|
|
20560
|
+
connection$1.createWebSocketConnection = createWebSocketConnection;
|
|
20561
|
+
|
|
20562
|
+
(function (exports) {
|
|
20563
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
20564
|
+
if (k2 === undefined) k2 = k;
|
|
20565
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20566
|
+
}) : (function(o, m, k, k2) {
|
|
20567
|
+
if (k2 === undefined) k2 = k;
|
|
20568
|
+
o[k2] = m[k];
|
|
20569
|
+
}));
|
|
20570
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20571
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20572
|
+
};
|
|
20573
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20574
|
+
/* --------------------------------------------------------------------------------------------
|
|
20575
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20576
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20577
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20578
|
+
__exportStar(socket, exports);
|
|
20579
|
+
__exportStar(reader, exports);
|
|
20580
|
+
__exportStar(writer, exports);
|
|
20581
|
+
__exportStar(connection$1, exports);
|
|
20582
|
+
|
|
20583
|
+
}(socket$1));
|
|
20584
|
+
|
|
20585
|
+
var logger = {};
|
|
20586
|
+
|
|
20587
|
+
Object.defineProperty(logger, "__esModule", { value: true });
|
|
20588
|
+
logger.ConsoleLogger = void 0;
|
|
20589
|
+
class ConsoleLogger {
|
|
20590
|
+
error(message) {
|
|
20591
|
+
console.error(message);
|
|
20592
|
+
}
|
|
20593
|
+
warn(message) {
|
|
20594
|
+
console.warn(message);
|
|
20595
|
+
}
|
|
20596
|
+
info(message) {
|
|
20597
|
+
console.info(message);
|
|
20598
|
+
}
|
|
20599
|
+
log(message) {
|
|
20600
|
+
console.log(message);
|
|
20601
|
+
}
|
|
20602
|
+
debug(message) {
|
|
20603
|
+
console.debug(message);
|
|
20604
|
+
}
|
|
20605
|
+
}
|
|
20606
|
+
logger.ConsoleLogger = ConsoleLogger;
|
|
20607
|
+
|
|
20608
|
+
var connection = {};
|
|
20609
|
+
|
|
20610
|
+
Object.defineProperty(connection, "__esModule", { value: true });
|
|
20611
|
+
connection.toSocket = connection.listen = void 0;
|
|
20612
|
+
const socket_1 = socket$1;
|
|
20613
|
+
const logger_1 = logger;
|
|
20614
|
+
function listen(options) {
|
|
20615
|
+
const { webSocket, onConnection } = options;
|
|
20616
|
+
const logger = options.logger || new logger_1.ConsoleLogger();
|
|
20617
|
+
webSocket.onopen = () => {
|
|
20618
|
+
const socket = toSocket(webSocket);
|
|
20619
|
+
const connection = socket_1.createWebSocketConnection(socket, logger);
|
|
20620
|
+
onConnection(connection);
|
|
20621
|
+
};
|
|
20622
|
+
}
|
|
20623
|
+
connection.listen = listen;
|
|
20624
|
+
function toSocket(webSocket) {
|
|
20625
|
+
return {
|
|
20626
|
+
send: content => webSocket.send(content),
|
|
20627
|
+
onMessage: cb => webSocket.onmessage = event => cb(event.data),
|
|
20628
|
+
onError: cb => webSocket.onerror = event => {
|
|
20629
|
+
if ('message' in event) {
|
|
20630
|
+
cb(event.message);
|
|
20631
|
+
}
|
|
20632
|
+
},
|
|
20633
|
+
onClose: cb => webSocket.onclose = event => cb(event.code, event.reason),
|
|
20634
|
+
dispose: () => webSocket.close()
|
|
20635
|
+
};
|
|
20636
|
+
}
|
|
20637
|
+
connection.toSocket = toSocket;
|
|
20638
|
+
|
|
20639
|
+
(function (exports) {
|
|
20640
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
20641
|
+
if (k2 === undefined) k2 = k;
|
|
20642
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20643
|
+
}) : (function(o, m, k, k2) {
|
|
20644
|
+
if (k2 === undefined) k2 = k;
|
|
20645
|
+
o[k2] = m[k];
|
|
20646
|
+
}));
|
|
20647
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20648
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20649
|
+
};
|
|
20650
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20651
|
+
/* --------------------------------------------------------------------------------------------
|
|
20652
|
+
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20653
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20654
|
+
* ------------------------------------------------------------------------------------------ */
|
|
20655
|
+
__exportStar(main$2, exports);
|
|
20656
|
+
__exportStar(messages$1, exports);
|
|
20657
|
+
__exportStar(disposable, exports);
|
|
20658
|
+
__exportStar(socket$1, exports);
|
|
20659
|
+
__exportStar(logger, exports);
|
|
20660
|
+
__exportStar(connection, exports);
|
|
20661
|
+
|
|
20662
|
+
}(lib));
|
|
20663
|
+
|
|
20664
|
+
const willShutdownNotificationType = new main$3.ProtocolNotificationType('willShutdown');
|
|
20665
|
+
const saveTextDocumentRequestType = new main$3.ProtocolRequestType('textDocument/save');
|
|
20666
|
+
const getTextDocumentRequestType = new main$3.ProtocolRequestType('textDocument/get');
|
|
20667
|
+
function updateFile(uri, text, languageClient) {
|
|
20668
|
+
return languageClient.sendRequest(saveTextDocumentRequestType, {
|
|
20669
|
+
textDocument: {
|
|
20670
|
+
uri,
|
|
20671
|
+
text
|
|
20672
|
+
}
|
|
20673
|
+
});
|
|
20674
|
+
}
|
|
20675
|
+
function getFile(uri, languageClient) {
|
|
20676
|
+
return languageClient.sendRequest(getTextDocumentRequestType, {
|
|
20677
|
+
textDocument: {
|
|
20678
|
+
uri
|
|
20679
|
+
}
|
|
20680
|
+
});
|
|
20681
|
+
}
|
|
20682
|
+
|
|
20683
|
+
function openWebsocketConnection(url) {
|
|
20684
|
+
return new Promise((resolve, reject) => {
|
|
20685
|
+
const webSocket = new WebSocket(url);
|
|
20686
|
+
|
|
20687
|
+
webSocket.onopen = () => {
|
|
20688
|
+
const socket = lib.toSocket(webSocket);
|
|
20689
|
+
const webSocketConnection = lib.createWebSocketConnection(socket, new lib.ConsoleLogger());
|
|
20690
|
+
webSocketConnection.onDispose(() => {
|
|
20691
|
+
webSocket.close();
|
|
20692
|
+
});
|
|
20693
|
+
resolve(webSocketConnection);
|
|
20694
|
+
};
|
|
20695
|
+
|
|
20696
|
+
webSocket.onerror = () => {
|
|
20697
|
+
reject(new Error('Unable to connect to server'));
|
|
20698
|
+
};
|
|
20699
|
+
});
|
|
20700
|
+
}
|
|
20701
|
+
|
|
20702
|
+
class CodinGameInfrastructure {
|
|
20703
|
+
constructor(
|
|
20704
|
+
/**
|
|
20705
|
+
* The domain of the server
|
|
20706
|
+
*/
|
|
20707
|
+
serverAddress, useMutualizedProxy,
|
|
20708
|
+
/**
|
|
20709
|
+
* An optional sessionId when connecting to the session-mutualized server
|
|
20710
|
+
*/
|
|
20711
|
+
sessionId,
|
|
20712
|
+
/**
|
|
20713
|
+
* A list of urls which link to zip files containing libraries/resources
|
|
20714
|
+
*/
|
|
20715
|
+
libraryUrls) {
|
|
20716
|
+
this.serverAddress = serverAddress;
|
|
20717
|
+
this.useMutualizedProxy = useMutualizedProxy;
|
|
20718
|
+
this.sessionId = sessionId;
|
|
20719
|
+
this.libraryUrls = libraryUrls;
|
|
20720
|
+
|
|
20721
|
+
_defineProperty(this, "automaticTextDocumentUpdate", false);
|
|
20722
|
+
|
|
20723
|
+
_defineProperty(this, "rootUri", 'file:///tmp/project');
|
|
20724
|
+
|
|
20725
|
+
_defineProperty(this, "workspaceFolders", [{
|
|
20726
|
+
uri: monaco.Uri.file('/tmp/project'),
|
|
20727
|
+
index: 0,
|
|
20728
|
+
name: 'main'
|
|
20729
|
+
}]);
|
|
20730
|
+
|
|
20731
|
+
_defineProperty(this, "getSecurityToken", void 0);
|
|
20732
|
+
}
|
|
20733
|
+
|
|
20734
|
+
async saveFileContent(document, reason, languageClient) {
|
|
20735
|
+
if (languageClient.isReady()) {
|
|
20736
|
+
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
20737
|
+
}
|
|
20738
|
+
}
|
|
20739
|
+
|
|
20740
|
+
async getFileContent(resource, languageClient) {
|
|
20741
|
+
try {
|
|
20742
|
+
return (await getFile(resource.toString(true), languageClient)).text;
|
|
20743
|
+
} catch (error) {
|
|
20744
|
+
console.error('File not found', resource.toString());
|
|
20745
|
+
return null;
|
|
20746
|
+
}
|
|
20747
|
+
}
|
|
20748
|
+
/**
|
|
20749
|
+
* A function which returns a valid JWT token to use to connect to the server
|
|
20750
|
+
*/
|
|
20751
|
+
|
|
20752
|
+
|
|
20753
|
+
async openConnection(id) {
|
|
20754
|
+
var _this$libraryUrls;
|
|
20755
|
+
|
|
20756
|
+
const url = new URL(this.sessionId != null ? "run/".concat(this.sessionId, "/").concat(id) : "run/".concat(id), this.serverAddress);
|
|
20757
|
+
(_this$libraryUrls = this.libraryUrls) === null || _this$libraryUrls === void 0 ? void 0 : _this$libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
20758
|
+
url.searchParams.append('token', await this.getSecurityToken());
|
|
20759
|
+
const connection = await openWebsocketConnection(url);
|
|
20760
|
+
return connection;
|
|
20761
|
+
}
|
|
20762
|
+
|
|
20763
|
+
}
|
|
20764
|
+
|
|
20765
|
+
var delay$2 = {exports: {}};
|
|
20766
|
+
|
|
20767
|
+
// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15
|
|
20768
|
+
const randomInteger = (minimum, maximum) => Math.floor((Math.random() * (maximum - minimum + 1)) + minimum);
|
|
20769
|
+
|
|
20770
|
+
const createAbortError = () => {
|
|
20771
|
+
const error = new Error('Delay aborted');
|
|
20772
|
+
error.name = 'AbortError';
|
|
20773
|
+
return error;
|
|
20774
|
+
};
|
|
20775
|
+
|
|
20776
|
+
const createDelay = ({clearTimeout: defaultClear, setTimeout: set, willResolve}) => (ms, {value, signal} = {}) => {
|
|
20777
|
+
if (signal && signal.aborted) {
|
|
20778
|
+
return Promise.reject(createAbortError());
|
|
20779
|
+
}
|
|
20780
|
+
|
|
20781
|
+
let timeoutId;
|
|
20782
|
+
let settle;
|
|
20783
|
+
let rejectFn;
|
|
20784
|
+
const clear = defaultClear || clearTimeout;
|
|
20785
|
+
|
|
20786
|
+
const signalListener = () => {
|
|
20787
|
+
clear(timeoutId);
|
|
20788
|
+
rejectFn(createAbortError());
|
|
20789
|
+
};
|
|
20790
|
+
|
|
20791
|
+
const cleanup = () => {
|
|
20792
|
+
if (signal) {
|
|
20793
|
+
signal.removeEventListener('abort', signalListener);
|
|
20794
|
+
}
|
|
20795
|
+
};
|
|
20796
|
+
|
|
20797
|
+
const delayPromise = new Promise((resolve, reject) => {
|
|
20798
|
+
settle = () => {
|
|
20799
|
+
cleanup();
|
|
20800
|
+
if (willResolve) {
|
|
20801
|
+
resolve(value);
|
|
20802
|
+
} else {
|
|
20803
|
+
reject(value);
|
|
20804
|
+
}
|
|
20805
|
+
};
|
|
20806
|
+
|
|
20807
|
+
rejectFn = reject;
|
|
20808
|
+
timeoutId = (set || setTimeout)(settle, ms);
|
|
20809
|
+
});
|
|
20810
|
+
|
|
20811
|
+
if (signal) {
|
|
20812
|
+
signal.addEventListener('abort', signalListener, {once: true});
|
|
20813
|
+
}
|
|
20814
|
+
|
|
20815
|
+
delayPromise.clear = () => {
|
|
20816
|
+
clear(timeoutId);
|
|
20817
|
+
timeoutId = null;
|
|
20818
|
+
settle();
|
|
20819
|
+
};
|
|
20820
|
+
|
|
20821
|
+
return delayPromise;
|
|
20822
|
+
};
|
|
20823
|
+
|
|
20824
|
+
const createWithTimers = clearAndSet => {
|
|
20825
|
+
const delay = createDelay({...clearAndSet, willResolve: true});
|
|
20826
|
+
delay.reject = createDelay({...clearAndSet, willResolve: false});
|
|
20827
|
+
delay.range = (minimum, maximum, options) => delay(randomInteger(minimum, maximum), options);
|
|
20828
|
+
return delay;
|
|
20829
|
+
};
|
|
20830
|
+
|
|
20831
|
+
const delay = createWithTimers();
|
|
20832
|
+
delay.createWithTimers = createWithTimers;
|
|
20833
|
+
|
|
20834
|
+
delay$2.exports = delay;
|
|
20835
|
+
// TODO: Remove this for the next major release
|
|
20836
|
+
delay$2.exports.default = delay;
|
|
20837
|
+
|
|
20221
20838
|
var delay$1 = delay$2.exports;
|
|
20222
20839
|
|
|
20223
20840
|
class WatchableOutputChannel {
|
|
@@ -20327,499 +20944,210 @@ class WatchableConsoleWindow {
|
|
|
20327
20944
|
channel = new WatchableOutputChannel(name);
|
|
20328
20945
|
channel.onWillClose(() => {
|
|
20329
20946
|
this.channels.delete(name);
|
|
20330
|
-
this.onDidChangeChannelsEmitter.fire();
|
|
20331
|
-
});
|
|
20332
|
-
this.channels.set(name, channel);
|
|
20333
|
-
this.onDidChangeChannelsEmitter.fire();
|
|
20334
|
-
}
|
|
20335
|
-
|
|
20336
|
-
return channel;
|
|
20337
|
-
}
|
|
20338
|
-
|
|
20339
|
-
get onDidChangeChannels() {
|
|
20340
|
-
return this.onDidChangeChannelsEmitter.event;
|
|
20341
|
-
}
|
|
20342
|
-
|
|
20343
|
-
}
|
|
20344
|
-
|
|
20345
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20346
|
-
|
|
20347
|
-
function lookUp(tree, key) {
|
|
20348
|
-
const parts = key.split('.');
|
|
20349
|
-
let node = tree;
|
|
20350
|
-
|
|
20351
|
-
for (let i = 0; node != null && i < parts.length; i++) {
|
|
20352
|
-
node = node[parts[i]];
|
|
20353
|
-
}
|
|
20354
|
-
|
|
20355
|
-
return node;
|
|
20356
|
-
}
|
|
20357
|
-
|
|
20358
|
-
class MemoryWorkspaceConfiguration {
|
|
20359
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20360
|
-
constructor(config) {
|
|
20361
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20362
|
-
const thisConfig = this;
|
|
20363
|
-
|
|
20364
|
-
for (const key of Object.keys(config !== null && config !== void 0 ? config : {})) {
|
|
20365
|
-
thisConfig[key] = config[key];
|
|
20366
|
-
}
|
|
20367
|
-
}
|
|
20368
|
-
|
|
20369
|
-
get(section, defaultValue) {
|
|
20370
|
-
var _lookUp;
|
|
20371
|
-
|
|
20372
|
-
return (_lookUp = lookUp(this, section)) !== null && _lookUp !== void 0 ? _lookUp : defaultValue;
|
|
20373
|
-
}
|
|
20374
|
-
|
|
20375
|
-
has(section) {
|
|
20376
|
-
return section in this;
|
|
20377
|
-
}
|
|
20378
|
-
|
|
20379
|
-
toJSON() {
|
|
20380
|
-
return this;
|
|
20381
|
-
}
|
|
20382
|
-
|
|
20383
|
-
}
|
|
20384
|
-
|
|
20385
|
-
const simpleConfigurationService = monaco.extra.StandaloneServices.get(monaco.extra.IConfigurationService);
|
|
20386
|
-
|
|
20387
|
-
class Configuration {
|
|
20388
|
-
constructor() {
|
|
20389
|
-
_defineProperty(this, "onDidChangeConfigurationEmitter", new lib$1.Emitter());
|
|
20390
|
-
}
|
|
20391
|
-
|
|
20392
|
-
getConfiguration(section, resource) {
|
|
20393
|
-
return new MemoryWorkspaceConfiguration(this.getValue(section, resource));
|
|
20394
|
-
}
|
|
20395
|
-
|
|
20396
|
-
getValue(section, resource) {
|
|
20397
|
-
const override = {
|
|
20398
|
-
resource: resource != null ? monaco.Uri.parse(resource) : null
|
|
20399
|
-
};
|
|
20400
|
-
|
|
20401
|
-
if (section == null) {
|
|
20402
|
-
return simpleConfigurationService.getValue(override);
|
|
20403
|
-
}
|
|
20404
|
-
|
|
20405
|
-
return simpleConfigurationService.getValue(section, override);
|
|
20406
|
-
}
|
|
20407
|
-
|
|
20408
|
-
get onDidChangeConfiguration() {
|
|
20409
|
-
return simpleConfigurationService.onDidChangeConfiguration;
|
|
20410
|
-
}
|
|
20411
|
-
|
|
20412
|
-
}
|
|
20413
|
-
|
|
20414
|
-
function updateFile(uri, text, languageClient) {
|
|
20415
|
-
return languageClient.sendRequest('textDocument/save', {
|
|
20416
|
-
textDocument: {
|
|
20417
|
-
uri,
|
|
20418
|
-
text
|
|
20419
|
-
}
|
|
20420
|
-
});
|
|
20421
|
-
}
|
|
20422
|
-
function getFile(uri, languageClient) {
|
|
20423
|
-
return languageClient.sendRequest('textDocument/get', {
|
|
20424
|
-
textDocument: {
|
|
20425
|
-
uri
|
|
20426
|
-
}
|
|
20427
|
-
});
|
|
20428
|
-
}
|
|
20429
|
-
|
|
20430
|
-
class CodinGameMonacoWorkspace extends lib$1.MonacoWorkspace {
|
|
20431
|
-
constructor(p2m, m2p) {
|
|
20432
|
-
let _rootUri = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20433
|
-
|
|
20434
|
-
super(monaco, p2m, m2p, _rootUri); // "workaround" for https://github.com/TypeFox/monaco-languageclient/pull/199#issuecomment-593414330
|
|
20435
|
-
|
|
20436
|
-
_defineProperty(this, "onWillSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20437
|
-
|
|
20438
|
-
_defineProperty(this, "onDidSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20439
|
-
|
|
20440
|
-
_defineProperty(this, "workspaceFolders", void 0);
|
|
20441
|
-
|
|
20442
|
-
_defineProperty(this, "configurations", new Configuration());
|
|
20443
|
-
|
|
20444
|
-
if (_rootUri != null) {
|
|
20445
|
-
const uri = monaco.Uri.parse(_rootUri);
|
|
20446
|
-
this.workspaceFolders = [{
|
|
20447
|
-
uri,
|
|
20448
|
-
index: 0,
|
|
20449
|
-
name: uri.toString()
|
|
20450
|
-
}];
|
|
20451
|
-
}
|
|
20452
|
-
}
|
|
20453
|
-
|
|
20454
|
-
get onWillSaveTextDocument() {
|
|
20455
|
-
return this.onWillSaveTextDocumentEmitter.event;
|
|
20456
|
-
}
|
|
20457
|
-
|
|
20458
|
-
get onDidSaveTextDocument() {
|
|
20459
|
-
return this.onDidSaveTextDocumentEmitter.event;
|
|
20460
|
-
}
|
|
20461
|
-
|
|
20462
|
-
async saveDocument(document, reason) {
|
|
20463
|
-
this.onWillSaveTextDocumentEmitter.fire({
|
|
20464
|
-
textDocument: document,
|
|
20465
|
-
reason
|
|
20466
|
-
});
|
|
20467
|
-
|
|
20468
|
-
try {
|
|
20469
|
-
await Promise.all(getAllLanguageClientManagersByTextDocument(document).map(async languageClient => {
|
|
20470
|
-
if (languageClient.isReady()) {
|
|
20471
|
-
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
20472
|
-
}
|
|
20473
|
-
}));
|
|
20474
|
-
this.onDidSaveTextDocumentEmitter.fire(document);
|
|
20475
|
-
} catch (err) {
|
|
20476
|
-
console.error('[LSP]', 'Unable to save file on language server', err);
|
|
20947
|
+
this.onDidChangeChannelsEmitter.fire();
|
|
20948
|
+
});
|
|
20949
|
+
this.channels.set(name, channel);
|
|
20950
|
+
this.onDidChangeChannelsEmitter.fire();
|
|
20477
20951
|
}
|
|
20952
|
+
|
|
20953
|
+
return channel;
|
|
20954
|
+
}
|
|
20955
|
+
|
|
20956
|
+
get onDidChangeChannels() {
|
|
20957
|
+
return this.onDidChangeChannelsEmitter.event;
|
|
20478
20958
|
}
|
|
20479
20959
|
|
|
20480
20960
|
}
|
|
20481
20961
|
|
|
20482
|
-
|
|
20483
|
-
// Comes from https://github.com/redhat-developer/vscode-java/blob/9b0f0aca80cbefabad4c034fb5dd365d029f6170/src/extension.ts#L155-L160
|
|
20484
|
-
// Other commands needs to be implemented as well?
|
|
20485
|
-
// (https://github.com/eclipse/eclipse.jdt.ls/issues/376#issuecomment-333923685)
|
|
20486
|
-
services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
20487
|
-
if (edit.documentChanges != null && edit.documentChanges.some(change => main$3.RenameFile.is(change) || main$3.CreateFile.is(change))) {
|
|
20488
|
-
alert('Unimplemented command');
|
|
20489
|
-
return;
|
|
20490
|
-
}
|
|
20962
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20491
20963
|
|
|
20492
|
-
|
|
20493
|
-
|
|
20964
|
+
function lookUp(tree, key) {
|
|
20965
|
+
const parts = key.split('.');
|
|
20966
|
+
let node = tree;
|
|
20967
|
+
|
|
20968
|
+
for (let i = 0; node != null && i < parts.length; i++) {
|
|
20969
|
+
node = node[parts[i]];
|
|
20970
|
+
}
|
|
20971
|
+
|
|
20972
|
+
return node;
|
|
20494
20973
|
}
|
|
20495
20974
|
|
|
20496
|
-
|
|
20497
|
-
|
|
20498
|
-
|
|
20499
|
-
|
|
20975
|
+
class MemoryWorkspaceConfiguration {
|
|
20976
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20977
|
+
constructor(config) {
|
|
20978
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20979
|
+
const thisConfig = this;
|
|
20500
20980
|
|
|
20501
|
-
|
|
20502
|
-
|
|
20503
|
-
timeoutMap.delete(e.textDocument.uri);
|
|
20981
|
+
for (const key of Object.keys(config !== null && config !== void 0 ? config : {})) {
|
|
20982
|
+
thisConfig[key] = config[key];
|
|
20504
20983
|
}
|
|
20984
|
+
}
|
|
20505
20985
|
|
|
20506
|
-
|
|
20507
|
-
|
|
20508
|
-
services.workspace.saveDocument(e.textDocument, lib$1.TextDocumentSaveReason.AfterDelay).catch(err => {
|
|
20509
|
-
console.error('[LSP]', "Unable to save the document ".concat(e.textDocument.uri.toString()), err);
|
|
20510
|
-
});
|
|
20511
|
-
}, 500));
|
|
20512
|
-
});
|
|
20513
|
-
}
|
|
20986
|
+
get(section, defaultValue) {
|
|
20987
|
+
var _lookUp;
|
|
20514
20988
|
|
|
20515
|
-
|
|
20989
|
+
return (_lookUp = lookUp(this, section)) !== null && _lookUp !== void 0 ? _lookUp : defaultValue;
|
|
20990
|
+
}
|
|
20516
20991
|
|
|
20517
|
-
|
|
20518
|
-
|
|
20519
|
-
|
|
20992
|
+
has(section) {
|
|
20993
|
+
return section in this;
|
|
20994
|
+
}
|
|
20520
20995
|
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
commands: new lib$1.MonacoCommands(monaco),
|
|
20524
|
-
languages: new lib$1.MonacoLanguages(monaco, p2m, m2p),
|
|
20525
|
-
workspace: new CodinGameMonacoWorkspace(p2m, m2p, 'file:///tmp/project'),
|
|
20526
|
-
window: new WatchableConsoleWindow()
|
|
20527
|
-
};
|
|
20528
|
-
lib$1.Services.install(services);
|
|
20529
|
-
installCommands(services);
|
|
20530
|
-
autoSaveModels(services);
|
|
20996
|
+
toJSON() {
|
|
20997
|
+
return this;
|
|
20531
20998
|
}
|
|
20999
|
+
|
|
20532
21000
|
}
|
|
20533
21001
|
|
|
20534
|
-
|
|
21002
|
+
const simpleConfigurationService = monaco.extra.StandaloneServices.get(monaco.extra.IConfigurationService);
|
|
20535
21003
|
|
|
20536
|
-
|
|
21004
|
+
class Configuration {
|
|
21005
|
+
constructor() {
|
|
21006
|
+
_defineProperty(this, "onDidChangeConfigurationEmitter", new lib$1.Emitter());
|
|
21007
|
+
}
|
|
20537
21008
|
|
|
20538
|
-
(
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
this.disposables = [];
|
|
20550
|
-
}
|
|
20551
|
-
dispose() {
|
|
20552
|
-
while (this.disposables.length !== 0) {
|
|
20553
|
-
this.disposables.pop().dispose();
|
|
20554
|
-
}
|
|
20555
|
-
}
|
|
20556
|
-
push(disposable) {
|
|
20557
|
-
const disposables = this.disposables;
|
|
20558
|
-
disposables.push(disposable);
|
|
20559
|
-
return {
|
|
20560
|
-
dispose() {
|
|
20561
|
-
const index = disposables.indexOf(disposable);
|
|
20562
|
-
if (index !== -1) {
|
|
20563
|
-
disposables.splice(index, 1);
|
|
20564
|
-
}
|
|
20565
|
-
}
|
|
20566
|
-
};
|
|
21009
|
+
getConfiguration(section, resource) {
|
|
21010
|
+
return new MemoryWorkspaceConfiguration(this.getValue(section, resource));
|
|
21011
|
+
}
|
|
21012
|
+
|
|
21013
|
+
getValue(section, resource) {
|
|
21014
|
+
const override = {
|
|
21015
|
+
resource: resource != null ? monaco.Uri.parse(resource) : null
|
|
21016
|
+
};
|
|
21017
|
+
|
|
21018
|
+
if (section == null) {
|
|
21019
|
+
return simpleConfigurationService.getValue(override);
|
|
20567
21020
|
}
|
|
20568
|
-
}
|
|
20569
|
-
exports.DisposableCollection = DisposableCollection;
|
|
20570
21021
|
|
|
20571
|
-
|
|
21022
|
+
return simpleConfigurationService.getValue(section, override);
|
|
21023
|
+
}
|
|
20572
21024
|
|
|
20573
|
-
|
|
21025
|
+
get onDidChangeConfiguration() {
|
|
21026
|
+
return simpleConfigurationService.onDidChangeConfiguration;
|
|
21027
|
+
}
|
|
20574
21028
|
|
|
20575
|
-
|
|
21029
|
+
}
|
|
20576
21030
|
|
|
20577
|
-
|
|
21031
|
+
class CodinGameMonacoWorkspace extends lib$1.MonacoWorkspace {
|
|
21032
|
+
constructor(p2m, m2p) {
|
|
21033
|
+
let _rootUri = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20578
21034
|
|
|
20579
|
-
|
|
21035
|
+
let workspaceFolders = arguments.length > 3 ? arguments[3] : undefined;
|
|
21036
|
+
super(monaco, p2m, m2p, _rootUri); // "workaround" for https://github.com/TypeFox/monaco-languageclient/pull/199#issuecomment-593414330
|
|
20580
21037
|
|
|
20581
|
-
|
|
20582
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20583
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20584
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20585
|
-
Object.defineProperty(reader, "__esModule", { value: true });
|
|
20586
|
-
reader.WebSocketMessageReader = void 0;
|
|
20587
|
-
const messageReader_1 = messageReader;
|
|
20588
|
-
class WebSocketMessageReader extends messageReader_1.AbstractMessageReader {
|
|
20589
|
-
constructor(socket) {
|
|
20590
|
-
super();
|
|
20591
|
-
this.socket = socket;
|
|
20592
|
-
this.state = 'initial';
|
|
20593
|
-
this.events = [];
|
|
20594
|
-
this.socket.onMessage(message => this.readMessage(message));
|
|
20595
|
-
this.socket.onError(error => this.fireError(error));
|
|
20596
|
-
this.socket.onClose((code, reason) => {
|
|
20597
|
-
if (code !== 1000) {
|
|
20598
|
-
const error = {
|
|
20599
|
-
name: '' + code,
|
|
20600
|
-
message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
|
|
20601
|
-
};
|
|
20602
|
-
this.fireError(error);
|
|
20603
|
-
}
|
|
20604
|
-
this.fireClose();
|
|
20605
|
-
});
|
|
20606
|
-
}
|
|
20607
|
-
listen(callback) {
|
|
20608
|
-
if (this.state === 'initial') {
|
|
20609
|
-
this.state = 'listening';
|
|
20610
|
-
this.callback = callback;
|
|
20611
|
-
while (this.events.length !== 0) {
|
|
20612
|
-
const event = this.events.pop();
|
|
20613
|
-
if (event.message) {
|
|
20614
|
-
this.readMessage(event.message);
|
|
20615
|
-
}
|
|
20616
|
-
else if (event.error) {
|
|
20617
|
-
this.fireError(event.error);
|
|
20618
|
-
}
|
|
20619
|
-
else {
|
|
20620
|
-
this.fireClose();
|
|
20621
|
-
}
|
|
20622
|
-
}
|
|
20623
|
-
}
|
|
20624
|
-
return {
|
|
20625
|
-
dispose: () => {
|
|
20626
|
-
if (this.callback === callback) {
|
|
20627
|
-
this.callback = undefined;
|
|
20628
|
-
}
|
|
20629
|
-
}
|
|
20630
|
-
};
|
|
20631
|
-
}
|
|
20632
|
-
readMessage(message) {
|
|
20633
|
-
if (this.state === 'initial') {
|
|
20634
|
-
this.events.splice(0, 0, { message });
|
|
20635
|
-
}
|
|
20636
|
-
else if (this.state === 'listening') {
|
|
20637
|
-
const data = JSON.parse(message);
|
|
20638
|
-
this.callback(data);
|
|
20639
|
-
}
|
|
20640
|
-
}
|
|
20641
|
-
fireError(error) {
|
|
20642
|
-
if (this.state === 'initial') {
|
|
20643
|
-
this.events.splice(0, 0, { error });
|
|
20644
|
-
}
|
|
20645
|
-
else if (this.state === 'listening') {
|
|
20646
|
-
super.fireError(error);
|
|
20647
|
-
}
|
|
20648
|
-
}
|
|
20649
|
-
fireClose() {
|
|
20650
|
-
if (this.state === 'initial') {
|
|
20651
|
-
this.events.splice(0, 0, {});
|
|
20652
|
-
}
|
|
20653
|
-
else if (this.state === 'listening') {
|
|
20654
|
-
super.fireClose();
|
|
20655
|
-
}
|
|
20656
|
-
this.state = 'closed';
|
|
20657
|
-
}
|
|
20658
|
-
}
|
|
20659
|
-
reader.WebSocketMessageReader = WebSocketMessageReader;
|
|
21038
|
+
this.workspaceFolders = workspaceFolders;
|
|
20660
21039
|
|
|
20661
|
-
|
|
21040
|
+
_defineProperty(this, "onWillSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20662
21041
|
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
};
|
|
20676
|
-
Object.defineProperty(writer, "__esModule", { value: true });
|
|
20677
|
-
writer.WebSocketMessageWriter = void 0;
|
|
20678
|
-
const messageWriter_1 = messageWriter;
|
|
20679
|
-
class WebSocketMessageWriter extends messageWriter_1.AbstractMessageWriter {
|
|
20680
|
-
constructor(socket) {
|
|
20681
|
-
super();
|
|
20682
|
-
this.socket = socket;
|
|
20683
|
-
this.errorCount = 0;
|
|
20684
|
-
}
|
|
20685
|
-
end() {
|
|
20686
|
-
}
|
|
20687
|
-
write(msg) {
|
|
20688
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20689
|
-
try {
|
|
20690
|
-
const content = JSON.stringify(msg);
|
|
20691
|
-
this.socket.send(content);
|
|
20692
|
-
}
|
|
20693
|
-
catch (e) {
|
|
20694
|
-
this.errorCount++;
|
|
20695
|
-
this.fireError(e, msg, this.errorCount);
|
|
20696
|
-
}
|
|
20697
|
-
});
|
|
21042
|
+
_defineProperty(this, "savehandlers", []);
|
|
21043
|
+
|
|
21044
|
+
_defineProperty(this, "onDidSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
21045
|
+
|
|
21046
|
+
_defineProperty(this, "configurations", new Configuration());
|
|
21047
|
+
|
|
21048
|
+
if (this.workspaceFolders == null && _rootUri != null) {
|
|
21049
|
+
const uri = monaco.Uri.parse(_rootUri);
|
|
21050
|
+
this.workspaceFolders = [{
|
|
21051
|
+
uri,
|
|
21052
|
+
index: 0,
|
|
21053
|
+
name: uri.toString()
|
|
21054
|
+
}];
|
|
20698
21055
|
}
|
|
20699
|
-
}
|
|
20700
|
-
writer.WebSocketMessageWriter = WebSocketMessageWriter;
|
|
21056
|
+
}
|
|
20701
21057
|
|
|
20702
|
-
|
|
21058
|
+
get onWillSaveTextDocument() {
|
|
21059
|
+
return this.onWillSaveTextDocumentEmitter.event;
|
|
21060
|
+
}
|
|
20703
21061
|
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20708
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20709
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20710
|
-
const vscode_jsonrpc_1 = main$2;
|
|
20711
|
-
const reader_1 = reader;
|
|
20712
|
-
const writer_1 = writer;
|
|
20713
|
-
function createWebSocketConnection(socket, logger) {
|
|
20714
|
-
const messageReader = new reader_1.WebSocketMessageReader(socket);
|
|
20715
|
-
const messageWriter = new writer_1.WebSocketMessageWriter(socket);
|
|
20716
|
-
const connection = vscode_jsonrpc_1.createMessageConnection(messageReader, messageWriter, logger);
|
|
20717
|
-
connection.onClose(() => connection.dispose());
|
|
20718
|
-
return connection;
|
|
20719
|
-
}
|
|
20720
|
-
connection$1.createWebSocketConnection = createWebSocketConnection;
|
|
21062
|
+
get onDidSaveTextDocument() {
|
|
21063
|
+
return this.onDidSaveTextDocumentEmitter.event;
|
|
21064
|
+
}
|
|
20721
21065
|
|
|
20722
|
-
(
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
}) : (function(o, m, k, k2) {
|
|
20727
|
-
if (k2 === undefined) k2 = k;
|
|
20728
|
-
o[k2] = m[k];
|
|
20729
|
-
}));
|
|
20730
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20731
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20732
|
-
};
|
|
20733
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20734
|
-
/* --------------------------------------------------------------------------------------------
|
|
20735
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20736
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20737
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20738
|
-
__exportStar(socket, exports);
|
|
20739
|
-
__exportStar(reader, exports);
|
|
20740
|
-
__exportStar(writer, exports);
|
|
20741
|
-
__exportStar(connection$1, exports);
|
|
21066
|
+
registerSaveDocumentHandler(handler) {
|
|
21067
|
+
this.savehandlers.push(handler);
|
|
21068
|
+
return lib$1.Disposable.create(() => {
|
|
21069
|
+
const index = this.savehandlers.indexOf(handler);
|
|
20742
21070
|
|
|
20743
|
-
|
|
21071
|
+
if (index >= 0) {
|
|
21072
|
+
this.savehandlers.splice(index, 1);
|
|
21073
|
+
}
|
|
21074
|
+
});
|
|
21075
|
+
}
|
|
20744
21076
|
|
|
20745
|
-
|
|
21077
|
+
async saveDocument(document, reason) {
|
|
21078
|
+
this.onWillSaveTextDocumentEmitter.fire({
|
|
21079
|
+
textDocument: document,
|
|
21080
|
+
reason
|
|
21081
|
+
});
|
|
20746
21082
|
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
}
|
|
20753
|
-
|
|
20754
|
-
console.warn(message);
|
|
20755
|
-
}
|
|
20756
|
-
info(message) {
|
|
20757
|
-
console.info(message);
|
|
20758
|
-
}
|
|
20759
|
-
log(message) {
|
|
20760
|
-
console.log(message);
|
|
21083
|
+
try {
|
|
21084
|
+
await Promise.all(this.savehandlers.map(handler => {
|
|
21085
|
+
return handler.saveTextContent(document, reason);
|
|
21086
|
+
}));
|
|
21087
|
+
this.onDidSaveTextDocumentEmitter.fire(document);
|
|
21088
|
+
} catch (err) {
|
|
21089
|
+
console.error('[LSP]', 'Unable to save file on language server', err);
|
|
20761
21090
|
}
|
|
20762
|
-
|
|
20763
|
-
|
|
21091
|
+
}
|
|
21092
|
+
|
|
21093
|
+
}
|
|
21094
|
+
|
|
21095
|
+
function installCommands(services) {
|
|
21096
|
+
// Comes from https://github.com/redhat-developer/vscode-java/blob/9b0f0aca80cbefabad4c034fb5dd365d029f6170/src/extension.ts#L155-L160
|
|
21097
|
+
// Other commands needs to be implemented as well?
|
|
21098
|
+
// (https://github.com/eclipse/eclipse.jdt.ls/issues/376#issuecomment-333923685)
|
|
21099
|
+
services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
21100
|
+
if (edit.documentChanges != null && edit.documentChanges.some(change => main$3.RenameFile.is(change) || main$3.CreateFile.is(change))) {
|
|
21101
|
+
alert('Unimplemented command');
|
|
21102
|
+
return;
|
|
20764
21103
|
}
|
|
21104
|
+
|
|
21105
|
+
return services.workspace.applyEdit(edit);
|
|
21106
|
+
});
|
|
20765
21107
|
}
|
|
20766
|
-
logger.ConsoleLogger = ConsoleLogger;
|
|
20767
21108
|
|
|
20768
|
-
|
|
21109
|
+
function autoSaveModels(services) {
|
|
21110
|
+
const timeoutMap = new Map();
|
|
21111
|
+
services.workspace.onDidChangeTextDocument(e => {
|
|
21112
|
+
const timeout = timeoutMap.get(e.textDocument.uri);
|
|
20769
21113
|
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
21114
|
+
if (timeout != null) {
|
|
21115
|
+
window.clearTimeout(timeout);
|
|
21116
|
+
timeoutMap.delete(e.textDocument.uri);
|
|
21117
|
+
}
|
|
21118
|
+
|
|
21119
|
+
timeoutMap.set(e.textDocument.uri, window.setTimeout(() => {
|
|
21120
|
+
timeoutMap.delete(e.textDocument.uri);
|
|
21121
|
+
services.workspace.saveDocument(e.textDocument, lib$1.TextDocumentSaveReason.AfterDelay).catch(err => {
|
|
21122
|
+
console.error('[LSP]', "Unable to save the document ".concat(e.textDocument.uri.toString()), err);
|
|
21123
|
+
});
|
|
21124
|
+
}, 500));
|
|
21125
|
+
});
|
|
20782
21126
|
}
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
21127
|
+
|
|
21128
|
+
let services = null;
|
|
21129
|
+
|
|
21130
|
+
function installServices(infrastructure) {
|
|
21131
|
+
const m2p = new lib$1.MonacoToProtocolConverter(monaco);
|
|
21132
|
+
const p2m = new lib$1.ProtocolToMonacoConverter(monaco);
|
|
21133
|
+
|
|
21134
|
+
if (services == null) {
|
|
21135
|
+
services = {
|
|
21136
|
+
commands: new lib$1.MonacoCommands(monaco),
|
|
21137
|
+
languages: new lib$1.MonacoLanguages(monaco, p2m, m2p),
|
|
21138
|
+
workspace: new CodinGameMonacoWorkspace(p2m, m2p, infrastructure.rootUri, infrastructure.workspaceFolders),
|
|
21139
|
+
window: new WatchableConsoleWindow()
|
|
20795
21140
|
};
|
|
20796
|
-
|
|
20797
|
-
|
|
21141
|
+
lib$1.Services.install(services);
|
|
21142
|
+
installCommands(services);
|
|
20798
21143
|
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
}) : (function(o, m, k, k2) {
|
|
20804
|
-
if (k2 === undefined) k2 = k;
|
|
20805
|
-
o[k2] = m[k];
|
|
20806
|
-
}));
|
|
20807
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20808
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20809
|
-
};
|
|
20810
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20811
|
-
/* --------------------------------------------------------------------------------------------
|
|
20812
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20813
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20814
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20815
|
-
__exportStar(main$2, exports);
|
|
20816
|
-
__exportStar(messages$1, exports);
|
|
20817
|
-
__exportStar(disposable, exports);
|
|
20818
|
-
__exportStar(socket$1, exports);
|
|
20819
|
-
__exportStar(logger, exports);
|
|
20820
|
-
__exportStar(connection, exports);
|
|
21144
|
+
if (!infrastructure.automaticTextDocumentUpdate) {
|
|
21145
|
+
autoSaveModels(services);
|
|
21146
|
+
}
|
|
21147
|
+
}
|
|
20821
21148
|
|
|
20822
|
-
|
|
21149
|
+
return services;
|
|
21150
|
+
}
|
|
20823
21151
|
|
|
20824
21152
|
// Initialize the file content into the lsp server for implementations that don't support open/close notifications
|
|
20825
21153
|
class InitializeTextDocumentFeature {
|
|
@@ -20883,10 +21211,10 @@ class CobolResolveSubroutineFeature {
|
|
|
20883
21211
|
|
|
20884
21212
|
initialize(capabilities, documentSelector) {
|
|
20885
21213
|
this.onRequestDisposable = this.languageClient.onRequest('cobol/resolveSubroutine', routineName => {
|
|
20886
|
-
var _Services$get$workspa;
|
|
21214
|
+
var _Services$get$workspa, _Services$get$workspa2;
|
|
20887
21215
|
|
|
20888
21216
|
const constantRoutinePaths = {
|
|
20889
|
-
'assert-equals': 'file:/tmp/project/deps/assert-equals.cbl
|
|
21217
|
+
'assert-equals': "".concat((_Services$get$workspa = lib$1.Services.get().workspace.rootUri) !== null && _Services$get$workspa !== void 0 ? _Services$get$workspa : 'file:/tmp/project', "/deps/assert-equals.cbl")
|
|
20890
21218
|
};
|
|
20891
21219
|
const contantRoutinePath = constantRoutinePaths[routineName.toLowerCase()];
|
|
20892
21220
|
|
|
@@ -20894,7 +21222,7 @@ class CobolResolveSubroutineFeature {
|
|
|
20894
21222
|
return contantRoutinePath;
|
|
20895
21223
|
}
|
|
20896
21224
|
|
|
20897
|
-
return (_Services$get$
|
|
21225
|
+
return (_Services$get$workspa2 = lib$1.Services.get().workspace.textDocuments.filter(textDocument => lib$1.Services.get().languages.match(documentSelector, textDocument)).filter(document => document.getText().match(new RegExp("PROGRAM-ID\\.\\W+".concat(routineName, "\\."), 'gi'))).sort((a, b) => a.uri.localeCompare(b.uri))[0]) === null || _Services$get$workspa2 === void 0 ? void 0 : _Services$get$workspa2.uri;
|
|
20898
21226
|
});
|
|
20899
21227
|
}
|
|
20900
21228
|
|
|
@@ -20907,13 +21235,10 @@ class CobolResolveSubroutineFeature {
|
|
|
20907
21235
|
}
|
|
20908
21236
|
|
|
20909
21237
|
function registerExtensionFeatures(client, language) {
|
|
20910
|
-
client.registerFeature(new InitializeTextDocumentFeature(client));
|
|
20911
|
-
|
|
20912
21238
|
if (language === 'cobol') {
|
|
20913
21239
|
client.registerFeature(new CobolResolveSubroutineFeature(client));
|
|
20914
21240
|
}
|
|
20915
21241
|
}
|
|
20916
|
-
const willShutdownNotificationType = new lib$1.ProtocolNotificationType('willShutdown');
|
|
20917
21242
|
class WillDisposeFeature {
|
|
20918
21243
|
constructor(languageClient, onWillShutdownEmitter) {
|
|
20919
21244
|
this.languageClient = languageClient;
|
|
@@ -20932,131 +21257,110 @@ class WillDisposeFeature {
|
|
|
20932
21257
|
|
|
20933
21258
|
}
|
|
20934
21259
|
|
|
20935
|
-
async function
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
webSocket.onopen = () => {
|
|
20940
|
-
const socket = lib.toSocket(webSocket);
|
|
20941
|
-
const webSocketConnection = lib.createWebSocketConnection(socket, new lib.ConsoleLogger());
|
|
20942
|
-
webSocketConnection.onDispose(() => {
|
|
20943
|
-
webSocket.close();
|
|
20944
|
-
});
|
|
20945
|
-
const connection = lib$1.createConnection(webSocketConnection, errorHandler, closeHandler);
|
|
20946
|
-
const existingRegistrations = new Set();
|
|
20947
|
-
|
|
20948
|
-
const fixedConnection = _objectSpread2(_objectSpread2({}, connection), {}, {
|
|
20949
|
-
initialize: params => {
|
|
20950
|
-
var _params$rootPath;
|
|
20951
|
-
|
|
20952
|
-
// Hack to fix url converted from /toto/tata to \\toto\tata in windows
|
|
20953
|
-
const rootPath = (_params$rootPath = params.rootPath) === null || _params$rootPath === void 0 ? void 0 : _params$rootPath.replace(/\\/g, '/');
|
|
20954
|
-
|
|
20955
|
-
const fixedParams = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
20956
|
-
rootPath: rootPath,
|
|
20957
|
-
rootUri: rootPath != null ? Uri.from({
|
|
20958
|
-
scheme: 'file',
|
|
20959
|
-
path: rootPath
|
|
20960
|
-
}).toString() : null
|
|
20961
|
-
});
|
|
21260
|
+
async function messageConnectionToConnection(messageConnection, errorHandler, closeHandler) {
|
|
21261
|
+
const connection = lib$1.createConnection(messageConnection, errorHandler, closeHandler);
|
|
21262
|
+
const existingRegistrations = new Set();
|
|
20962
21263
|
|
|
20963
|
-
|
|
20964
|
-
|
|
21264
|
+
const fixedConnection = _objectSpread2(_objectSpread2({}, connection), {}, {
|
|
21265
|
+
initialize: params => {
|
|
21266
|
+
var _params$rootPath;
|
|
20965
21267
|
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
args[_key] = arguments[_key];
|
|
20969
|
-
}
|
|
21268
|
+
// Hack to fix url converted from /toto/tata to \\toto\tata in windows
|
|
21269
|
+
const rootPath = (_params$rootPath = params.rootPath) === null || _params$rootPath === void 0 ? void 0 : _params$rootPath.replace(/\\/g, '/');
|
|
20970
21270
|
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
21271
|
+
const fixedParams = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
21272
|
+
rootPath: rootPath,
|
|
21273
|
+
rootUri: rootPath != null ? Uri.from({
|
|
21274
|
+
scheme: 'file',
|
|
21275
|
+
path: rootPath
|
|
21276
|
+
}).toString() : null
|
|
21277
|
+
});
|
|
20974
21278
|
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
registrationParams.registrations = registrationParams.registrations.filter(registration => {
|
|
20978
|
-
const alreadyExisting = existingRegistrations.has(registration.id);
|
|
21279
|
+
return connection.initialize(fixedParams);
|
|
21280
|
+
},
|
|
20979
21281
|
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
21282
|
+
onRequest() {
|
|
21283
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21284
|
+
args[_key] = arguments[_key];
|
|
21285
|
+
}
|
|
20983
21286
|
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
existingRegistrations.add(registration.id);
|
|
20988
|
-
});
|
|
20989
|
-
}
|
|
21287
|
+
return connection.onRequest(args[0], function () {
|
|
21288
|
+
// Hack for https://github.com/OmniSharp/omnisharp-roslyn/issues/2119
|
|
21289
|
+
const method = args[0].method;
|
|
20990
21290
|
|
|
20991
|
-
|
|
20992
|
-
|
|
21291
|
+
if (method === lib$1.RegistrationRequest.type.method) {
|
|
21292
|
+
const registrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
21293
|
+
registrationParams.registrations = registrationParams.registrations.filter(registration => {
|
|
21294
|
+
const alreadyExisting = existingRegistrations.has(registration.id);
|
|
20993
21295
|
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
}
|
|
21296
|
+
if (alreadyExisting) {
|
|
21297
|
+
console.warn('Registration already existing', registration.id, registration.method);
|
|
20997
21298
|
}
|
|
20998
21299
|
|
|
20999
|
-
return
|
|
21300
|
+
return !alreadyExisting;
|
|
21000
21301
|
});
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
connection.dispose();
|
|
21006
|
-
} catch (error) {
|
|
21007
|
-
// The dispose should NEVER fail or the lsp client is not properly cleaned
|
|
21008
|
-
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3105
|
|
21009
|
-
console.warn('[LSP]', 'Error while disposing connection', error);
|
|
21010
|
-
} // Hack, when the language client is removed, the connection is disposed but the closeHandler is not always properly called
|
|
21011
|
-
// The language client is then still active but without a proper connection and errors will occurs
|
|
21302
|
+
registrationParams.registrations.forEach(registration => {
|
|
21303
|
+
existingRegistrations.add(registration.id);
|
|
21304
|
+
});
|
|
21305
|
+
}
|
|
21012
21306
|
|
|
21307
|
+
if (method === lib$1.UnregistrationRequest.type.method) {
|
|
21308
|
+
const unregistrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
21013
21309
|
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
shutdown: async () => {
|
|
21017
|
-
// The shutdown should NEVER fail or the connection is not closed and the lsp client is not properly cleaned
|
|
21018
|
-
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3103
|
|
21019
|
-
try {
|
|
21020
|
-
await connection.shutdown();
|
|
21021
|
-
} catch (error) {
|
|
21022
|
-
console.warn('[LSP]', 'Error while shutdown lsp', error);
|
|
21310
|
+
for (const unregistration of unregistrationParams.unregisterations) {
|
|
21311
|
+
existingRegistrations.delete(unregistration.id);
|
|
21023
21312
|
}
|
|
21024
21313
|
}
|
|
21314
|
+
|
|
21315
|
+
return args[1](...arguments);
|
|
21025
21316
|
});
|
|
21317
|
+
},
|
|
21026
21318
|
|
|
21027
|
-
|
|
21028
|
-
|
|
21319
|
+
dispose: () => {
|
|
21320
|
+
try {
|
|
21321
|
+
connection.dispose();
|
|
21322
|
+
} catch (error) {
|
|
21323
|
+
// The dispose should NEVER fail or the lsp client is not properly cleaned
|
|
21324
|
+
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3105
|
|
21325
|
+
console.warn('[LSP]', 'Error while disposing connection', error);
|
|
21326
|
+
} // Hack, when the language client is removed, the connection is disposed but the closeHandler is not always properly called
|
|
21327
|
+
// The language client is then still active but without a proper connection and errors will occurs
|
|
21029
21328
|
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
}
|
|
21329
|
+
|
|
21330
|
+
closeHandler();
|
|
21331
|
+
},
|
|
21332
|
+
shutdown: async () => {
|
|
21333
|
+
// The shutdown should NEVER fail or the connection is not closed and the lsp client is not properly cleaned
|
|
21334
|
+
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3103
|
|
21335
|
+
try {
|
|
21336
|
+
await connection.shutdown();
|
|
21337
|
+
} catch (error) {
|
|
21338
|
+
console.warn('[LSP]', 'Error while shutdown lsp', error);
|
|
21339
|
+
}
|
|
21340
|
+
}
|
|
21033
21341
|
});
|
|
21342
|
+
|
|
21343
|
+
return fixedConnection;
|
|
21034
21344
|
}
|
|
21035
21345
|
|
|
21036
21346
|
const RETRY_DELAY = 3000;
|
|
21037
21347
|
|
|
21038
21348
|
class CGLSPConnectionProvider {
|
|
21039
|
-
constructor(
|
|
21040
|
-
this.serverAddress = serverAddress;
|
|
21349
|
+
constructor(id, infrastructure) {
|
|
21041
21350
|
this.id = id;
|
|
21042
|
-
this.
|
|
21043
|
-
this.libraryUrls = libraryUrls;
|
|
21044
|
-
this.getSecurityToken = getSecurityToken;
|
|
21351
|
+
this.infrastructure = infrastructure;
|
|
21045
21352
|
}
|
|
21046
21353
|
|
|
21047
21354
|
async get(errorHandler, closeHandler) {
|
|
21048
|
-
const onceDelayedCloseHandler = once(() => {
|
|
21355
|
+
const onceDelayedCloseHandler = once$1(() => {
|
|
21049
21356
|
setTimeout(() => {
|
|
21050
21357
|
closeHandler();
|
|
21051
21358
|
}, RETRY_DELAY);
|
|
21052
21359
|
});
|
|
21053
21360
|
|
|
21054
21361
|
try {
|
|
21055
|
-
const
|
|
21056
|
-
|
|
21057
|
-
this.libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
21058
|
-
url.searchParams.append('token', await this.getSecurityToken());
|
|
21059
|
-
return await openConnection(url, errorHandler, onceDelayedCloseHandler);
|
|
21362
|
+
const connection = await this.infrastructure.openConnection(this.id);
|
|
21363
|
+
return await messageConnectionToConnection(connection, errorHandler, onceDelayedCloseHandler);
|
|
21060
21364
|
} catch (err) {
|
|
21061
21365
|
onceDelayedCloseHandler();
|
|
21062
21366
|
throw err;
|
|
@@ -21065,7 +21369,7 @@ class CGLSPConnectionProvider {
|
|
|
21065
21369
|
|
|
21066
21370
|
}
|
|
21067
21371
|
|
|
21068
|
-
function createLanguageClient(id,
|
|
21372
|
+
function createLanguageClient(id, infrastructure, _ref, errorHandler, middleware) {
|
|
21069
21373
|
let {
|
|
21070
21374
|
documentSelector,
|
|
21071
21375
|
synchronize,
|
|
@@ -21083,7 +21387,7 @@ function createLanguageClient(id, sessionId, _ref, languageServerAddress, getSec
|
|
|
21083
21387
|
synchronize,
|
|
21084
21388
|
initializationOptions
|
|
21085
21389
|
},
|
|
21086
|
-
connectionProvider: new CGLSPConnectionProvider(
|
|
21390
|
+
connectionProvider: new CGLSPConnectionProvider(id, infrastructure)
|
|
21087
21391
|
});
|
|
21088
21392
|
client.registerProposedFeatures();
|
|
21089
21393
|
registerExtensionFeatures(client, id);
|
|
@@ -21091,14 +21395,10 @@ function createLanguageClient(id, sessionId, _ref, languageServerAddress, getSec
|
|
|
21091
21395
|
}
|
|
21092
21396
|
|
|
21093
21397
|
class LanguageClientManager {
|
|
21094
|
-
constructor(id,
|
|
21398
|
+
constructor(id, languageServerOptions, infrastructure) {
|
|
21095
21399
|
this.id = id;
|
|
21096
|
-
this.sessionId = sessionId;
|
|
21097
|
-
this.languageServerAddress = languageServerAddress;
|
|
21098
|
-
this.getSecurityToken = getSecurityToken;
|
|
21099
21400
|
this.languageServerOptions = languageServerOptions;
|
|
21100
|
-
this.
|
|
21101
|
-
this.useMutualizedProxy = useMutualizedProxy;
|
|
21401
|
+
this.infrastructure = infrastructure;
|
|
21102
21402
|
|
|
21103
21403
|
_defineProperty(this, "languageClient", void 0);
|
|
21104
21404
|
|
|
@@ -21185,7 +21485,7 @@ class LanguageClientManager {
|
|
|
21185
21485
|
|
|
21186
21486
|
async start() {
|
|
21187
21487
|
try {
|
|
21188
|
-
await loadExtensionConfigurations([this.id], this.useMutualizedProxy);
|
|
21488
|
+
await loadExtensionConfigurations([this.id], this.infrastructure.useMutualizedProxy);
|
|
21189
21489
|
} catch (error) {
|
|
21190
21490
|
console.error('Unable to load extension configuration', error);
|
|
21191
21491
|
}
|
|
@@ -21199,7 +21499,7 @@ class LanguageClientManager {
|
|
|
21199
21499
|
var _this$languageServerO;
|
|
21200
21500
|
|
|
21201
21501
|
const onServerResponse = new lib$1.Emitter();
|
|
21202
|
-
const languageClient = createLanguageClient(this.id, this.
|
|
21502
|
+
const languageClient = createLanguageClient(this.id, this.infrastructure, this.languageServerOptions, {
|
|
21203
21503
|
error: this.handleError,
|
|
21204
21504
|
closed: this.handleClose
|
|
21205
21505
|
}, _objectSpread2(_objectSpread2({}, (_this$languageServerO = this.languageServerOptions.middleware) !== null && _this$languageServerO !== void 0 ? _this$languageServerO : {}), {}, {
|
|
@@ -21315,15 +21615,20 @@ class LanguageClientManager {
|
|
|
21315
21615
|
}
|
|
21316
21616
|
});
|
|
21317
21617
|
this.languageClient.registerFeature(new WillDisposeFeature(this.languageClient, this.onWillShutdownEmitter));
|
|
21618
|
+
|
|
21619
|
+
if (!this.infrastructure.automaticTextDocumentUpdate) {
|
|
21620
|
+
this.languageClient.registerFeature(new InitializeTextDocumentFeature(this));
|
|
21621
|
+
}
|
|
21622
|
+
|
|
21318
21623
|
this.languageClient.start();
|
|
21319
21624
|
}
|
|
21320
21625
|
|
|
21321
|
-
sendNotification(
|
|
21322
|
-
this.languageClient.sendNotification(
|
|
21626
|
+
sendNotification(type, params) {
|
|
21627
|
+
this.languageClient.sendNotification(type, params);
|
|
21323
21628
|
}
|
|
21324
21629
|
|
|
21325
|
-
sendRequest(
|
|
21326
|
-
return this.languageClient.sendRequest(
|
|
21630
|
+
sendRequest(type, params) {
|
|
21631
|
+
return this.languageClient.sendRequest(type, params);
|
|
21327
21632
|
}
|
|
21328
21633
|
|
|
21329
21634
|
}
|
|
@@ -21331,17 +21636,12 @@ const languageClientManagerByLanguageId = {};
|
|
|
21331
21636
|
/**
|
|
21332
21637
|
* Create a language client manager
|
|
21333
21638
|
* @param id The predefined id of the language client
|
|
21334
|
-
* @param
|
|
21335
|
-
* @param
|
|
21336
|
-
* @param getSecurityToken A function which returns a valid JWT token to use to connect to the server
|
|
21337
|
-
* @param libraryUrls A list of urls which link to zip files containing libraries/resources
|
|
21338
|
-
* @param useMutualizedProxy The language server proxy is used, so we only need to load configurations for language servers which are not mutualized
|
|
21639
|
+
* @param infrastructure The infrastructure to use
|
|
21640
|
+
* @param parameters the infrastructure parameters
|
|
21339
21641
|
* @returns A language client manager
|
|
21340
21642
|
*/
|
|
21341
21643
|
|
|
21342
|
-
function createLanguageClientManager(id,
|
|
21343
|
-
let useMutualizedProxy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : languageServerAddress.includes('mutualized');
|
|
21344
|
-
|
|
21644
|
+
function createLanguageClientManager(id, infrastructure) {
|
|
21345
21645
|
if (languageClientManagerByLanguageId[id] != null) {
|
|
21346
21646
|
throw new Error("Language client for language ".concat(id, " already started"));
|
|
21347
21647
|
}
|
|
@@ -21352,7 +21652,7 @@ function createLanguageClientManager(id, sessionId, languageServerAddress, getSe
|
|
|
21352
21652
|
throw new Error("Unknown ".concat(id, " language server"));
|
|
21353
21653
|
}
|
|
21354
21654
|
|
|
21355
|
-
if (useMutualizedProxy && languageServerOptions.mutualizable) {
|
|
21655
|
+
if (infrastructure.useMutualizedProxy && languageServerOptions.mutualizable) {
|
|
21356
21656
|
// When using the mutualized proxy, we don't need to synchronize the configuration nor send the initialization options
|
|
21357
21657
|
languageServerOptions = _objectSpread2(_objectSpread2({}, languageServerOptions), {}, {
|
|
21358
21658
|
synchronize: undefined,
|
|
@@ -21360,34 +21660,32 @@ function createLanguageClientManager(id, sessionId, languageServerAddress, getSe
|
|
|
21360
21660
|
});
|
|
21361
21661
|
}
|
|
21362
21662
|
|
|
21363
|
-
installServices();
|
|
21364
|
-
const
|
|
21663
|
+
const services = installServices(infrastructure);
|
|
21664
|
+
const disposableCollection = new lib$1.DisposableCollection();
|
|
21665
|
+
const languageClientManager = new LanguageClientManager(id, languageServerOptions, infrastructure);
|
|
21365
21666
|
languageClientManagerByLanguageId[id] = languageClientManager;
|
|
21366
|
-
|
|
21667
|
+
disposableCollection.push(lib$1.Disposable.create(() => {
|
|
21668
|
+
delete languageClientManagerByLanguageId[id];
|
|
21669
|
+
}));
|
|
21670
|
+
disposableCollection.push(registerTextModelContentProvider('file', {
|
|
21367
21671
|
async provideTextContent(resource) {
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
return monaco.editor.createModel(content, undefined, resource);
|
|
21371
|
-
} catch (error) {
|
|
21372
|
-
// file not found
|
|
21373
|
-
return null;
|
|
21374
|
-
}
|
|
21672
|
+
const content = await infrastructure.getFileContent(resource, languageClientManager);
|
|
21673
|
+
return content != null ? monaco.editor.createModel(content, undefined, resource) : null;
|
|
21375
21674
|
}
|
|
21376
21675
|
|
|
21377
|
-
});
|
|
21676
|
+
}));
|
|
21677
|
+
disposableCollection.push(services.workspace.registerSaveDocumentHandler({
|
|
21678
|
+
async saveTextContent(textDocument, reason) {
|
|
21679
|
+
var _infrastructure$saveF;
|
|
21680
|
+
|
|
21681
|
+
await ((_infrastructure$saveF = infrastructure.saveFileContent) === null || _infrastructure$saveF === void 0 ? void 0 : _infrastructure$saveF.call(infrastructure, textDocument, reason, languageClientManager));
|
|
21682
|
+
}
|
|
21683
|
+
|
|
21684
|
+
}));
|
|
21378
21685
|
languageClientManager.onWillClose(() => {
|
|
21379
|
-
|
|
21380
|
-
textModelContentProviderDisposable.dispose();
|
|
21686
|
+
disposableCollection.dispose();
|
|
21381
21687
|
});
|
|
21382
21688
|
return languageClientManager;
|
|
21383
21689
|
}
|
|
21384
21690
|
|
|
21385
|
-
|
|
21386
|
-
return Object.values(languageClientManagerByLanguageId);
|
|
21387
|
-
}
|
|
21388
|
-
|
|
21389
|
-
function getAllLanguageClientManagersByTextDocument(textDocument) {
|
|
21390
|
-
return getAllLanguageClientManagers().filter(manager => manager.isModelManaged(textDocument));
|
|
21391
|
-
}
|
|
21392
|
-
|
|
21393
|
-
export { LanguageClientManager, createLanguageClientManager, loadExtensionConfigurations, registerLanguageClient };
|
|
21691
|
+
export { CodinGameInfrastructure, LanguageClientManager, createLanguageClientManager, loadExtensionConfigurations, registerLanguageClient };
|