@codingame/monaco-languageclient-wrapper 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +6839 -202
- package/dist/index.js +952 -662
- 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: {
|
|
@@ -20152,83 +20371,473 @@ function _defineProperty(obj, key, value) {
|
|
|
20152
20371
|
return obj;
|
|
20153
20372
|
}
|
|
20154
20373
|
|
|
20155
|
-
var
|
|
20156
|
-
|
|
20157
|
-
// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15
|
|
20158
|
-
const randomInteger = (minimum, maximum) => Math.floor((Math.random() * (maximum - minimum + 1)) + minimum);
|
|
20159
|
-
|
|
20160
|
-
const createAbortError = () => {
|
|
20161
|
-
const error = new Error('Delay aborted');
|
|
20162
|
-
error.name = 'AbortError';
|
|
20163
|
-
return error;
|
|
20164
|
-
};
|
|
20374
|
+
var lib = {};
|
|
20165
20375
|
|
|
20166
|
-
|
|
20167
|
-
if (signal && signal.aborted) {
|
|
20168
|
-
return Promise.reject(createAbortError());
|
|
20169
|
-
}
|
|
20376
|
+
var disposable = {};
|
|
20170
20377
|
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
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;
|
|
20175
20410
|
|
|
20176
|
-
|
|
20177
|
-
clear(timeoutId);
|
|
20178
|
-
rejectFn(createAbortError());
|
|
20179
|
-
};
|
|
20411
|
+
}(disposable));
|
|
20180
20412
|
|
|
20181
|
-
|
|
20182
|
-
if (signal) {
|
|
20183
|
-
signal.removeEventListener('abort', signalListener);
|
|
20184
|
-
}
|
|
20185
|
-
};
|
|
20413
|
+
var socket$1 = {};
|
|
20186
20414
|
|
|
20187
|
-
|
|
20188
|
-
settle = () => {
|
|
20189
|
-
cleanup();
|
|
20190
|
-
if (willResolve) {
|
|
20191
|
-
resolve(value);
|
|
20192
|
-
} else {
|
|
20193
|
-
reject(value);
|
|
20194
|
-
}
|
|
20195
|
-
};
|
|
20415
|
+
var socket = {};
|
|
20196
20416
|
|
|
20197
|
-
|
|
20198
|
-
timeoutId = (set || setTimeout)(settle, ms);
|
|
20199
|
-
});
|
|
20417
|
+
Object.defineProperty(socket, "__esModule", { value: true });
|
|
20200
20418
|
|
|
20201
|
-
|
|
20202
|
-
signal.addEventListener('abort', signalListener, {once: true});
|
|
20203
|
-
}
|
|
20419
|
+
var reader = {};
|
|
20204
20420
|
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
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;
|
|
20210
20500
|
|
|
20211
|
-
|
|
20212
|
-
};
|
|
20501
|
+
var writer = {};
|
|
20213
20502
|
|
|
20214
|
-
|
|
20215
|
-
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
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
|
+
});
|
|
20219
20515
|
};
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
|
|
20231
|
-
|
|
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
|
+
* A function which returns a valid JWT token to use to connect to the server
|
|
20710
|
+
*/
|
|
20711
|
+
getSecurityToken,
|
|
20712
|
+
/**
|
|
20713
|
+
* An optional sessionId when connecting to the session-mutualized server
|
|
20714
|
+
*/
|
|
20715
|
+
sessionId,
|
|
20716
|
+
/**
|
|
20717
|
+
* A list of urls which link to zip files containing libraries/resources
|
|
20718
|
+
*/
|
|
20719
|
+
libraryUrls) {
|
|
20720
|
+
this.serverAddress = serverAddress;
|
|
20721
|
+
this.useMutualizedProxy = useMutualizedProxy;
|
|
20722
|
+
this.getSecurityToken = getSecurityToken;
|
|
20723
|
+
this.sessionId = sessionId;
|
|
20724
|
+
this.libraryUrls = libraryUrls;
|
|
20725
|
+
|
|
20726
|
+
_defineProperty(this, "automaticTextDocumentUpdate", false);
|
|
20727
|
+
|
|
20728
|
+
_defineProperty(this, "rootUri", 'file:///tmp/project');
|
|
20729
|
+
|
|
20730
|
+
_defineProperty(this, "workspaceFolders", [{
|
|
20731
|
+
uri: monaco.Uri.file('/tmp/project'),
|
|
20732
|
+
index: 0,
|
|
20733
|
+
name: 'main'
|
|
20734
|
+
}]);
|
|
20735
|
+
}
|
|
20736
|
+
|
|
20737
|
+
async saveFileContent(document, reason, languageClient) {
|
|
20738
|
+
if (languageClient.isReady()) {
|
|
20739
|
+
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
20740
|
+
}
|
|
20741
|
+
}
|
|
20742
|
+
|
|
20743
|
+
async getFileContent(resource, languageClient) {
|
|
20744
|
+
try {
|
|
20745
|
+
return (await getFile(resource.toString(true), languageClient)).text;
|
|
20746
|
+
} catch (error) {
|
|
20747
|
+
console.error('File not found', resource.toString());
|
|
20748
|
+
return null;
|
|
20749
|
+
}
|
|
20750
|
+
}
|
|
20751
|
+
|
|
20752
|
+
async openConnection(id) {
|
|
20753
|
+
var _this$libraryUrls;
|
|
20754
|
+
|
|
20755
|
+
const url = new URL(this.sessionId != null ? "run/".concat(this.sessionId, "/").concat(id) : "run/".concat(id), this.serverAddress);
|
|
20756
|
+
(_this$libraryUrls = this.libraryUrls) === null || _this$libraryUrls === void 0 ? void 0 : _this$libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
20757
|
+
url.searchParams.append('token', await this.getSecurityToken());
|
|
20758
|
+
const connection = await openWebsocketConnection(url);
|
|
20759
|
+
return connection;
|
|
20760
|
+
}
|
|
20761
|
+
|
|
20762
|
+
}
|
|
20763
|
+
|
|
20764
|
+
var delay$2 = {exports: {}};
|
|
20765
|
+
|
|
20766
|
+
// From https://github.com/sindresorhus/random-int/blob/c37741b56f76b9160b0b63dae4e9c64875128146/index.js#L13-L15
|
|
20767
|
+
const randomInteger = (minimum, maximum) => Math.floor((Math.random() * (maximum - minimum + 1)) + minimum);
|
|
20768
|
+
|
|
20769
|
+
const createAbortError = () => {
|
|
20770
|
+
const error = new Error('Delay aborted');
|
|
20771
|
+
error.name = 'AbortError';
|
|
20772
|
+
return error;
|
|
20773
|
+
};
|
|
20774
|
+
|
|
20775
|
+
const createDelay = ({clearTimeout: defaultClear, setTimeout: set, willResolve}) => (ms, {value, signal} = {}) => {
|
|
20776
|
+
if (signal && signal.aborted) {
|
|
20777
|
+
return Promise.reject(createAbortError());
|
|
20778
|
+
}
|
|
20779
|
+
|
|
20780
|
+
let timeoutId;
|
|
20781
|
+
let settle;
|
|
20782
|
+
let rejectFn;
|
|
20783
|
+
const clear = defaultClear || clearTimeout;
|
|
20784
|
+
|
|
20785
|
+
const signalListener = () => {
|
|
20786
|
+
clear(timeoutId);
|
|
20787
|
+
rejectFn(createAbortError());
|
|
20788
|
+
};
|
|
20789
|
+
|
|
20790
|
+
const cleanup = () => {
|
|
20791
|
+
if (signal) {
|
|
20792
|
+
signal.removeEventListener('abort', signalListener);
|
|
20793
|
+
}
|
|
20794
|
+
};
|
|
20795
|
+
|
|
20796
|
+
const delayPromise = new Promise((resolve, reject) => {
|
|
20797
|
+
settle = () => {
|
|
20798
|
+
cleanup();
|
|
20799
|
+
if (willResolve) {
|
|
20800
|
+
resolve(value);
|
|
20801
|
+
} else {
|
|
20802
|
+
reject(value);
|
|
20803
|
+
}
|
|
20804
|
+
};
|
|
20805
|
+
|
|
20806
|
+
rejectFn = reject;
|
|
20807
|
+
timeoutId = (set || setTimeout)(settle, ms);
|
|
20808
|
+
});
|
|
20809
|
+
|
|
20810
|
+
if (signal) {
|
|
20811
|
+
signal.addEventListener('abort', signalListener, {once: true});
|
|
20812
|
+
}
|
|
20813
|
+
|
|
20814
|
+
delayPromise.clear = () => {
|
|
20815
|
+
clear(timeoutId);
|
|
20816
|
+
timeoutId = null;
|
|
20817
|
+
settle();
|
|
20818
|
+
};
|
|
20819
|
+
|
|
20820
|
+
return delayPromise;
|
|
20821
|
+
};
|
|
20822
|
+
|
|
20823
|
+
const createWithTimers = clearAndSet => {
|
|
20824
|
+
const delay = createDelay({...clearAndSet, willResolve: true});
|
|
20825
|
+
delay.reject = createDelay({...clearAndSet, willResolve: false});
|
|
20826
|
+
delay.range = (minimum, maximum, options) => delay(randomInteger(minimum, maximum), options);
|
|
20827
|
+
return delay;
|
|
20828
|
+
};
|
|
20829
|
+
|
|
20830
|
+
const delay = createWithTimers();
|
|
20831
|
+
delay.createWithTimers = createWithTimers;
|
|
20832
|
+
|
|
20833
|
+
delay$2.exports = delay;
|
|
20834
|
+
// TODO: Remove this for the next major release
|
|
20835
|
+
delay$2.exports.default = delay;
|
|
20836
|
+
|
|
20837
|
+
var delay$1 = delay$2.exports;
|
|
20838
|
+
|
|
20839
|
+
class WatchableOutputChannel {
|
|
20840
|
+
constructor(name) {
|
|
20232
20841
|
_defineProperty(this, "logs", '');
|
|
20233
20842
|
|
|
20234
20843
|
_defineProperty(this, "name", void 0);
|
|
@@ -20336,497 +20945,208 @@ class WatchableConsoleWindow {
|
|
|
20336
20945
|
this.channels.delete(name);
|
|
20337
20946
|
this.onDidChangeChannelsEmitter.fire();
|
|
20338
20947
|
});
|
|
20339
|
-
this.channels.set(name, channel);
|
|
20340
|
-
this.onDidChangeChannelsEmitter.fire();
|
|
20341
|
-
}
|
|
20342
|
-
|
|
20343
|
-
return channel;
|
|
20344
|
-
}
|
|
20345
|
-
|
|
20346
|
-
get onDidChangeChannels() {
|
|
20347
|
-
return this.onDidChangeChannelsEmitter.event;
|
|
20348
|
-
}
|
|
20349
|
-
|
|
20350
|
-
}
|
|
20351
|
-
|
|
20352
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20353
|
-
|
|
20354
|
-
function lookUp(tree, key) {
|
|
20355
|
-
const parts = key.split('.');
|
|
20356
|
-
let node = tree;
|
|
20357
|
-
|
|
20358
|
-
for (let i = 0; node != null && i < parts.length; i++) {
|
|
20359
|
-
node = node[parts[i]];
|
|
20360
|
-
}
|
|
20361
|
-
|
|
20362
|
-
return node;
|
|
20363
|
-
}
|
|
20364
|
-
|
|
20365
|
-
class MemoryWorkspaceConfiguration {
|
|
20366
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20367
|
-
constructor(config) {
|
|
20368
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20369
|
-
const thisConfig = this;
|
|
20370
|
-
|
|
20371
|
-
for (const key of Object.keys(config !== null && config !== void 0 ? config : {})) {
|
|
20372
|
-
thisConfig[key] = config[key];
|
|
20373
|
-
}
|
|
20374
|
-
}
|
|
20375
|
-
|
|
20376
|
-
get(section, defaultValue) {
|
|
20377
|
-
var _lookUp;
|
|
20378
|
-
|
|
20379
|
-
return (_lookUp = lookUp(this, section)) !== null && _lookUp !== void 0 ? _lookUp : defaultValue;
|
|
20380
|
-
}
|
|
20381
|
-
|
|
20382
|
-
has(section) {
|
|
20383
|
-
return section in this;
|
|
20384
|
-
}
|
|
20385
|
-
|
|
20386
|
-
toJSON() {
|
|
20387
|
-
return this;
|
|
20388
|
-
}
|
|
20389
|
-
|
|
20390
|
-
}
|
|
20391
|
-
|
|
20392
|
-
const simpleConfigurationService = monaco.extra.StandaloneServices.get(monaco.extra.IConfigurationService);
|
|
20393
|
-
|
|
20394
|
-
class Configuration {
|
|
20395
|
-
constructor() {
|
|
20396
|
-
_defineProperty(this, "onDidChangeConfigurationEmitter", new lib$1.Emitter());
|
|
20397
|
-
}
|
|
20398
|
-
|
|
20399
|
-
getConfiguration(section, resource) {
|
|
20400
|
-
return new MemoryWorkspaceConfiguration(this.getValue(section, resource));
|
|
20401
|
-
}
|
|
20402
|
-
|
|
20403
|
-
getValue(section, resource) {
|
|
20404
|
-
const override = {
|
|
20405
|
-
resource: resource != null ? monaco.Uri.parse(resource) : null
|
|
20406
|
-
};
|
|
20407
|
-
|
|
20408
|
-
if (section == null) {
|
|
20409
|
-
return simpleConfigurationService.getValue(override);
|
|
20410
|
-
}
|
|
20411
|
-
|
|
20412
|
-
return simpleConfigurationService.getValue(section, override);
|
|
20413
|
-
}
|
|
20414
|
-
|
|
20415
|
-
get onDidChangeConfiguration() {
|
|
20416
|
-
return simpleConfigurationService.onDidChangeConfiguration;
|
|
20417
|
-
}
|
|
20418
|
-
|
|
20419
|
-
}
|
|
20420
|
-
|
|
20421
|
-
function updateFile(uri, text, languageClient) {
|
|
20422
|
-
return languageClient.sendRequest('textDocument/save', {
|
|
20423
|
-
textDocument: {
|
|
20424
|
-
uri,
|
|
20425
|
-
text
|
|
20426
|
-
}
|
|
20427
|
-
});
|
|
20428
|
-
}
|
|
20429
|
-
function getFile(uri, languageClient) {
|
|
20430
|
-
return languageClient.sendRequest('textDocument/get', {
|
|
20431
|
-
textDocument: {
|
|
20432
|
-
uri
|
|
20433
|
-
}
|
|
20434
|
-
});
|
|
20435
|
-
}
|
|
20436
|
-
|
|
20437
|
-
class CodinGameMonacoWorkspace extends lib$1.MonacoWorkspace {
|
|
20438
|
-
constructor(p2m, m2p) {
|
|
20439
|
-
let _rootUri = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20440
|
-
|
|
20441
|
-
super(monaco, p2m, m2p, _rootUri); // "workaround" for https://github.com/TypeFox/monaco-languageclient/pull/199#issuecomment-593414330
|
|
20442
|
-
|
|
20443
|
-
_defineProperty(this, "onWillSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20444
|
-
|
|
20445
|
-
_defineProperty(this, "onDidSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20446
|
-
|
|
20447
|
-
_defineProperty(this, "workspaceFolders", void 0);
|
|
20448
|
-
|
|
20449
|
-
_defineProperty(this, "configurations", new Configuration());
|
|
20450
|
-
|
|
20451
|
-
if (_rootUri != null) {
|
|
20452
|
-
const uri = monaco.Uri.parse(_rootUri);
|
|
20453
|
-
this.workspaceFolders = [{
|
|
20454
|
-
uri,
|
|
20455
|
-
index: 0,
|
|
20456
|
-
name: uri.toString()
|
|
20457
|
-
}];
|
|
20458
|
-
}
|
|
20459
|
-
}
|
|
20460
|
-
|
|
20461
|
-
get onWillSaveTextDocument() {
|
|
20462
|
-
return this.onWillSaveTextDocumentEmitter.event;
|
|
20463
|
-
}
|
|
20464
|
-
|
|
20465
|
-
get onDidSaveTextDocument() {
|
|
20466
|
-
return this.onDidSaveTextDocumentEmitter.event;
|
|
20467
|
-
}
|
|
20468
|
-
|
|
20469
|
-
async saveDocument(document, reason) {
|
|
20470
|
-
this.onWillSaveTextDocumentEmitter.fire({
|
|
20471
|
-
textDocument: document,
|
|
20472
|
-
reason
|
|
20473
|
-
});
|
|
20474
|
-
|
|
20475
|
-
try {
|
|
20476
|
-
await Promise.all(getAllLanguageClientManagersByTextDocument(document).map(async languageClient => {
|
|
20477
|
-
if (languageClient.isReady()) {
|
|
20478
|
-
await updateFile(document.uri.toString(), document.getText(), languageClient);
|
|
20479
|
-
}
|
|
20480
|
-
}));
|
|
20481
|
-
this.onDidSaveTextDocumentEmitter.fire(document);
|
|
20482
|
-
} catch (err) {
|
|
20483
|
-
console.error('[LSP]', 'Unable to save file on language server', err);
|
|
20948
|
+
this.channels.set(name, channel);
|
|
20949
|
+
this.onDidChangeChannelsEmitter.fire();
|
|
20484
20950
|
}
|
|
20951
|
+
|
|
20952
|
+
return channel;
|
|
20953
|
+
}
|
|
20954
|
+
|
|
20955
|
+
get onDidChangeChannels() {
|
|
20956
|
+
return this.onDidChangeChannelsEmitter.event;
|
|
20485
20957
|
}
|
|
20486
20958
|
|
|
20487
20959
|
}
|
|
20488
20960
|
|
|
20489
|
-
|
|
20490
|
-
// Comes from https://github.com/redhat-developer/vscode-java/blob/9b0f0aca80cbefabad4c034fb5dd365d029f6170/src/extension.ts#L155-L160
|
|
20491
|
-
// Other commands needs to be implemented as well?
|
|
20492
|
-
// (https://github.com/eclipse/eclipse.jdt.ls/issues/376#issuecomment-333923685)
|
|
20493
|
-
services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
20494
|
-
if (edit.documentChanges != null && edit.documentChanges.some(change => main$3.RenameFile.is(change) || main$3.CreateFile.is(change))) {
|
|
20495
|
-
alert('Unimplemented command');
|
|
20496
|
-
return;
|
|
20497
|
-
}
|
|
20961
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20498
20962
|
|
|
20499
|
-
|
|
20500
|
-
|
|
20963
|
+
function lookUp(tree, key) {
|
|
20964
|
+
const parts = key.split('.');
|
|
20965
|
+
let node = tree;
|
|
20966
|
+
|
|
20967
|
+
for (let i = 0; node != null && i < parts.length; i++) {
|
|
20968
|
+
node = node[parts[i]];
|
|
20969
|
+
}
|
|
20970
|
+
|
|
20971
|
+
return node;
|
|
20501
20972
|
}
|
|
20502
20973
|
|
|
20503
|
-
|
|
20504
|
-
|
|
20505
|
-
|
|
20506
|
-
|
|
20974
|
+
class MemoryWorkspaceConfiguration {
|
|
20975
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20976
|
+
constructor(config) {
|
|
20977
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20978
|
+
const thisConfig = this;
|
|
20507
20979
|
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
timeoutMap.delete(e.textDocument.uri);
|
|
20980
|
+
for (const key of Object.keys(config !== null && config !== void 0 ? config : {})) {
|
|
20981
|
+
thisConfig[key] = config[key];
|
|
20511
20982
|
}
|
|
20983
|
+
}
|
|
20512
20984
|
|
|
20513
|
-
|
|
20514
|
-
|
|
20515
|
-
services.workspace.saveDocument(e.textDocument, lib$1.TextDocumentSaveReason.AfterDelay).catch(err => {
|
|
20516
|
-
console.error('[LSP]', "Unable to save the document ".concat(e.textDocument.uri.toString()), err);
|
|
20517
|
-
});
|
|
20518
|
-
}, 500));
|
|
20519
|
-
});
|
|
20520
|
-
}
|
|
20985
|
+
get(section, defaultValue) {
|
|
20986
|
+
var _lookUp;
|
|
20521
20987
|
|
|
20522
|
-
|
|
20988
|
+
return (_lookUp = lookUp(this, section)) !== null && _lookUp !== void 0 ? _lookUp : defaultValue;
|
|
20989
|
+
}
|
|
20523
20990
|
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20991
|
+
has(section) {
|
|
20992
|
+
return section in this;
|
|
20993
|
+
}
|
|
20527
20994
|
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
commands: new lib$1.MonacoCommands(monaco),
|
|
20531
|
-
languages: new lib$1.MonacoLanguages(monaco, p2m, m2p),
|
|
20532
|
-
workspace: new CodinGameMonacoWorkspace(p2m, m2p, 'file:///tmp/project'),
|
|
20533
|
-
window: new WatchableConsoleWindow()
|
|
20534
|
-
};
|
|
20535
|
-
lib$1.Services.install(services);
|
|
20536
|
-
installCommands(services);
|
|
20537
|
-
autoSaveModels(services);
|
|
20995
|
+
toJSON() {
|
|
20996
|
+
return this;
|
|
20538
20997
|
}
|
|
20998
|
+
|
|
20539
20999
|
}
|
|
20540
21000
|
|
|
20541
|
-
|
|
21001
|
+
const simpleConfigurationService = monaco.extra.StandaloneServices.get(monaco.extra.IConfigurationService);
|
|
20542
21002
|
|
|
20543
|
-
|
|
21003
|
+
class Configuration {
|
|
21004
|
+
constructor() {
|
|
21005
|
+
_defineProperty(this, "onDidChangeConfigurationEmitter", new lib$1.Emitter());
|
|
21006
|
+
}
|
|
20544
21007
|
|
|
20545
|
-
(
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
this.disposables = [];
|
|
20557
|
-
}
|
|
20558
|
-
dispose() {
|
|
20559
|
-
while (this.disposables.length !== 0) {
|
|
20560
|
-
this.disposables.pop().dispose();
|
|
20561
|
-
}
|
|
20562
|
-
}
|
|
20563
|
-
push(disposable) {
|
|
20564
|
-
const disposables = this.disposables;
|
|
20565
|
-
disposables.push(disposable);
|
|
20566
|
-
return {
|
|
20567
|
-
dispose() {
|
|
20568
|
-
const index = disposables.indexOf(disposable);
|
|
20569
|
-
if (index !== -1) {
|
|
20570
|
-
disposables.splice(index, 1);
|
|
20571
|
-
}
|
|
20572
|
-
}
|
|
20573
|
-
};
|
|
21008
|
+
getConfiguration(section, resource) {
|
|
21009
|
+
return new MemoryWorkspaceConfiguration(this.getValue(section, resource));
|
|
21010
|
+
}
|
|
21011
|
+
|
|
21012
|
+
getValue(section, resource) {
|
|
21013
|
+
const override = {
|
|
21014
|
+
resource: resource != null ? monaco.Uri.parse(resource) : null
|
|
21015
|
+
};
|
|
21016
|
+
|
|
21017
|
+
if (section == null) {
|
|
21018
|
+
return simpleConfigurationService.getValue(override);
|
|
20574
21019
|
}
|
|
20575
|
-
}
|
|
20576
|
-
exports.DisposableCollection = DisposableCollection;
|
|
20577
21020
|
|
|
20578
|
-
|
|
21021
|
+
return simpleConfigurationService.getValue(section, override);
|
|
21022
|
+
}
|
|
20579
21023
|
|
|
20580
|
-
|
|
21024
|
+
get onDidChangeConfiguration() {
|
|
21025
|
+
return simpleConfigurationService.onDidChangeConfiguration;
|
|
21026
|
+
}
|
|
20581
21027
|
|
|
20582
|
-
|
|
21028
|
+
}
|
|
20583
21029
|
|
|
20584
|
-
|
|
21030
|
+
class CodinGameMonacoWorkspace extends lib$1.MonacoWorkspace {
|
|
21031
|
+
constructor(p2m, m2p) {
|
|
21032
|
+
let _rootUri = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
20585
21033
|
|
|
20586
|
-
|
|
21034
|
+
let workspaceFolders = arguments.length > 3 ? arguments[3] : undefined;
|
|
21035
|
+
super(monaco, p2m, m2p, _rootUri); // "workaround" for https://github.com/TypeFox/monaco-languageclient/pull/199#issuecomment-593414330
|
|
20587
21036
|
|
|
20588
|
-
|
|
20589
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20590
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20591
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20592
|
-
Object.defineProperty(reader, "__esModule", { value: true });
|
|
20593
|
-
reader.WebSocketMessageReader = void 0;
|
|
20594
|
-
const messageReader_1 = messageReader;
|
|
20595
|
-
class WebSocketMessageReader extends messageReader_1.AbstractMessageReader {
|
|
20596
|
-
constructor(socket) {
|
|
20597
|
-
super();
|
|
20598
|
-
this.socket = socket;
|
|
20599
|
-
this.state = 'initial';
|
|
20600
|
-
this.events = [];
|
|
20601
|
-
this.socket.onMessage(message => this.readMessage(message));
|
|
20602
|
-
this.socket.onError(error => this.fireError(error));
|
|
20603
|
-
this.socket.onClose((code, reason) => {
|
|
20604
|
-
if (code !== 1000) {
|
|
20605
|
-
const error = {
|
|
20606
|
-
name: '' + code,
|
|
20607
|
-
message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
|
|
20608
|
-
};
|
|
20609
|
-
this.fireError(error);
|
|
20610
|
-
}
|
|
20611
|
-
this.fireClose();
|
|
20612
|
-
});
|
|
20613
|
-
}
|
|
20614
|
-
listen(callback) {
|
|
20615
|
-
if (this.state === 'initial') {
|
|
20616
|
-
this.state = 'listening';
|
|
20617
|
-
this.callback = callback;
|
|
20618
|
-
while (this.events.length !== 0) {
|
|
20619
|
-
const event = this.events.pop();
|
|
20620
|
-
if (event.message) {
|
|
20621
|
-
this.readMessage(event.message);
|
|
20622
|
-
}
|
|
20623
|
-
else if (event.error) {
|
|
20624
|
-
this.fireError(event.error);
|
|
20625
|
-
}
|
|
20626
|
-
else {
|
|
20627
|
-
this.fireClose();
|
|
20628
|
-
}
|
|
20629
|
-
}
|
|
20630
|
-
}
|
|
20631
|
-
return {
|
|
20632
|
-
dispose: () => {
|
|
20633
|
-
if (this.callback === callback) {
|
|
20634
|
-
this.callback = undefined;
|
|
20635
|
-
}
|
|
20636
|
-
}
|
|
20637
|
-
};
|
|
20638
|
-
}
|
|
20639
|
-
readMessage(message) {
|
|
20640
|
-
if (this.state === 'initial') {
|
|
20641
|
-
this.events.splice(0, 0, { message });
|
|
20642
|
-
}
|
|
20643
|
-
else if (this.state === 'listening') {
|
|
20644
|
-
const data = JSON.parse(message);
|
|
20645
|
-
this.callback(data);
|
|
20646
|
-
}
|
|
20647
|
-
}
|
|
20648
|
-
fireError(error) {
|
|
20649
|
-
if (this.state === 'initial') {
|
|
20650
|
-
this.events.splice(0, 0, { error });
|
|
20651
|
-
}
|
|
20652
|
-
else if (this.state === 'listening') {
|
|
20653
|
-
super.fireError(error);
|
|
20654
|
-
}
|
|
20655
|
-
}
|
|
20656
|
-
fireClose() {
|
|
20657
|
-
if (this.state === 'initial') {
|
|
20658
|
-
this.events.splice(0, 0, {});
|
|
20659
|
-
}
|
|
20660
|
-
else if (this.state === 'listening') {
|
|
20661
|
-
super.fireClose();
|
|
20662
|
-
}
|
|
20663
|
-
this.state = 'closed';
|
|
20664
|
-
}
|
|
20665
|
-
}
|
|
20666
|
-
reader.WebSocketMessageReader = WebSocketMessageReader;
|
|
21037
|
+
this.workspaceFolders = workspaceFolders;
|
|
20667
21038
|
|
|
20668
|
-
|
|
21039
|
+
_defineProperty(this, "onWillSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
20669
21040
|
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
};
|
|
20683
|
-
Object.defineProperty(writer, "__esModule", { value: true });
|
|
20684
|
-
writer.WebSocketMessageWriter = void 0;
|
|
20685
|
-
const messageWriter_1 = messageWriter;
|
|
20686
|
-
class WebSocketMessageWriter extends messageWriter_1.AbstractMessageWriter {
|
|
20687
|
-
constructor(socket) {
|
|
20688
|
-
super();
|
|
20689
|
-
this.socket = socket;
|
|
20690
|
-
this.errorCount = 0;
|
|
20691
|
-
}
|
|
20692
|
-
end() {
|
|
20693
|
-
}
|
|
20694
|
-
write(msg) {
|
|
20695
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20696
|
-
try {
|
|
20697
|
-
const content = JSON.stringify(msg);
|
|
20698
|
-
this.socket.send(content);
|
|
20699
|
-
}
|
|
20700
|
-
catch (e) {
|
|
20701
|
-
this.errorCount++;
|
|
20702
|
-
this.fireError(e, msg, this.errorCount);
|
|
20703
|
-
}
|
|
20704
|
-
});
|
|
21041
|
+
_defineProperty(this, "savehandlers", []);
|
|
21042
|
+
|
|
21043
|
+
_defineProperty(this, "onDidSaveTextDocumentEmitter", new lib$1.Emitter());
|
|
21044
|
+
|
|
21045
|
+
_defineProperty(this, "configurations", new Configuration());
|
|
21046
|
+
|
|
21047
|
+
if (this.workspaceFolders == null && _rootUri != null) {
|
|
21048
|
+
const uri = monaco.Uri.parse(_rootUri);
|
|
21049
|
+
this.workspaceFolders = [{
|
|
21050
|
+
uri,
|
|
21051
|
+
index: 0,
|
|
21052
|
+
name: uri.toString()
|
|
21053
|
+
}];
|
|
20705
21054
|
}
|
|
20706
|
-
}
|
|
20707
|
-
writer.WebSocketMessageWriter = WebSocketMessageWriter;
|
|
21055
|
+
}
|
|
20708
21056
|
|
|
20709
|
-
|
|
21057
|
+
get onWillSaveTextDocument() {
|
|
21058
|
+
return this.onWillSaveTextDocumentEmitter.event;
|
|
21059
|
+
}
|
|
20710
21060
|
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20715
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20716
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20717
|
-
const vscode_jsonrpc_1 = main$2;
|
|
20718
|
-
const reader_1 = reader;
|
|
20719
|
-
const writer_1 = writer;
|
|
20720
|
-
function createWebSocketConnection(socket, logger) {
|
|
20721
|
-
const messageReader = new reader_1.WebSocketMessageReader(socket);
|
|
20722
|
-
const messageWriter = new writer_1.WebSocketMessageWriter(socket);
|
|
20723
|
-
const connection = vscode_jsonrpc_1.createMessageConnection(messageReader, messageWriter, logger);
|
|
20724
|
-
connection.onClose(() => connection.dispose());
|
|
20725
|
-
return connection;
|
|
20726
|
-
}
|
|
20727
|
-
connection$1.createWebSocketConnection = createWebSocketConnection;
|
|
21061
|
+
get onDidSaveTextDocument() {
|
|
21062
|
+
return this.onDidSaveTextDocumentEmitter.event;
|
|
21063
|
+
}
|
|
20728
21064
|
|
|
20729
|
-
(
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
}) : (function(o, m, k, k2) {
|
|
20734
|
-
if (k2 === undefined) k2 = k;
|
|
20735
|
-
o[k2] = m[k];
|
|
20736
|
-
}));
|
|
20737
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20738
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20739
|
-
};
|
|
20740
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20741
|
-
/* --------------------------------------------------------------------------------------------
|
|
20742
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20743
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20744
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20745
|
-
__exportStar(socket, exports);
|
|
20746
|
-
__exportStar(reader, exports);
|
|
20747
|
-
__exportStar(writer, exports);
|
|
20748
|
-
__exportStar(connection$1, exports);
|
|
21065
|
+
registerSaveDocumentHandler(handler) {
|
|
21066
|
+
this.savehandlers.push(handler);
|
|
21067
|
+
return lib$1.Disposable.create(() => {
|
|
21068
|
+
const index = this.savehandlers.indexOf(handler);
|
|
20749
21069
|
|
|
20750
|
-
|
|
21070
|
+
if (index >= 0) {
|
|
21071
|
+
this.savehandlers.splice(index, 1);
|
|
21072
|
+
}
|
|
21073
|
+
});
|
|
21074
|
+
}
|
|
20751
21075
|
|
|
20752
|
-
|
|
21076
|
+
async saveDocument(document, reason) {
|
|
21077
|
+
this.onWillSaveTextDocumentEmitter.fire({
|
|
21078
|
+
textDocument: document,
|
|
21079
|
+
reason
|
|
21080
|
+
});
|
|
20753
21081
|
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
}
|
|
20760
|
-
|
|
20761
|
-
console.warn(message);
|
|
20762
|
-
}
|
|
20763
|
-
info(message) {
|
|
20764
|
-
console.info(message);
|
|
20765
|
-
}
|
|
20766
|
-
log(message) {
|
|
20767
|
-
console.log(message);
|
|
21082
|
+
try {
|
|
21083
|
+
await Promise.all(this.savehandlers.map(handler => {
|
|
21084
|
+
return handler.saveTextContent(document, reason);
|
|
21085
|
+
}));
|
|
21086
|
+
this.onDidSaveTextDocumentEmitter.fire(document);
|
|
21087
|
+
} catch (err) {
|
|
21088
|
+
console.error('[LSP]', 'Unable to save file on language server', err);
|
|
20768
21089
|
}
|
|
20769
|
-
|
|
20770
|
-
|
|
21090
|
+
}
|
|
21091
|
+
|
|
21092
|
+
}
|
|
21093
|
+
|
|
21094
|
+
function installCommands(services) {
|
|
21095
|
+
// Comes from https://github.com/redhat-developer/vscode-java/blob/9b0f0aca80cbefabad4c034fb5dd365d029f6170/src/extension.ts#L155-L160
|
|
21096
|
+
// Other commands needs to be implemented as well?
|
|
21097
|
+
// (https://github.com/eclipse/eclipse.jdt.ls/issues/376#issuecomment-333923685)
|
|
21098
|
+
services.commands.registerCommand('java.apply.workspaceEdit', edit => {
|
|
21099
|
+
if (edit.documentChanges != null && edit.documentChanges.some(change => main$3.RenameFile.is(change) || main$3.CreateFile.is(change))) {
|
|
21100
|
+
alert('Unimplemented command');
|
|
21101
|
+
return;
|
|
20771
21102
|
}
|
|
21103
|
+
|
|
21104
|
+
return services.workspace.applyEdit(edit);
|
|
21105
|
+
});
|
|
20772
21106
|
}
|
|
20773
|
-
logger.ConsoleLogger = ConsoleLogger;
|
|
20774
21107
|
|
|
20775
|
-
|
|
21108
|
+
function autoSaveModels(services) {
|
|
21109
|
+
const timeoutMap = new Map();
|
|
21110
|
+
services.workspace.onDidChangeTextDocument(e => {
|
|
21111
|
+
const timeout = timeoutMap.get(e.textDocument.uri);
|
|
20776
21112
|
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
21113
|
+
if (timeout != null) {
|
|
21114
|
+
window.clearTimeout(timeout);
|
|
21115
|
+
timeoutMap.delete(e.textDocument.uri);
|
|
21116
|
+
}
|
|
21117
|
+
|
|
21118
|
+
timeoutMap.set(e.textDocument.uri, window.setTimeout(() => {
|
|
21119
|
+
timeoutMap.delete(e.textDocument.uri);
|
|
21120
|
+
services.workspace.saveDocument(e.textDocument, lib$1.TextDocumentSaveReason.AfterDelay).catch(err => {
|
|
21121
|
+
console.error('[LSP]', "Unable to save the document ".concat(e.textDocument.uri.toString()), err);
|
|
21122
|
+
});
|
|
21123
|
+
}, 500));
|
|
21124
|
+
});
|
|
20789
21125
|
}
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
21126
|
+
|
|
21127
|
+
let services = null;
|
|
21128
|
+
|
|
21129
|
+
function installServices(infrastructure) {
|
|
21130
|
+
const m2p = new lib$1.MonacoToProtocolConverter(monaco);
|
|
21131
|
+
const p2m = new lib$1.ProtocolToMonacoConverter(monaco);
|
|
21132
|
+
|
|
21133
|
+
if (services == null) {
|
|
21134
|
+
services = {
|
|
21135
|
+
commands: new lib$1.MonacoCommands(monaco),
|
|
21136
|
+
languages: new lib$1.MonacoLanguages(monaco, p2m, m2p),
|
|
21137
|
+
workspace: new CodinGameMonacoWorkspace(p2m, m2p, infrastructure.rootUri, infrastructure.workspaceFolders),
|
|
21138
|
+
window: new WatchableConsoleWindow()
|
|
20802
21139
|
};
|
|
20803
|
-
|
|
20804
|
-
|
|
21140
|
+
lib$1.Services.install(services);
|
|
21141
|
+
installCommands(services);
|
|
20805
21142
|
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
}) : (function(o, m, k, k2) {
|
|
20811
|
-
if (k2 === undefined) k2 = k;
|
|
20812
|
-
o[k2] = m[k];
|
|
20813
|
-
}));
|
|
20814
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
20815
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20816
|
-
};
|
|
20817
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20818
|
-
/* --------------------------------------------------------------------------------------------
|
|
20819
|
-
* Copyright (c) 2018 TypeFox GmbH (http://www.typefox.io). All rights reserved.
|
|
20820
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
20821
|
-
* ------------------------------------------------------------------------------------------ */
|
|
20822
|
-
__exportStar(main$2, exports);
|
|
20823
|
-
__exportStar(messages$1, exports);
|
|
20824
|
-
__exportStar(disposable, exports);
|
|
20825
|
-
__exportStar(socket$1, exports);
|
|
20826
|
-
__exportStar(logger, exports);
|
|
20827
|
-
__exportStar(connection, exports);
|
|
21143
|
+
if (!infrastructure.automaticTextDocumentUpdate) {
|
|
21144
|
+
autoSaveModels(services);
|
|
21145
|
+
}
|
|
21146
|
+
}
|
|
20828
21147
|
|
|
20829
|
-
|
|
21148
|
+
return services;
|
|
21149
|
+
}
|
|
20830
21150
|
|
|
20831
21151
|
// Initialize the file content into the lsp server for implementations that don't support open/close notifications
|
|
20832
21152
|
class InitializeTextDocumentFeature {
|
|
@@ -20890,10 +21210,10 @@ class CobolResolveSubroutineFeature {
|
|
|
20890
21210
|
|
|
20891
21211
|
initialize(capabilities, documentSelector) {
|
|
20892
21212
|
this.onRequestDisposable = this.languageClient.onRequest('cobol/resolveSubroutine', routineName => {
|
|
20893
|
-
var _Services$get$workspa;
|
|
21213
|
+
var _Services$get$workspa, _Services$get$workspa2;
|
|
20894
21214
|
|
|
20895
21215
|
const constantRoutinePaths = {
|
|
20896
|
-
'assert-equals': 'file:/tmp/project/deps/assert-equals.cbl
|
|
21216
|
+
'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")
|
|
20897
21217
|
};
|
|
20898
21218
|
const contantRoutinePath = constantRoutinePaths[routineName.toLowerCase()];
|
|
20899
21219
|
|
|
@@ -20901,7 +21221,7 @@ class CobolResolveSubroutineFeature {
|
|
|
20901
21221
|
return contantRoutinePath;
|
|
20902
21222
|
}
|
|
20903
21223
|
|
|
20904
|
-
return (_Services$get$
|
|
21224
|
+
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;
|
|
20905
21225
|
});
|
|
20906
21226
|
}
|
|
20907
21227
|
|
|
@@ -20914,13 +21234,10 @@ class CobolResolveSubroutineFeature {
|
|
|
20914
21234
|
}
|
|
20915
21235
|
|
|
20916
21236
|
function registerExtensionFeatures(client, language) {
|
|
20917
|
-
client.registerFeature(new InitializeTextDocumentFeature(client));
|
|
20918
|
-
|
|
20919
21237
|
if (language === 'cobol') {
|
|
20920
21238
|
client.registerFeature(new CobolResolveSubroutineFeature(client));
|
|
20921
21239
|
}
|
|
20922
21240
|
}
|
|
20923
|
-
const willShutdownNotificationType = new lib$1.ProtocolNotificationType('willShutdown');
|
|
20924
21241
|
class WillDisposeFeature {
|
|
20925
21242
|
constructor(languageClient, onWillShutdownEmitter) {
|
|
20926
21243
|
this.languageClient = languageClient;
|
|
@@ -20939,131 +21256,110 @@ class WillDisposeFeature {
|
|
|
20939
21256
|
|
|
20940
21257
|
}
|
|
20941
21258
|
|
|
20942
|
-
async function
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
webSocket.onopen = () => {
|
|
20947
|
-
const socket = lib.toSocket(webSocket);
|
|
20948
|
-
const webSocketConnection = lib.createWebSocketConnection(socket, new lib.ConsoleLogger());
|
|
20949
|
-
webSocketConnection.onDispose(() => {
|
|
20950
|
-
webSocket.close();
|
|
20951
|
-
});
|
|
20952
|
-
const connection = lib$1.createConnection(webSocketConnection, errorHandler, closeHandler);
|
|
20953
|
-
const existingRegistrations = new Set();
|
|
20954
|
-
|
|
20955
|
-
const fixedConnection = _objectSpread2(_objectSpread2({}, connection), {}, {
|
|
20956
|
-
initialize: params => {
|
|
20957
|
-
var _params$rootPath;
|
|
20958
|
-
|
|
20959
|
-
// Hack to fix url converted from /toto/tata to \\toto\tata in windows
|
|
20960
|
-
const rootPath = (_params$rootPath = params.rootPath) === null || _params$rootPath === void 0 ? void 0 : _params$rootPath.replace(/\\/g, '/');
|
|
20961
|
-
|
|
20962
|
-
const fixedParams = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
20963
|
-
rootPath: rootPath,
|
|
20964
|
-
rootUri: rootPath != null ? Uri.from({
|
|
20965
|
-
scheme: 'file',
|
|
20966
|
-
path: rootPath
|
|
20967
|
-
}).toString() : null
|
|
20968
|
-
});
|
|
21259
|
+
async function messageConnectionToConnection(messageConnection, errorHandler, closeHandler) {
|
|
21260
|
+
const connection = lib$1.createConnection(messageConnection, errorHandler, closeHandler);
|
|
21261
|
+
const existingRegistrations = new Set();
|
|
20969
21262
|
|
|
20970
|
-
|
|
20971
|
-
|
|
21263
|
+
const fixedConnection = _objectSpread2(_objectSpread2({}, connection), {}, {
|
|
21264
|
+
initialize: params => {
|
|
21265
|
+
var _params$rootPath;
|
|
20972
21266
|
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
args[_key] = arguments[_key];
|
|
20976
|
-
}
|
|
21267
|
+
// Hack to fix url converted from /toto/tata to \\toto\tata in windows
|
|
21268
|
+
const rootPath = (_params$rootPath = params.rootPath) === null || _params$rootPath === void 0 ? void 0 : _params$rootPath.replace(/\\/g, '/');
|
|
20977
21269
|
|
|
20978
|
-
|
|
20979
|
-
|
|
20980
|
-
|
|
21270
|
+
const fixedParams = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
21271
|
+
rootPath: rootPath,
|
|
21272
|
+
rootUri: rootPath != null ? Uri.from({
|
|
21273
|
+
scheme: 'file',
|
|
21274
|
+
path: rootPath
|
|
21275
|
+
}).toString() : null
|
|
21276
|
+
});
|
|
20981
21277
|
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
registrationParams.registrations = registrationParams.registrations.filter(registration => {
|
|
20985
|
-
const alreadyExisting = existingRegistrations.has(registration.id);
|
|
21278
|
+
return connection.initialize(fixedParams);
|
|
21279
|
+
},
|
|
20986
21280
|
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
21281
|
+
onRequest() {
|
|
21282
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21283
|
+
args[_key] = arguments[_key];
|
|
21284
|
+
}
|
|
20990
21285
|
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
existingRegistrations.add(registration.id);
|
|
20995
|
-
});
|
|
20996
|
-
}
|
|
21286
|
+
return connection.onRequest(args[0], function () {
|
|
21287
|
+
// Hack for https://github.com/OmniSharp/omnisharp-roslyn/issues/2119
|
|
21288
|
+
const method = args[0].method;
|
|
20997
21289
|
|
|
20998
|
-
|
|
20999
|
-
|
|
21290
|
+
if (method === lib$1.RegistrationRequest.type.method) {
|
|
21291
|
+
const registrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
21292
|
+
registrationParams.registrations = registrationParams.registrations.filter(registration => {
|
|
21293
|
+
const alreadyExisting = existingRegistrations.has(registration.id);
|
|
21000
21294
|
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
}
|
|
21295
|
+
if (alreadyExisting) {
|
|
21296
|
+
console.warn('Registration already existing', registration.id, registration.method);
|
|
21004
21297
|
}
|
|
21005
21298
|
|
|
21006
|
-
return
|
|
21299
|
+
return !alreadyExisting;
|
|
21007
21300
|
});
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
connection.dispose();
|
|
21013
|
-
} catch (error) {
|
|
21014
|
-
// The dispose should NEVER fail or the lsp client is not properly cleaned
|
|
21015
|
-
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3105
|
|
21016
|
-
console.warn('[LSP]', 'Error while disposing connection', error);
|
|
21017
|
-
} // Hack, when the language client is removed, the connection is disposed but the closeHandler is not always properly called
|
|
21018
|
-
// The language client is then still active but without a proper connection and errors will occurs
|
|
21301
|
+
registrationParams.registrations.forEach(registration => {
|
|
21302
|
+
existingRegistrations.add(registration.id);
|
|
21303
|
+
});
|
|
21304
|
+
}
|
|
21019
21305
|
|
|
21306
|
+
if (method === lib$1.UnregistrationRequest.type.method) {
|
|
21307
|
+
const unregistrationParams = arguments.length <= 0 ? undefined : arguments[0];
|
|
21020
21308
|
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
shutdown: async () => {
|
|
21024
|
-
// The shutdown should NEVER fail or the connection is not closed and the lsp client is not properly cleaned
|
|
21025
|
-
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3103
|
|
21026
|
-
try {
|
|
21027
|
-
await connection.shutdown();
|
|
21028
|
-
} catch (error) {
|
|
21029
|
-
console.warn('[LSP]', 'Error while shutdown lsp', error);
|
|
21309
|
+
for (const unregistration of unregistrationParams.unregisterations) {
|
|
21310
|
+
existingRegistrations.delete(unregistration.id);
|
|
21030
21311
|
}
|
|
21031
21312
|
}
|
|
21313
|
+
|
|
21314
|
+
return args[1](...arguments);
|
|
21032
21315
|
});
|
|
21316
|
+
},
|
|
21033
21317
|
|
|
21034
|
-
|
|
21035
|
-
|
|
21318
|
+
dispose: () => {
|
|
21319
|
+
try {
|
|
21320
|
+
connection.dispose();
|
|
21321
|
+
} catch (error) {
|
|
21322
|
+
// The dispose should NEVER fail or the lsp client is not properly cleaned
|
|
21323
|
+
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3105
|
|
21324
|
+
console.warn('[LSP]', 'Error while disposing connection', error);
|
|
21325
|
+
} // Hack, when the language client is removed, the connection is disposed but the closeHandler is not always properly called
|
|
21326
|
+
// The language client is then still active but without a proper connection and errors will occurs
|
|
21036
21327
|
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
}
|
|
21328
|
+
|
|
21329
|
+
closeHandler();
|
|
21330
|
+
},
|
|
21331
|
+
shutdown: async () => {
|
|
21332
|
+
// The shutdown should NEVER fail or the connection is not closed and the lsp client is not properly cleaned
|
|
21333
|
+
// see https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/client.ts#L3103
|
|
21334
|
+
try {
|
|
21335
|
+
await connection.shutdown();
|
|
21336
|
+
} catch (error) {
|
|
21337
|
+
console.warn('[LSP]', 'Error while shutdown lsp', error);
|
|
21338
|
+
}
|
|
21339
|
+
}
|
|
21040
21340
|
});
|
|
21341
|
+
|
|
21342
|
+
return fixedConnection;
|
|
21041
21343
|
}
|
|
21042
21344
|
|
|
21043
21345
|
const RETRY_DELAY = 3000;
|
|
21044
21346
|
|
|
21045
21347
|
class CGLSPConnectionProvider {
|
|
21046
|
-
constructor(
|
|
21047
|
-
this.serverAddress = serverAddress;
|
|
21348
|
+
constructor(id, infrastructure) {
|
|
21048
21349
|
this.id = id;
|
|
21049
|
-
this.
|
|
21050
|
-
this.libraryUrls = libraryUrls;
|
|
21051
|
-
this.getSecurityToken = getSecurityToken;
|
|
21350
|
+
this.infrastructure = infrastructure;
|
|
21052
21351
|
}
|
|
21053
21352
|
|
|
21054
21353
|
async get(errorHandler, closeHandler) {
|
|
21055
|
-
const onceDelayedCloseHandler = once(() => {
|
|
21354
|
+
const onceDelayedCloseHandler = once$1(() => {
|
|
21056
21355
|
setTimeout(() => {
|
|
21057
21356
|
closeHandler();
|
|
21058
21357
|
}, RETRY_DELAY);
|
|
21059
21358
|
});
|
|
21060
21359
|
|
|
21061
21360
|
try {
|
|
21062
|
-
const
|
|
21063
|
-
|
|
21064
|
-
this.libraryUrls.forEach(libraryUrl => url.searchParams.append('libraryUrl', libraryUrl));
|
|
21065
|
-
url.searchParams.append('token', await this.getSecurityToken());
|
|
21066
|
-
return await openConnection(url, errorHandler, onceDelayedCloseHandler);
|
|
21361
|
+
const connection = await this.infrastructure.openConnection(this.id);
|
|
21362
|
+
return await messageConnectionToConnection(connection, errorHandler, onceDelayedCloseHandler);
|
|
21067
21363
|
} catch (err) {
|
|
21068
21364
|
onceDelayedCloseHandler();
|
|
21069
21365
|
throw err;
|
|
@@ -21072,7 +21368,7 @@ class CGLSPConnectionProvider {
|
|
|
21072
21368
|
|
|
21073
21369
|
}
|
|
21074
21370
|
|
|
21075
|
-
function createLanguageClient(id,
|
|
21371
|
+
function createLanguageClient(id, infrastructure, _ref, errorHandler, middleware) {
|
|
21076
21372
|
let {
|
|
21077
21373
|
documentSelector,
|
|
21078
21374
|
synchronize,
|
|
@@ -21090,7 +21386,7 @@ function createLanguageClient(id, sessionId, _ref, languageServerAddress, getSec
|
|
|
21090
21386
|
synchronize,
|
|
21091
21387
|
initializationOptions
|
|
21092
21388
|
},
|
|
21093
|
-
connectionProvider: new CGLSPConnectionProvider(
|
|
21389
|
+
connectionProvider: new CGLSPConnectionProvider(id, infrastructure)
|
|
21094
21390
|
});
|
|
21095
21391
|
client.registerProposedFeatures();
|
|
21096
21392
|
registerExtensionFeatures(client, id);
|
|
@@ -21098,14 +21394,10 @@ function createLanguageClient(id, sessionId, _ref, languageServerAddress, getSec
|
|
|
21098
21394
|
}
|
|
21099
21395
|
|
|
21100
21396
|
class LanguageClientManager {
|
|
21101
|
-
constructor(id,
|
|
21397
|
+
constructor(id, languageServerOptions, infrastructure) {
|
|
21102
21398
|
this.id = id;
|
|
21103
|
-
this.sessionId = sessionId;
|
|
21104
|
-
this.languageServerAddress = languageServerAddress;
|
|
21105
|
-
this.getSecurityToken = getSecurityToken;
|
|
21106
21399
|
this.languageServerOptions = languageServerOptions;
|
|
21107
|
-
this.
|
|
21108
|
-
this.useMutualizedProxy = useMutualizedProxy;
|
|
21400
|
+
this.infrastructure = infrastructure;
|
|
21109
21401
|
|
|
21110
21402
|
_defineProperty(this, "languageClient", void 0);
|
|
21111
21403
|
|
|
@@ -21192,7 +21484,7 @@ class LanguageClientManager {
|
|
|
21192
21484
|
|
|
21193
21485
|
async start() {
|
|
21194
21486
|
try {
|
|
21195
|
-
await loadExtensionConfigurations([this.id], this.useMutualizedProxy);
|
|
21487
|
+
await loadExtensionConfigurations([this.id], this.infrastructure.useMutualizedProxy);
|
|
21196
21488
|
} catch (error) {
|
|
21197
21489
|
console.error('Unable to load extension configuration', error);
|
|
21198
21490
|
}
|
|
@@ -21206,7 +21498,7 @@ class LanguageClientManager {
|
|
|
21206
21498
|
var _this$languageServerO;
|
|
21207
21499
|
|
|
21208
21500
|
const onServerResponse = new lib$1.Emitter();
|
|
21209
|
-
const languageClient = createLanguageClient(this.id, this.
|
|
21501
|
+
const languageClient = createLanguageClient(this.id, this.infrastructure, this.languageServerOptions, {
|
|
21210
21502
|
error: this.handleError,
|
|
21211
21503
|
closed: this.handleClose
|
|
21212
21504
|
}, _objectSpread2(_objectSpread2({}, (_this$languageServerO = this.languageServerOptions.middleware) !== null && _this$languageServerO !== void 0 ? _this$languageServerO : {}), {}, {
|
|
@@ -21322,15 +21614,20 @@ class LanguageClientManager {
|
|
|
21322
21614
|
}
|
|
21323
21615
|
});
|
|
21324
21616
|
this.languageClient.registerFeature(new WillDisposeFeature(this.languageClient, this.onWillShutdownEmitter));
|
|
21617
|
+
|
|
21618
|
+
if (!this.infrastructure.automaticTextDocumentUpdate) {
|
|
21619
|
+
this.languageClient.registerFeature(new InitializeTextDocumentFeature(this));
|
|
21620
|
+
}
|
|
21621
|
+
|
|
21325
21622
|
this.languageClient.start();
|
|
21326
21623
|
}
|
|
21327
21624
|
|
|
21328
|
-
sendNotification(
|
|
21329
|
-
this.languageClient.sendNotification(
|
|
21625
|
+
sendNotification(type, params) {
|
|
21626
|
+
this.languageClient.sendNotification(type, params);
|
|
21330
21627
|
}
|
|
21331
21628
|
|
|
21332
|
-
sendRequest(
|
|
21333
|
-
return this.languageClient.sendRequest(
|
|
21629
|
+
sendRequest(type, params) {
|
|
21630
|
+
return this.languageClient.sendRequest(type, params);
|
|
21334
21631
|
}
|
|
21335
21632
|
|
|
21336
21633
|
}
|
|
@@ -21338,17 +21635,12 @@ const languageClientManagerByLanguageId = {};
|
|
|
21338
21635
|
/**
|
|
21339
21636
|
* Create a language client manager
|
|
21340
21637
|
* @param id The predefined id of the language client
|
|
21341
|
-
* @param
|
|
21342
|
-
* @param
|
|
21343
|
-
* @param getSecurityToken A function which returns a valid JWT token to use to connect to the server
|
|
21344
|
-
* @param libraryUrls A list of urls which link to zip files containing libraries/resources
|
|
21345
|
-
* @param useMutualizedProxy The language server proxy is used, so we only need to load configurations for language servers which are not mutualized
|
|
21638
|
+
* @param infrastructure The infrastructure to use
|
|
21639
|
+
* @param parameters the infrastructure parameters
|
|
21346
21640
|
* @returns A language client manager
|
|
21347
21641
|
*/
|
|
21348
21642
|
|
|
21349
|
-
function createLanguageClientManager(id,
|
|
21350
|
-
let useMutualizedProxy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : languageServerAddress.includes('mutualized');
|
|
21351
|
-
|
|
21643
|
+
function createLanguageClientManager(id, infrastructure) {
|
|
21352
21644
|
if (languageClientManagerByLanguageId[id] != null) {
|
|
21353
21645
|
throw new Error("Language client for language ".concat(id, " already started"));
|
|
21354
21646
|
}
|
|
@@ -21359,7 +21651,7 @@ function createLanguageClientManager(id, sessionId, languageServerAddress, getSe
|
|
|
21359
21651
|
throw new Error("Unknown ".concat(id, " language server"));
|
|
21360
21652
|
}
|
|
21361
21653
|
|
|
21362
|
-
if (useMutualizedProxy && languageServerOptions.mutualizable) {
|
|
21654
|
+
if (infrastructure.useMutualizedProxy && languageServerOptions.mutualizable) {
|
|
21363
21655
|
// When using the mutualized proxy, we don't need to synchronize the configuration nor send the initialization options
|
|
21364
21656
|
languageServerOptions = _objectSpread2(_objectSpread2({}, languageServerOptions), {}, {
|
|
21365
21657
|
synchronize: undefined,
|
|
@@ -21367,34 +21659,32 @@ function createLanguageClientManager(id, sessionId, languageServerAddress, getSe
|
|
|
21367
21659
|
});
|
|
21368
21660
|
}
|
|
21369
21661
|
|
|
21370
|
-
installServices();
|
|
21371
|
-
const
|
|
21662
|
+
const services = installServices(infrastructure);
|
|
21663
|
+
const disposableCollection = new lib$1.DisposableCollection();
|
|
21664
|
+
const languageClientManager = new LanguageClientManager(id, languageServerOptions, infrastructure);
|
|
21372
21665
|
languageClientManagerByLanguageId[id] = languageClientManager;
|
|
21373
|
-
|
|
21666
|
+
disposableCollection.push(lib$1.Disposable.create(() => {
|
|
21667
|
+
delete languageClientManagerByLanguageId[id];
|
|
21668
|
+
}));
|
|
21669
|
+
disposableCollection.push(registerTextModelContentProvider('file', {
|
|
21374
21670
|
async provideTextContent(resource) {
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
return monaco.editor.createModel(content, undefined, resource);
|
|
21378
|
-
} catch (error) {
|
|
21379
|
-
// file not found
|
|
21380
|
-
return null;
|
|
21381
|
-
}
|
|
21671
|
+
const content = await infrastructure.getFileContent(resource, languageClientManager);
|
|
21672
|
+
return content != null ? monaco.editor.createModel(content, undefined, resource) : null;
|
|
21382
21673
|
}
|
|
21383
21674
|
|
|
21384
|
-
});
|
|
21675
|
+
}));
|
|
21676
|
+
disposableCollection.push(services.workspace.registerSaveDocumentHandler({
|
|
21677
|
+
async saveTextContent(textDocument, reason) {
|
|
21678
|
+
var _infrastructure$saveF;
|
|
21679
|
+
|
|
21680
|
+
await ((_infrastructure$saveF = infrastructure.saveFileContent) === null || _infrastructure$saveF === void 0 ? void 0 : _infrastructure$saveF.call(infrastructure, textDocument, reason, languageClientManager));
|
|
21681
|
+
}
|
|
21682
|
+
|
|
21683
|
+
}));
|
|
21385
21684
|
languageClientManager.onWillClose(() => {
|
|
21386
|
-
|
|
21387
|
-
textModelContentProviderDisposable.dispose();
|
|
21685
|
+
disposableCollection.dispose();
|
|
21388
21686
|
});
|
|
21389
21687
|
return languageClientManager;
|
|
21390
21688
|
}
|
|
21391
21689
|
|
|
21392
|
-
|
|
21393
|
-
return Object.values(languageClientManagerByLanguageId);
|
|
21394
|
-
}
|
|
21395
|
-
|
|
21396
|
-
function getAllLanguageClientManagersByTextDocument(textDocument) {
|
|
21397
|
-
return getAllLanguageClientManagers().filter(manager => manager.isModelManaged(textDocument));
|
|
21398
|
-
}
|
|
21399
|
-
|
|
21400
|
-
export { LanguageClientManager, createLanguageClientManager, loadExtensionConfigurations, registerLanguageClient };
|
|
21690
|
+
export { CodinGameInfrastructure, LanguageClientManager, createLanguageClientManager, loadExtensionConfigurations, registerLanguageClient };
|