ace-linters 1.3.4 → 1.4.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.
@@ -9769,6 +9769,7 @@ if (true) {
9769
9769
  /* harmony export */ m6: () => (/* binding */ ExecuteCommandMessage),
9770
9770
  /* harmony export */ qf: () => (/* binding */ CloseConnectionMessage),
9771
9771
  /* harmony export */ uO: () => (/* binding */ ChangeMessage),
9772
+ /* harmony export */ v3: () => (/* binding */ RenameDocumentMessage),
9772
9773
  /* harmony export */ zZ: () => (/* binding */ CompleteMessage)
9773
9774
  /* harmony export */ });
9774
9775
  /* unused harmony export BaseMessage */
@@ -9990,6 +9991,16 @@ class AppliedEditMessage {
9990
9991
  this.value = value;
9991
9992
  }
9992
9993
  }
9994
+ class RenameDocumentMessage extends BaseMessage {
9995
+ constructor(documentIdentifier, callbackId, value, version){
9996
+ super(documentIdentifier, callbackId);
9997
+ _define_property(this, "type", MessageType.renameDocument);
9998
+ _define_property(this, "value", void 0);
9999
+ _define_property(this, "version", void 0);
10000
+ this.value = value;
10001
+ this.version = version;
10002
+ }
10003
+ }
9993
10004
  var MessageType;
9994
10005
  (function(MessageType) {
9995
10006
  MessageType[MessageType["init"] = 0] = "init";
@@ -10015,6 +10026,7 @@ var MessageType;
10015
10026
  MessageType[MessageType["applyEdit"] = 20] = "applyEdit";
10016
10027
  MessageType[MessageType["appliedEdit"] = 21] = "appliedEdit";
10017
10028
  MessageType[MessageType["setWorkspace"] = 22] = "setWorkspace";
10029
+ MessageType[MessageType["renameDocument"] = 23] = "renameDocument";
10018
10030
  })(MessageType || (MessageType = {}));
10019
10031
 
10020
10032
 
@@ -10157,6 +10169,14 @@ class ServiceManager {
10157
10169
  this.$sessionIDToMode[documentIdentifier.uri] = mode;
10158
10170
  return services;
10159
10171
  }
10172
+ async renameDocument(documentIdentifier, newDocumentUri) {
10173
+ let services = this.getServicesInstances(documentIdentifier.uri);
10174
+ if (services.length > 0) {
10175
+ services.forEach((el)=>el.renameDocument(documentIdentifier, newDocumentUri));
10176
+ this.$sessionIDToMode[newDocumentUri] = this.$sessionIDToMode[documentIdentifier.uri];
10177
+ delete this.$sessionIDToMode[documentIdentifier.uri];
10178
+ }
10179
+ }
10160
10180
  async changeDocumentMode(documentIdentifier, value, mode, options) {
10161
10181
  this.removeDocument(documentIdentifier);
10162
10182
  return await this.addDocument(documentIdentifier, value, mode, options);
@@ -10420,6 +10440,9 @@ class ServiceManager {
10420
10440
  case _message_types__WEBPACK_IMPORTED_MODULE_0__/* .MessageType */ .Go.setWorkspace:
10421
10441
  this.setWorkspace(message.value);
10422
10442
  break;
10443
+ case _message_types__WEBPACK_IMPORTED_MODULE_0__/* .MessageType */ .Go.renameDocument:
10444
+ this.renameDocument(documentIdentifier, message.value);
10445
+ break;
10423
10446
  }
10424
10447
  ctx.postMessage(postMessage);
10425
10448
  });
