@rohal12/spindle-lsp 0.3.2 → 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 +25 -12
- package/dist/bin.js.map +2 -2
- package/package.json +1 -1
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
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
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);
|
|
@@ -4884,7 +4890,7 @@ function startServer(_args) {
|
|
|
4884
4890
|
capabilities: buildCapabilities(activePlugins)
|
|
4885
4891
|
};
|
|
4886
4892
|
});
|
|
4887
|
-
connection.onInitialized(
|
|
4893
|
+
connection.onInitialized(() => {
|
|
4888
4894
|
connection.client.register(DidChangeWatchedFilesNotification.type, {
|
|
4889
4895
|
watchers: [
|
|
4890
4896
|
{ globPattern: "**/*.tw" },
|
|
@@ -4894,12 +4900,19 @@ function startServer(_args) {
|
|
|
4894
4900
|
{ globPattern: "**/spindle.config.*" },
|
|
4895
4901
|
{ globPattern: "**/*twee-config.*" }
|
|
4896
4902
|
]
|
|
4903
|
+
}).catch(() => {
|
|
4897
4904
|
});
|
|
4898
4905
|
if (workspace) {
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4906
|
+
setImmediate(async () => {
|
|
4907
|
+
try {
|
|
4908
|
+
const fileContents = await scanWorkspaceFiles(workspaceRoot);
|
|
4909
|
+
console.error("[spindle-lsp] scanned", fileContents.size, "files from root:", workspaceRoot ?? "undefined");
|
|
4910
|
+
workspace.initialize(fileContents);
|
|
4911
|
+
console.error("[spindle-lsp] workspace initialized, macros:", workspace.macros.getAllMacros().length);
|
|
4912
|
+
} catch (err) {
|
|
4913
|
+
console.error("[spindle-lsp] workspace scan failed:", err);
|
|
4914
|
+
}
|
|
4915
|
+
});
|
|
4903
4916
|
}
|
|
4904
4917
|
});
|
|
4905
4918
|
connection.onDidOpenTextDocument(({ textDocument }) => {
|