ace-linters 0.10.3 → 0.11.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.
@@ -19172,6 +19172,7 @@ class MessageController extends (events_default()) {
19172
19172
  this.postMessage(new DisposeMessage(sessionId), callback);
19173
19173
  }
19174
19174
  setGlobalOptions(serviceName, options, merge = false) {
19175
+ // @ts-ignore
19175
19176
  this.$worker.postMessage(new GlobalOptionsMessage(serviceName, options, merge));
19176
19177
  }
19177
19178
  provideSignatureHelp(sessionId, position, callback) {
@@ -19364,6 +19365,7 @@ function toTooltip(hover) {
19364
19365
  var _hover_find;
19365
19366
  if (!hover) return;
19366
19367
  let content = hover.map((el)=>{
19368
+ if (!el || !el.contents) return;
19367
19369
  if (main.MarkupContent.is(el.contents)) {
19368
19370
  return fromMarkupContent(el.contents);
19369
19371
  } else if (main.MarkedString.is(el.contents)) {
@@ -19378,9 +19380,12 @@ function toTooltip(hover) {
19378
19380
  });
19379
19381
  return contents.join("\n\n");
19380
19382
  }
19381
- });
19383
+ }).filter(notEmpty);
19384
+ if (content.length === 0) return;
19382
19385
  //TODO: it could be merged within all ranges in future
