@rohal12/spindle-lsp 0.3.3 → 0.3.4

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/bin.js CHANGED
@@ -1035,6 +1035,8 @@ var init_workspace_model = __esm({
1035
1035
  macros;
1036
1036
  variables;
1037
1037
  widgets;
1038
+ /** True after initialize() has completed (full workspace scan done). */
1039
+ initialized = false;
1038
1040
  debounceTimer = null;
1039
1041
  DEBOUNCE_MS = 200;
1040
1042
  /** Bound listeners for cleanup in dispose(). */
@@ -1070,6 +1072,7 @@ var init_workspace_model = __esm({
1070
1072
  this.documents.on("documentOpened", this.onDocumentOpened);
1071
1073
  this.documents.on("documentChanged", this.onDocumentChanged);
1072
1074
  this.rebuildAll();
1075
+ this.initialized = true;
1073
1076
  this.scheduleModelReady();
1074
1077
  }
1075
1078
  /** Clean up listeners and timers. */
@@ -2106,13 +2109,15 @@ function computeDiagnostics(uri, workspace) {
2106
2109
  validateVariables(uri, workspace, diagnostics);
2107
2110
  } catch {
2108
2111
  }
2109
- try {
2110
- validateLinks(text, passages, passageNames, diagnostics);
2111
- } catch {
2112
- }
2113
- try {
2114
- validateWidgetInvocations(macros, workspace, diagnostics);
2115
- } catch {
2112
+ if (workspace.initialized) {
2113
+ try {
2114
+ validateLinks(text, passages, passageNames, diagnostics);
2115
+ } catch {
2116
+ }
2117
+ try {
2118
+ validateWidgetInvocations(macros, workspace, diagnostics);
2119
+ } catch {
2120
+ }
2116
2121
  }
2117
2122
  return diagnostics;
2118
2123
  } catch {
@@ -2273,6 +2278,7 @@ function validateArguments(macros, workspace, passageNames, diagnostics) {
2273
2278
  }
2274
2279
  }
2275
2280
  function validateVariables(uri, workspace, diagnostics) {
2281
+ if (!workspace.initialized) return;
2276
2282
  if (!workspace.variables.hasStoryVariables()) {
2277
2283
  const undeclared2 = workspace.variables.getUndeclared(uri);
2278
2284
  const text = workspace.documents.getText(uri);