@@ -19827,9 +19850,9 @@ class MessageController {
19827
19850
  change(documentIdentifier, deltas, document, callback) {
19828
19851
  let message;
19829
19852
  if (deltas.length > 50 && deltas.length > document.getLength() >> 1) {
19830
- message = new message_types/* ChangeMessage */.uO(documentIdentifier, this.callbackId++, document.getValue(), document["version"]);
19853
+ message = new message_types/* ChangeMessage */.uO(documentIdentifier, this.callbackId++, document.getValue(), document.version);
19831
19854
  } else {
19832
- message = new message_types/* DeltasMessage */.Jk(documentIdentifier, this.callbackId++, deltas, document["version"]);
19855
+ message = new message_types/* DeltasMessage */.Jk(documentIdentifier, this.callbackId++, deltas, document.version);
19833
19856
  }
19834
19857
  this.postMessage(message, callback);
19835
19858
  }
@@ -19870,6 +19893,9 @@ class MessageController {
19870
19893
  setWorkspace(workspaceUri, callback) {
19871
19894
  this.$worker.postMessage(new message_types/* SetWorkspaceMessage */.lR(workspaceUri));
19872
19895
  }
19896
+ renameDocument(documentIdentifier, newDocumentUri, version) {
19897
+ this.$worker.postMessage(new message_types/* RenameDocumentMessage */.v3(documentIdentifier, this.callbackId++, newDocumentUri, version));
19898
+ }
19873
19899
  postMessage(message, callback) {
19874
19900
  if (callback) {
19875
19901
  this.callbacks[message.callbackId] = callback;
@@ -20347,7 +20373,8 @@ function getServices(includeLinters) {
20347
20373
  name: "python",
20348
20374
  script: "python-service.js",
20349
20375
  className: "PythonService",
20350
- modes: "python"
20376
+ modes: "python",
20377
+ cdnUrl: "https://www.unpkg.com/ace-python-ruff-linter/build"
20351
20378
  }
20352
20379
  ];
20353
20380
  if (includeLinters === true || includeLinters === undefined) {
@@ -20523,13 +20550,11 @@ class BaseTooltip extends Tooltip {
20523
20550
  $registerEditorEvents() {
20524
20551
  this.$activeEditor.on("change", this.$hide);
20525
20552
  this.$activeEditor.on("mousewheel", this.$hide);
20526
- //@ts-ignore
20527
20553
  this.$activeEditor.on("mousedown", this.$hide);
20528
20554
  }
20529
20555
  $removeEditorEvents() {
20530
20556
  this.$activeEditor.off("change", this.$hide);
20531
20557
  this.$activeEditor.off("mousewheel", this.$hide);
20532
- //@ts-ignore
20533
20558
  this.$activeEditor.off("mousedown", this.$hide);
20534
20559
  }
20535
20560
  $inactivateEditor() {
@@ -20600,7 +20625,6 @@ function signature_tooltip_define_property(obj, key, value) {
20600
20625
 
20601
20626
  class SignatureTooltip extends BaseTooltip {
20602
20627
  registerEditor(editor) {
20603
- // @ts-ignore
20604
20628
  editor.on("changeSelection", ()=>this.onChangeSelection(editor));
20605
20629
  }
20606
20630
  update(editor) {
@@ -21332,6 +21356,7 @@ var ariaActiveState = isSafari ? "aria-current" : "aria-selected";
21332
21356
  /**
21333
21357
  * Creates and renders single line editor in popup window. If `parentNode` param is isset, then attaching it to this element.
21334
21358
  * @param {Element} [parentNode]
21359
+ * @return {Ace.AcePopup}
21335
21360
  */ constructor(parentNode){
21336
21361
  var el = document.createElement("div");
21337
21362
  var popup = $singleLineEditor(el);
@@ -21361,10 +21386,8 @@ var ariaActiveState = isSafari ? "aria-current" : "aria-selected";
21361
21386
  // @ts-ignore
21362
21387
  popup.session.highlight("");
21363
21388
  popup.session["$searchHighlight"].clazz = "ace_highlight-marker";
21364
- // @ts-ignore
21365
21389
  popup.on("mousedown", function(e) {
21366
21390
  var pos = e.getDocumentPosition();
21367
- // @ts-ignore
21368
21391
  popup.selection.moveToPosition(pos);
21369
21392
  selectionMarker.start.row = selectionMarker.end.row = pos.row;
21370
21393
  e.stop();
@@ -21378,7 +21401,7 @@ var ariaActiveState = isSafari ? "aria-current" : "aria-selected";
21378
21401
  hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
21379
21402
  } else if (hoverMarker.id) {
21380
21403
  popup.session.removeMarker(hoverMarker.id);
21381
- hoverMarker.id = null;
21404
+ hoverMarker.id = undefined;
21382
21405
  }
21383
21406
  };
21384
21407
  popup.setSelectOnHover(false);
@@ -21458,7 +21481,6 @@ var ariaActiveState = isSafari ? "aria-current" : "aria-selected";
21458
21481
  });
21459
21482
  // @ts-ignore
21460
21483
  popup.on("hide", hideHoverMarker);
21461
- // @ts-ignore
21462
21484
  popup.on("changeSelection", hideHoverMarker);
21463
21485
  popup.session.doc.getLength = function() {
21464
21486
  return popup.data.length;
@@ -21548,12 +21570,10 @@ var ariaActiveState = isSafari ? "aria-current" : "aria-selected";
21548
21570
  if (popup.isOpen) popup._signal("select");
21549
21571
  }
21550
21572
  };
21551
- // @ts-ignore
21552
21573
  popup.on("changeSelection", function() {
21553
21574
  if (popup.isOpen) {
21554
21575
  popup.setRow(popup.selection.lead.row);
21555
21576
  }
21556
- // @ts-ignore
21557
21577
  popup.renderer.scrollCursorIntoView();
21558
21578
  });
21559
21579
  popup.hide = function() {
@@ -21690,7 +21710,6 @@ function lightbulb_define_property(obj, key, value) {
21690
21710
 
21691
21711
  class LightbulbWidget {
21692
21712
  setEditorListeners(editor) {
21693
- //@ts-expect-error
21694
21713
  editor.on("changeSelection", this.hideAll);
21695
21714
  editor.on("focus", this.hideAll);
21696
21715
  editor.renderer.on("afterRender", this.setPosition);
@@ -21729,7 +21748,6 @@ class LightbulbWidget {
21729
21748
  return;
21730
21749
  }
21731
21750
  this.setDataToPopup();
21732
- //@ts-expect-error wrong public API
21733
21751
  this.popup.show({
21734
21752
  top: y,
21735
21753
  left: x
@@ -21753,7 +21771,7 @@ class LightbulbWidget {
21753
21771
  (_codeActionsByService_codeActions = codeActionsByService.codeActions) === null || _codeActionsByService_codeActions === void 0 ? void 0 : _codeActionsByService_codeActions.forEach((action)=>{
21754
21772
  codeActions.push({
21755
21773
  value: action.title,
21756
- //@ts-expect-error
21774
+ //@ts-expect-error
21757
21775
  serviceName: codeActionsByService.service,
21758
21776
  action: action
21759
21777
  });
@@ -21809,13 +21827,11 @@ class LightbulbWidget {
21809
21827
  this.editor = editor;
21810
21828
  this.codeActions = [];
21811
21829
  this.executeActionCallback = executeActionCallback;
21812
- // @ts-ignore
21830
+ //@ts-ignore
21813
21831
  this.popup = new AcePopup(editor.container || document.body || document.documentElement);
21814
- //@ts-expect-error
21815
21832
  this.popup.on("click", (e)=>{
21816
21833
  const selectedRow = this.popup.getData(this.popup.getRow());
21817
- // @ts-ignore
21818
- this.executeAction(selectedRow.action, selectedRow.serviceName);
21834
+ this.executeAction(selectedRow["action"], selectedRow["serviceName"]);
21819
21835
  this.popup.hide();
21820
21836
  e.stop();
21821
21837
  });
@@ -21991,6 +22007,7 @@ function language_provider_define_property(obj, key, value) {
21991
22007
 
21992
22008
 
21993
22009
 
22010
+
21994
22011
  class LanguageProvider {
21995
22012
  /**
21996
22013
  * Creates LanguageProvider using our transport protocol with ability to register different services on same
@@ -22148,7 +22165,6 @@ class LanguageProvider {
22148
22165
  });
22149
22166
  if (this.options.functionality.documentHighlights) {
22150
22167
  var $timer;
22151
- // @ts-ignore
22152
22168
  editor.on("changeSelection", ()=>{
22153
22169
  if (!$timer) $timer = setTimeout(()=>{
22154
22170
  let cursor = editor.getCursorPosition();
@@ -22190,7 +22206,6 @@ class LanguageProvider {
22190
22206
  }
22191
22207
  });
22192
22208
  var actionTimer;
22193
- // @ts-ignore
22194
22209
  editor.on("changeSelection", ()=>{
22195
22210
  if (!actionTimer) actionTimer = setTimeout(()=>{
22196
22211
  //TODO: no need to send request on empty
@@ -22385,6 +22400,13 @@ class LanguageProvider {
22385
22400
  }
22386
22401
  }
22387
22402
  class SessionLanguageProvider {
22403
+ enqueueIfNotConnected(callback) {
22404
+ if (!this.$isConnected) {
22405
+ this.$requestsQueue.push(callback);
22406
+ } else {
22407
+ callback();
22408
+ }
22409
+ }
22388
22410
  get comboDocumentIdentifier() {
22389
22411
  return {
22390
22412
  documentUri: this.documentUri,
@@ -22394,9 +22416,14 @@ class SessionLanguageProvider {
22394
22416
  /**
22395
22417
  * @param filePath
22396
22418
  */ setFilePath(filePath) {
22397
- if (this.$filePath !== undefined) return;
22398
- this.$filePath = filePath;
22399
- this.$init();
22419
+ this.enqueueIfNotConnected(()=>{
22420
+ this.session.doc.version++;
22421
+ if (this.$filePath !== undefined) return;
22422
+ this.$filePath = filePath;
22423
+ const previousComboId = this.comboDocumentIdentifier;
22424
+ this.initDocumentUri(true);
22425
+ this.$messageController.renameDocument(previousComboId, this.comboDocumentIdentifier.documentUri, this.session.doc.version);
22426
+ });
22400
22427
  }
22401
22428
  $init() {
22402
22429
  if (this.$isFilePathRequired && this.$filePath === undefined) return;
@@ -22428,9 +22455,12 @@ class SessionLanguageProvider {
22428
22455
  return bgTokenizer.lines[row] = data.tokens;
22429
22456
  };
22430
22457
  }
22431
- initDocumentUri() {
22458
+ initDocumentUri(isRename = false) {
22432
22459
  var _this_$filePath;
22433
22460
  let filePath = (_this_$filePath = this.$filePath) !== null && _this_$filePath !== void 0 ? _this_$filePath : this.session["id"] + "." + this.$extension;
22461
+ if (isRename) {
22462
+ delete this.$provider.$urisToSessionsIds[this.documentUri];
22463
+ }
22434
22464
  this.documentUri = (0,utils/* convertToUri */.de)(filePath);
22435
22465
  this.$provider.$urisToSessionsIds[this.documentUri] = this.session["id"];
22436
22466
  }
@@ -22476,6 +22506,7 @@ class SessionLanguageProvider {
22476
22506
  let decodedTokens = parseSemanticTokens(tokens.data, this.semanticTokensLegend.tokenTypes, this.semanticTokensLegend.tokenModifiers);
22477
22507
  this.session.setSemanticTokens(decodedTokens);
22478
22508
  let bgTokenizer = this.session.bgTokenizer;
22509
+ //@ts-ignore
22479
22510
  bgTokenizer.running = setTimeout(()=>{
22480
22511
  var _bgTokenizer_semanticTokens, _bgTokenizer, _bgTokenizer_semanticTokens1, _bgTokenizer1;
22481
22512
  if (((_bgTokenizer = bgTokenizer) === null || _bgTokenizer === void 0 ? void 0 : (_bgTokenizer_semanticTokens = _bgTokenizer.semanticTokens) === null || _bgTokenizer_semanticTokens === void 0 ? void 0 : _bgTokenizer_semanticTokens.tokens) && ((_bgTokenizer1 = bgTokenizer) === null || _bgTokenizer1 === void 0 ? void 0 : (_bgTokenizer_semanticTokens1 = _bgTokenizer1.semanticTokens) === null || _bgTokenizer_semanticTokens1 === void 0 ? void 0 : _bgTokenizer_semanticTokens1.tokens.length) > 0) {
@@ -22507,11 +22538,11 @@ class SessionLanguageProvider {
22507
22538
  language_provider_define_property(this, "$messageController", void 0);
22508
22539
  language_provider_define_property(this, "$deltaQueue", void 0);
22509
22540
  language_provider_define_property(this, "$isConnected", false);
22510
- language_provider_define_property(this, "$modeIsChanged", false);
22511
22541
  language_provider_define_property(this, "$options", void 0);
22512
22542
  language_provider_define_property(this, "$filePath", void 0);
22513
22543
  language_provider_define_property(this, "$isFilePathRequired", false);
22514
22544
  language_provider_define_property(this, "$servicesCapabilities", void 0);
22545
+ language_provider_define_property(this, "$requestsQueue", []);
22515
22546
  language_provider_define_property(this, "state", {
22516
22547
  occurrenceMarkers: null,
22517
22548
  diagnosticMarkers: null
@@ -22525,25 +22556,23 @@ class SessionLanguageProvider {
22525
22556
  language_provider_define_property(this, "$provider", void 0);
22526
22557
  language_provider_define_property(this, "$connected", (capabilities)=>{
22527
22558
  this.$isConnected = true;
22528
- // @ts-ignore
22529
22559
  this.setServerCapabilities(capabilities);
22530
- if (this.$modeIsChanged) this.$changeMode();
22560
+ this.$requestsQueue.forEach((requestCallback)=>requestCallback());
22561
+ this.$requestsQueue = [];
22531
22562
  if (this.$deltaQueue) this.$sendDeltaQueue();
22532
22563
  if (this.$options) this.setOptions(this.$options);
22533
22564
  });
22534
22565
  language_provider_define_property(this, "$changeMode", ()=>{
22535
- if (!this.$isConnected) {
22536
- this.$modeIsChanged = true;
22537
- return;
22538
- }
22539
- this.$deltaQueue = [];
22540
- this.session.clearAnnotations();
22541
- if (this.state.diagnosticMarkers) {
22542
- this.state.diagnosticMarkers.setMarkers([]);
22543
- }
22544
- this.session.setSemanticTokens(undefined); //clear all semantic tokens
22545
- let newVersion = this.session.doc["version"]++;
22546
- this.$messageController.changeMode(this.comboDocumentIdentifier, this.session.getValue(), newVersion, this.$mode, this.setServerCapabilities);
22566
+ this.enqueueIfNotConnected(()=>{
22567
+ this.$deltaQueue = [];
22568
+ this.session.clearAnnotations();
22569
+ if (this.state.diagnosticMarkers) {
22570
+ this.state.diagnosticMarkers.setMarkers([]);
22571
+ }
22572
+ this.session.setSemanticTokens(undefined); //clear all semantic tokens
22573
+ let newVersion = this.session.doc.version++;
22574
+ this.$messageController.changeMode(this.comboDocumentIdentifier, this.session.getValue(), newVersion, this.$mode, this.setServerCapabilities);
22575
+ });
22547
22576
  });
22548
22577
  language_provider_define_property(this, "setServerCapabilities", (capabilities)=>{
22549
22578
  if (!capabilities) return;
@@ -22580,9 +22609,11 @@ class SessionLanguageProvider {
22580
22609
  if (hasSemanticTokensProvider) {
22581
22610
  this.getSemanticTokens();
22582
22611
  }
22612
+ //TODO: we should restrict range formatting if any of services is only has full format capabilities
22613
+ //or we shoudl use service with full format capability instead of range one's
22583
22614
  });
22584
22615
  language_provider_define_property(this, "$changeListener", (delta)=>{
22585
- this.session.doc["version"]++;
22616
+ this.session.doc.version++;
22586
22617
  if (!this.$deltaQueue) {
22587
22618
  this.$deltaQueue = [];
22588
22619
  setTimeout(()=>this.$sendDeltaQueue(()=>{
@@ -22602,8 +22633,8 @@ class SessionLanguageProvider {
22602
22633
  if (!diagnostics) {
22603
22634
  return;
22604
22635
  }
22605
- this.session.clearAnnotations();
22606
22636
  let annotations = toAnnotations(diagnostics);
22637
+ this.session.clearAnnotations();
22607
22638
  if (annotations && annotations.length > 0) {
22608
22639
  this.session.setAnnotations(annotations);
22609
22640
  }
@@ -22658,10 +22689,9 @@ class SessionLanguageProvider {
22658
22689
  this.session = session;
22659
22690
  this.editor = editor;
22660
22691
  this.$isFilePathRequired = provider.requireFilePath;
22661
- session.doc["version"] = 1;
22692
+ session.doc.version = 1;
22662
22693
  session.doc.on("change", this.$changeListener, true);
22663
22694
  this.addSemanticTokenSupport(session); //TODO: ?
22664
- // @ts-ignore
22665
22695
  session.on("changeMode", this.$changeMode);
22666
22696
  if (this.$provider.options.functionality.semanticTokens) {
22667
22697
  session.on("changeScrollTop", ()=>this.getSemanticTokens());