19383
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19386
+ let lspRange = (_hover_find = hover.find((el)=>{
19387
+ return el === null || el === void 0 ? void 0 : el.range;
19388
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19384
19389
  let range;
19385
19390
  if (lspRange) range = toRange(lspRange);
19386
19391
  return {
@@ -19394,8 +19399,10 @@ function toTooltip(hover) {
19394
19399
  function fromSignatureHelp(signatureHelp) {
19395
19400
  if (!signatureHelp) return;
19396
19401
  let content = signatureHelp.map((el)=>{
19402
+ if (!el) return;
19397
19403
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
19398
19404
  let activeSignature = el.signatures[signatureIndex];
19405
+ if (!activeSignature) return;
19399
19406
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
19400
19407
  let contents = activeSignature.label;
19401
19408
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -19414,7 +19421,8 @@ function fromSignatureHelp(signatureHelp) {
19414
19421
  } else {
19415
19422
  return contents;
19416
19423
  }
19417
- });
19424
+ }).filter(notEmpty);
19425
+ if (content.length === 0) return;
19418
19426
  return {
19419
19427
  content: {
19420
19428
  type: "markdown",
@@ -20330,7 +20338,6 @@ class MessageControllerWS extends events.EventEmitter {
20330
20338
  this.connection.onClose(()=>{
20331
20339
  this.isConnected = false;
20332
20340
  });
20333
- this.initSessionQueue.forEach((initSession)=>this.initSession(initSession.textDocumentMessage, initSession.initCallback));
20334
20341
  }
20335
20342
  init(sessionId, document, mode, options, initCallback, validationCallback) {
20336
20343
  this["on"]("validate-" + sessionId, validationCallback);
@@ -20343,10 +20350,7 @@ class MessageControllerWS extends events.EventEmitter {
20343
20350
  }
20344
20351
  };
20345
20352
  if (!this.isConnected) {
20346
- this.initSessionQueue.push({
20347
- textDocumentMessage: textDocumentMessage,
20348
- initCallback: initCallback
20349
- });
20353
+ this.requestsQueue.push(()=>this.initSession(textDocumentMessage, initCallback));
20350
20354
  } else {
20351
20355
  this.initSession(textDocumentMessage, initCallback);
20352
20356
  }
@@ -20359,7 +20363,7 @@ class MessageControllerWS extends events.EventEmitter {
20359
20363
  if (this.connection) {
20360
20364
  this.connection.dispose();
20361
20365
  }
20362
- this.socket.close();
20366
+ if (this.socket) this.socket.close();
20363
20367
  }
20364
20368
  sendInitialize() {
20365
20369
  if (!this.isConnected) {
@@ -20379,6 +20383,8 @@ class MessageControllerWS extends events.EventEmitter {
20379
20383
  this.connection.sendNotification('workspace/didChangeConfiguration', {
20380
20384
  settings: {}
20381
20385
  });
20386
+ this.requestsQueue.forEach((requestCallback)=>requestCallback());
20387
+ this.requestsQueue = [];
20382
20388
  });
20383
20389
  }
20384
20390
  change(sessionId, deltas, document, callback) {
@@ -20392,7 +20398,7 @@ class MessageControllerWS extends events.EventEmitter {
20392
20398
  },
20393
20399
  contentChanges: deltas
20394
20400
  };
20395
- this.connection.sendNotification('textDocument/didChange', textDocumentChange);
20401
+ this.connection.sendNotification('textDocument/didChange', textDocumentChange).then(()=>callback && callback());
20396
20402
  }
20397
20403
  doHover(sessionId, position, callback) {
20398
20404
  if (!this.isInitialized) {
@@ -20428,7 +20434,13 @@ class MessageControllerWS extends events.EventEmitter {
20428
20434
  position: position
20429
20435
  };
20430
20436
  let completionCallback = (result)=>{
20431
- callback && callback(result);
20437
+ let completionService = {
20438
+ completions: result,
20439
+ service: "lsp"
20440
+ };
20441
+ callback && callback([
20442
+ completionService
20443
+ ]);
20432
20444
  };
20433
20445
  this.postMessage('textDocument/completion', sessionId, options, completionCallback);
20434
20446
  }
@@ -20470,7 +20482,16 @@ class MessageControllerWS extends events.EventEmitter {
20470
20482
  callback && callback(params);
20471
20483
  });
20472
20484
  }
20473
- setGlobalOptions(serviceName, options, merge) {}
20485
+ setGlobalOptions(serviceName, options, merge) {
20486
+ if (!this.isConnected) {
20487
+ this.requestsQueue.push(()=>this.setGlobalOptions(serviceName, options, merge));
20488
+ return;
20489
+ }
20490
+ const configChanges = {
20491
+ settings: options
20492
+ };
20493
+ this.connection.sendNotification('workspace/didChangeConfiguration', configChanges);
20494
+ }
20474
20495
  postMessage(name, sessionId, options, callback) {
20475
20496
  let eventName = name + "-" + sessionId;
20476
20497
  let callbackFunction = (data)=>{
@@ -20521,7 +20542,7 @@ class MessageControllerWS extends events.EventEmitter {
20521
20542
  message_controller_ws_define_property(this, "socket", void 0);
20522
20543
  message_controller_ws_define_property(this, "serverCapabilities", void 0);
20523
20544
  message_controller_ws_define_property(this, "connection", void 0);
20524
- message_controller_ws_define_property(this, "initSessionQueue", []);
20545
+ message_controller_ws_define_property(this, "requestsQueue", []);
20525
20546
  message_controller_ws_define_property(this, "clientCapabilities", {
20526
20547
  textDocument: {
20527
20548
  hover: {
@@ -19159,6 +19159,7 @@ class MessageController extends (events_default()) {
19159
19159
  this.postMessage(new DisposeMessage(sessionId), callback);
19160
19160
  }
19161
19161
  setGlobalOptions(serviceName, options, merge = false) {
19162
+ // @ts-ignore
19162
19163
  this.$worker.postMessage(new GlobalOptionsMessage(serviceName, options, merge));
19163
19164
  }
19164
19165
  provideSignatureHelp(sessionId, position, callback) {
@@ -19351,6 +19352,7 @@ function toTooltip(hover) {
19351
19352
  var _hover_find;
19352
19353
  if (!hover) return;
19353
19354
  let content = hover.map((el)=>{
19355
+ if (!el || !el.contents) return;
19354
19356
  if (main.MarkupContent.is(el.contents)) {
19355
19357
  return fromMarkupContent(el.contents);
19356
19358
  } else if (main.MarkedString.is(el.contents)) {
@@ -19365,9 +19367,12 @@ function toTooltip(hover) {
19365
19367
  });
19366
19368
  return contents.join("\n\n");
19367
19369
  }
19368
- });
19370
+ }).filter(notEmpty);
19371
+ if (content.length === 0) return;
19369
19372
  //TODO: it could be merged within all ranges in future
19370
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19373
+ let lspRange = (_hover_find = hover.find((el)=>{
19374
+ return el === null || el === void 0 ? void 0 : el.range;
19375
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19371
19376
  let range;
19372
19377
  if (lspRange) range = toRange(lspRange);
19373
19378
  return {
@@ -19381,8 +19386,10 @@ function toTooltip(hover) {
19381
19386
  function fromSignatureHelp(signatureHelp) {
19382
19387
  if (!signatureHelp) return;
19383
19388
  let content = signatureHelp.map((el)=>{
19389
+ if (!el) return;
19384
19390
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
19385
19391
  let activeSignature = el.signatures[signatureIndex];
19392
+ if (!activeSignature) return;
19386
19393
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
19387
19394
  let contents = activeSignature.label;
19388
19395
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -19401,7 +19408,8 @@ function fromSignatureHelp(signatureHelp) {
19401
19408
  } else {
19402
19409
  return contents;
19403
19410
  }
19404
- });
19411
+ }).filter(notEmpty);
19412
+ if (content.length === 0) return;
19405
19413
  return {
19406
19414
  content: {
19407
19415
  type: "markdown",
@@ -12844,7 +12844,7 @@ function mergeObjects(obj1, obj2) {
12844
12844
  }
12845
12845
  return mergedObjects;
12846
12846
  }
12847
- function notEmpty(value) {
12847
+ function utils_notEmpty(value) {
12848
12848
  return value !== null && value !== undefined;
12849
12849
  }
12850
12850
  //taken with small changes from ace-code
@@ -54335,6 +54335,7 @@ function toTooltip(hover) {
54335
54335
  var _hover_find;
54336
54336
  if (!hover) return;
54337
54337
  let content = hover.map((el)=>{
54338
+ if (!el || !el.contents) return;
54338
54339
  if (MarkupContent.is(el.contents)) {
54339
54340
  return fromMarkupContent(el.contents);
54340
54341
  } else if (MarkedString.is(el.contents)) {
@@ -54349,9 +54350,12 @@ function toTooltip(hover) {
54349
54350
  });
54350
54351
  return contents.join("\n\n");
54351
54352
  }
54352
- });
54353
+ }).filter(notEmpty);
54354
+ if (content.length === 0) return;
54353
54355
  //TODO: it could be merged within all ranges in future
54354
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
54356
+ let lspRange = (_hover_find = hover.find((el)=>{
54357
+ return el === null || el === void 0 ? void 0 : el.range;
54358
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
54355
54359
  let range;
54356
54360
  if (lspRange) range = toRange(lspRange);
54357
54361
  return {
@@ -54365,8 +54369,10 @@ function toTooltip(hover) {
54365
54369
  function fromSignatureHelp(signatureHelp) {
54366
54370
  if (!signatureHelp) return;
54367
54371
  let content = signatureHelp.map((el)=>{
54372
+ if (!el) return;
54368
54373
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
54369
54374
  let activeSignature = el.signatures[signatureIndex];
54375
+ if (!activeSignature) return;
54370
54376
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
54371
54377
  let contents = activeSignature.label;
54372
54378
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -54385,7 +54391,8 @@ function fromSignatureHelp(signatureHelp) {
54385
54391
  } else {
54386
54392
  return contents;
54387
54393
  }
54388
- });
54394
+ }).filter(notEmpty);
54395
+ if (content.length === 0) return;
54389
54396
  return {
54390
54397
  content: {
54391
54398
  type: "markdown",
@@ -13012,7 +13012,7 @@ function mergeObjects(obj1, obj2) {
13012
13012
  }
13013
13013
  return mergedObjects;
13014
13014
  }
13015
- function notEmpty(value) {
13015
+ function utils_notEmpty(value) {
13016
13016
  return value !== null && value !== undefined;
13017
13017
  }
13018
13018
  //taken with small changes from ace-code
@@ -19958,6 +19958,7 @@ function toTooltip(hover) {
19958
19958
  var _hover_find;
19959
19959
  if (!hover) return;
19960
19960
  let content = hover.map((el)=>{
19961
+ if (!el || !el.contents) return;
19961
19962
  if (MarkupContent.is(el.contents)) {
19962
19963
  return fromMarkupContent(el.contents);
19963
19964
  } else if (MarkedString.is(el.contents)) {
@@ -19972,9 +19973,12 @@ function toTooltip(hover) {
19972
19973
  });
19973
19974
  return contents.join("\n\n");
19974
19975
  }
19975
- });
19976
+ }).filter(notEmpty);
19977
+ if (content.length === 0) return;
19976
19978
  //TODO: it could be merged within all ranges in future
19977
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19979
+ let lspRange = (_hover_find = hover.find((el)=>{
19980
+ return el === null || el === void 0 ? void 0 : el.range;
19981
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
19978
19982
  let range;
19979
19983
  if (lspRange) range = toRange(lspRange);
19980
19984
  return {
@@ -19988,8 +19992,10 @@ function toTooltip(hover) {
19988
19992
  function fromSignatureHelp(signatureHelp) {
19989
19993
  if (!signatureHelp) return;
19990
19994
  let content = signatureHelp.map((el)=>{
19995
+ if (!el) return;
19991
19996
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
19992
19997
  let activeSignature = el.signatures[signatureIndex];
19998
+ if (!activeSignature) return;
19993
19999
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
19994
20000
  let contents = activeSignature.label;
19995
20001
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -20008,7 +20014,8 @@ function fromSignatureHelp(signatureHelp) {
20008
20014
  } else {
20009
20015
  return contents;
20010
20016
  }
20011
- });
20017
+ }).filter(notEmpty);
20018
+ if (content.length === 0) return;
20012
20019
  return {
20013
20020
  content: {
20014
20021
  type: "markdown",
@@ -15597,7 +15597,7 @@ function mergeObjects(obj1, obj2) {
15597
15597
  }
15598
15598
  return mergedObjects;
15599
15599
  }
15600
- function notEmpty(value) {
15600
+ function utils_notEmpty(value) {
15601
15601
  return value !== null && value !== undefined;
15602
15602
  }
15603
15603
  //taken with small changes from ace-code
@@ -16248,6 +16248,7 @@ function toTooltip(hover) {
16248
16248
  var _hover_find;
16249
16249
  if (!hover) return;
16250
16250
  let content = hover.map((el)=>{
16251
+ if (!el || !el.contents) return;
16251
16252
  if (MarkupContent.is(el.contents)) {
16252
16253
  return fromMarkupContent(el.contents);
16253
16254
  } else if (MarkedString.is(el.contents)) {
@@ -16262,9 +16263,12 @@ function toTooltip(hover) {
16262
16263
  });
16263
16264
  return contents.join("\n\n");
16264
16265
  }
16265
- });
16266
+ }).filter(notEmpty);
16267
+ if (content.length === 0) return;
16266
16268
  //TODO: it could be merged within all ranges in future
16267
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
16269
+ let lspRange = (_hover_find = hover.find((el)=>{
16270
+ return el === null || el === void 0 ? void 0 : el.range;
16271
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
16268
16272
  let range;
16269
16273
  if (lspRange) range = toRange(lspRange);
16270
16274
  return {
@@ -16278,8 +16282,10 @@ function toTooltip(hover) {
16278
16282
  function fromSignatureHelp(signatureHelp) {
16279
16283
  if (!signatureHelp) return;
16280
16284
  let content = signatureHelp.map((el)=>{
16285
+ if (!el) return;
16281
16286
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
16282
16287
  let activeSignature = el.signatures[signatureIndex];
16288
+ if (!activeSignature) return;
16283
16289
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
16284
16290
  let contents = activeSignature.label;
16285
16291
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -16298,7 +16304,8 @@ function fromSignatureHelp(signatureHelp) {
16298
16304
  } else {
16299
16305
  return contents;
16300
16306
  }
16301
- });
16307
+ }).filter(notEmpty);
16308
+ if (content.length === 0) return;
16302
16309
  return {
16303
16310
  content: {
16304
16311
  type: "markdown",
@@ -21920,7 +21920,7 @@ function mergeObjects(obj1, obj2) {
21920
21920
  }
21921
21921
  return mergedObjects;
21922
21922
  }
21923
- function notEmpty(value) {
21923
+ function utils_notEmpty(value) {
21924
21924
  return value !== null && value !== undefined;
21925
21925
  }
21926
21926
  //taken with small changes from ace-code
@@ -22571,6 +22571,7 @@ function toTooltip(hover) {
22571
22571
  var _hover_find;
22572
22572
  if (!hover) return;
22573
22573
  let content = hover.map((el)=>{
22574
+ if (!el || !el.contents) return;
22574
22575
  if (MarkupContent.is(el.contents)) {
22575
22576
  return fromMarkupContent(el.contents);
22576
22577
  } else if (MarkedString.is(el.contents)) {
@@ -22585,9 +22586,12 @@ function toTooltip(hover) {
22585
22586
  });
22586
22587
  return contents.join("\n\n");
22587
22588
  }
22588
- });
22589
+ }).filter(notEmpty);
22590
+ if (content.length === 0) return;
22589
22591
  //TODO: it could be merged within all ranges in future
22590
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
22592
+ let lspRange = (_hover_find = hover.find((el)=>{
22593
+ return el === null || el === void 0 ? void 0 : el.range;
22594
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
22591
22595
  let range;
22592
22596
  if (lspRange) range = toRange(lspRange);
22593
22597
  return {
@@ -22601,8 +22605,10 @@ function toTooltip(hover) {
22601
22605
  function fromSignatureHelp(signatureHelp) {
22602
22606
  if (!signatureHelp) return;
22603
22607
  let content = signatureHelp.map((el)=>{
22608
+ if (!el) return;
22604
22609
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
22605
22610
  let activeSignature = el.signatures[signatureIndex];
22611
+ if (!activeSignature) return;
22606
22612
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
22607
22613
  let contents = activeSignature.label;
22608
22614
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -22621,7 +22627,8 @@ function fromSignatureHelp(signatureHelp) {
22621
22627
  } else {
22622
22628
  return contents;
22623
22629
  }
22624
- });
22630
+ }).filter(notEmpty);
22631
+ if (content.length === 0) return;
22625
22632
  return {
22626
22633
  content: {
22627
22634
  type: "markdown",
@@ -15230,7 +15230,7 @@ function mergeObjects(obj1, obj2) {
15230
15230
  }
15231
15231
  return mergedObjects;
15232
15232
  }
15233
- function notEmpty(value) {
15233
+ function utils_notEmpty(value) {
15234
15234
  return value !== null && value !== undefined;
15235
15235
  }
15236
15236
  //taken with small changes from ace-code
@@ -79509,6 +79509,7 @@ function toTooltip(hover) {
79509
79509
  var _hover_find;
79510
79510
  if (!hover) return;
79511
79511
  let content = hover.map((el)=>{
79512
+ if (!el || !el.contents) return;
79512
79513
  if (MarkupContent.is(el.contents)) {
79513
79514
  return fromMarkupContent(el.contents);
79514
79515
  } else if (MarkedString.is(el.contents)) {
@@ -79523,9 +79524,12 @@ function toTooltip(hover) {
79523
79524
  });
79524
79525
  return contents.join("\n\n");
79525
79526
  }
79526
- });
79527
+ }).filter(notEmpty);
79528
+ if (content.length === 0) return;
79527
79529
  //TODO: it could be merged within all ranges in future
79528
- let lspRange = (_hover_find = hover.find((el)=>el.range)) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
79530
+ let lspRange = (_hover_find = hover.find((el)=>{
79531
+ return el === null || el === void 0 ? void 0 : el.range;
79532
+ })) === null || _hover_find === void 0 ? void 0 : _hover_find.range;
79529
79533
  let range;
79530
79534
  if (lspRange) range = toRange(lspRange);
79531
79535
  return {
@@ -79539,8 +79543,10 @@ function toTooltip(hover) {
79539
79543
  function fromSignatureHelp(signatureHelp) {
79540
79544
  if (!signatureHelp) return;
79541
79545
  let content = signatureHelp.map((el)=>{
79546
+ if (!el) return;
79542
79547
  let signatureIndex = (el === null || el === void 0 ? void 0 : el.activeSignature) || 0;
79543
79548
  let activeSignature = el.signatures[signatureIndex];
79549
+ if (!activeSignature) return;
79544
79550
  let activeParam = el === null || el === void 0 ? void 0 : el.activeParameter;
79545
79551
  let contents = activeSignature.label;
79546
79552
  if (activeParam != undefined && activeSignature.parameters && activeSignature.parameters[activeParam]) {
@@ -79559,7 +79565,8 @@ function fromSignatureHelp(signatureHelp) {
79559
79565
  } else {
79560
79566
  return contents;
79561
79567
  }
79562
- });
79568
+ }).filter(notEmpty);
79569
+ if (content.length === 0) return;
79563
79570
  return {
79564
79571
  content: {
79565
79572
  type: "markdown",
@@ -144,7 +144,7 @@ export class LanguageProvider {
144
144
  sessionLanguageProvider.setOptions(options);
145
145
  }
146
146
 
147
- setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T, options: ServiceOptionsMap[T], merge = false) {
147
+ setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T & string, options: ServiceOptionsMap[T], merge = false) {
148
148
  this.$messageController.setGlobalOptions(serviceName, options, merge);
149
149
  }
150
150
 
@@ -16,7 +16,7 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
16
16
  private readonly socket: WebSocket;
17
17
  private serverCapabilities: lsp.ServerCapabilities;
18
18
  private connection: lsp.ProtocolConnection;
19
- private initSessionQueue: { textDocumentMessage: lsp.DidOpenTextDocumentParams, initCallback: () => void }[] = [];
19
+ private requestsQueue: Function[] = [];
20
20
 
21
21
  clientCapabilities: lsp.ClientCapabilities = {
22
22
  textDocument: {
@@ -121,8 +121,6 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
121
121
  this.connection.onClose(() => {
122
122
  this.isConnected = false;
123
123
  });
124
-
125
- this.initSessionQueue.forEach((initSession) => this.initSession(initSession.textDocumentMessage, initSession.initCallback));
126
124
  }
127
125
 
128
126
  init(sessionId: string, document: Ace.Document, mode: string, options: any, initCallback: () => void, validationCallback: (annotations: lsp.Diagnostic[]) => void) {
@@ -138,7 +136,7 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
138
136
  };
139
137
 
140
138
  if (!this.isConnected) {
141
- this.initSessionQueue.push({textDocumentMessage: textDocumentMessage, initCallback: initCallback});
139
+ this.requestsQueue.push(() => this.initSession(textDocumentMessage, initCallback));
142
140
  } else {
143
141
  this.initSession(textDocumentMessage, initCallback);
144
142
  }
@@ -149,11 +147,12 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
149
147
  initCallback();
150
148
  }
151
149
 
152
- close() { //TODO:
150
+ close() {
153
151
  if (this.connection) {
154
152
  this.connection.dispose();
155
153
  }
156
- this.socket.close();
154
+ if (this.socket)
155
+ this.socket.close();
157
156
  }
158
157
 
159
158
  sendInitialize() {
@@ -176,6 +175,8 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
176
175
  this.connection.sendNotification('workspace/didChangeConfiguration', {
177
176
  settings: {},
178
177
  });
178
+ this.requestsQueue.forEach((requestCallback) => requestCallback());
179
+ this.requestsQueue = [];
179
180
  });
180
181
  }
181
182
 
@@ -190,7 +191,7 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
190
191
  } as lsp.VersionedTextDocumentIdentifier,
191
192
  contentChanges: deltas,
192
193
  };
193
- this.connection.sendNotification('textDocument/didChange', textDocumentChange);
194
+ this.connection.sendNotification('textDocument/didChange', textDocumentChange).then(() => callback && callback());
194
195
  }
195
196
 
196
197
  doHover(sessionId: string, position: lsp.Position, callback?: (hover: lsp.Hover[]) => void) {
@@ -226,8 +227,12 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
226
227
  },
227
228
  position: position,
228
229
  };
229
- let completionCallback = (result: CompletionService[]) => {
230
- callback && callback(result);
230
+ let completionCallback = (result: lsp.CompletionItem[] | lsp.CompletionList | null) => {
231
+ let completionService = {
232
+ completions: result,
233
+ service: "lsp"
234
+ }
235
+ callback && callback([completionService]);
231
236
  };
232
237
  this.postMessage('textDocument/completion', sessionId, options, completionCallback);
233
238
  }
@@ -279,7 +284,15 @@ export class MessageControllerWS extends events.EventEmitter implements IMessage
279
284
  });
280
285
  }
281
286
 
282
- setGlobalOptions(serviceName: string, options: any, merge?: boolean): void { //TODO: ?
287
+ setGlobalOptions(serviceName: string, options: any, merge?: boolean): void {
288
+ if (!this.isConnected) {
289
+ this.requestsQueue.push(() => this.setGlobalOptions(serviceName, options, merge));
290
+ return;
291
+ }
292
+ const configChanges: lsp.DidChangeConfigurationParams = {
293
+ settings: options
294
+ };
295
+ this.connection.sendNotification('workspace/didChangeConfiguration', configChanges);
283
296
  }
284
297
 
285
298
  postMessage(name, sessionId, options, callback: (any) => void) {
@@ -81,6 +81,7 @@ export class MessageController extends EventEmitter implements IMessageControlle
81
81
  }
82
82
 
83
83
  setGlobalOptions<T extends keyof ServiceOptionsMap>(serviceName: T, options: ServiceOptionsMap[T], merge = false) {
84
+ // @ts-ignore
84
85
  this.$worker.postMessage(new GlobalOptionsMessage(serviceName, options, merge));
85
86
  }
86
87
 
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ extension: ['ts'],
3
+ reporter: 'spec',
4
+ timeout: 5000,
5
+ spec: 'tests/ui/*.tests.ts',
6
+ require: "ts-node/register"
7
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ extension: ['ts'],
3
+ reporter: 'spec',
4
+ timeout: 5000,
5
+ spec: 'tests/unit/*.tests.ts',
6
+ require: "ts-node/register"
7
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ace-linters",
3
3
  "author": "Azat Alimov <mkslanc@gmail.com>",
4
- "version": "0.10.3",
4
+ "version": "0.11.1",
5
5
  "scripts": {
6
6
  "clean": "rimraf build",
7
7
  "build:yaml-language-server": "cd ../yaml-language-server-esbuild && npm run build",
@@ -9,7 +9,12 @@
9
9
  "build:dependencies": "npm run build:yaml-language-server && npm run build:eslint-linter-bundle",
10
10
  "build": "npm run clean && npm run build:dependencies && webpack --mode=production",
11
11
  "build-dev": "npm run clean && npm run build:dependencies && webpack --mode=development",
12
- "test": "mocha --timeout 5000 --exit",
12
+
13
+ "build-test": "npm run build:dependencies && webpack --name=test",
14
+ "start-test-server": "npm run build-test && http-server --cors='*' tests/ui/dist",
15
+ "test:unit": "mocha --config mocha.unit.config.js --exit",
16
+ "test:ui": "mocha --config mocha.ui.config.js --exit",
17
+ "test": "npm run test:unit && npm run test:ui",
13
18
  "test:coverage": "nyc npm run test",
14
19
  "start-server": "http-server build --cors=\"*\""
15
20
  },
@@ -37,7 +42,9 @@
37
42
  "chai": "^4.3.7",
38
43
  "mocha": "^10.2.0",
39
44
  "nyc": "^15.1.0",
40
- "ts-node": "^10.9.1"
45
+ "ts-node": "^10.9.1",
46
+ "puppeteer": "^19.9.1",
47
+ "http-server": "^14.1.1"
41
48
  },
42
49
  "main": "build/ace-linters.js",
43
50
  "types": "types/index.d.ts",