sysml-validate 0.20.0 → 0.20.2

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/out/main.js CHANGED
@@ -70769,6 +70769,28 @@ var SysmlDocumentBuilder = class extends DefaultDocumentBuilder {
70769
70769
  });
70770
70770
  });
70771
70771
  }
70772
+ /** REQ-006/REQ-398 - Wait for an editor change to reach the parsed document before
70773
+ * serving a diagram refresh. Custom LSP requests are not gated by Langium's
70774
+ * standard request pipeline, so a request sent just after applyEdit can
70775
+ * otherwise read the preceding document version and publish a stale model.
70776
+ */
70777
+ async waitForDocumentVersion(uri, minimumVersion, state = DocumentState.IndexedReferences, cancelToken = import_vscode_languageserver25.CancellationToken.None) {
70778
+ while (!cancelToken.isCancellationRequested) {
70779
+ let document = await this.getOrCreateTargetDocument(uri, cancelToken);
70780
+ if (!document)
70781
+ return void 0;
70782
+ if ((document.textDocument.version ?? -1) >= minimumVersion) {
70783
+ await this.waitUntil(state, uri, cancelToken);
70784
+ document = this.langiumDocuments.getDocument(uri);
70785
+ if (document && (document.textDocument.version ?? -1) >= minimumVersion && document.state >= state) {
70786
+ return document;
70787
+ }
70788
+ continue;
70789
+ }
70790
+ await this.waitForDocumentVersionPhase(uri, minimumVersion, state, cancelToken);
70791
+ }
70792
+ throw OperationCancelled;
70793
+ }
70772
70794
  // REQ-075, REQ-220 — Build the global symbol graph first for this batch,
70773
70795
  // then link visible documents before background documents. See class doc,
70774
70796
  // point 2.
@@ -70879,6 +70901,34 @@ var SysmlDocumentBuilder = class extends DefaultDocumentBuilder {
70879
70901
  const state = this.buildState.get(doc.uri.toString());
70880
70902
  return Boolean(state && !state.completed);
70881
70903
  }
70904
+ waitForDocumentVersionPhase(uri, minimumVersion, state, cancelToken) {
70905
+ if (cancelToken.isCancellationRequested)
70906
+ return Promise.reject(OperationCancelled);
70907
+ const target = uri.toString();
70908
+ return new Promise((resolve7, reject2) => {
70909
+ let settled = false;
70910
+ let cancelDisposable;
70911
+ const ready = (document) => document?.uri.toString() === target && (document.textDocument.version ?? -1) >= minimumVersion;
70912
+ const finish = (error) => {
70913
+ if (settled)
70914
+ return;
70915
+ settled = true;
70916
+ phaseDisposable.dispose();
70917
+ cancelDisposable?.dispose();
70918
+ if (error)
70919
+ reject2(error);
70920
+ else
70921
+ resolve7();
70922
+ };
70923
+ const phaseDisposable = this.onDocumentPhase(state, (document) => {
70924
+ if (ready(document))
70925
+ finish();
70926
+ });
70927
+ cancelDisposable = cancelToken.onCancellationRequested(() => finish(OperationCancelled));
70928
+ if (ready(this.langiumDocuments.getDocument(uri)))
70929
+ finish();
70930
+ });
70931
+ }
70882
70932
  optionsForState(state) {
70883
70933
  return state >= DocumentState.Validated ? this.updateBuildOptions : { validation: false };
70884
70934
  }
@@ -72185,7 +72235,7 @@ async function runValidation(command) {
72185
72235
  }
72186
72236
 
72187
72237
  // src/main.ts
72188
- var VERSION2 = true ? "0.20.0" : "dev";
72238
+ var VERSION2 = true ? "0.20.2" : "dev";
72189
72239
  async function main(argv) {
72190
72240
  const command = parseArgs(argv);
72191
72241
  if (command.kind === "help") {