@rohal12/spindle-lsp 0.3.1 → 0.3.3

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
@@ -1048,6 +1048,8 @@ var init_workspace_model = __esm({
1048
1048
  this.macros = new MacroRegistry();
1049
1049
  this.variables = new VariableTracker();
1050
1050
  this.widgets = new WidgetRegistry();
1051
+ this.macros.loadBuiltins();
1052
+ this.macros.loadSupplements(macro_supplements_default);
1051
1053
  this.onDocumentChanged = (uri) => this.handleDocumentChange(uri);
1052
1054
  this.onDocumentOpened = (uri) => this.handleDocumentChange(uri);
1053
1055
  this.onDocumentClosed = (uri) => this.handleDocumentClose(uri);
@@ -1060,8 +1062,6 @@ var init_workspace_model = __esm({
1060
1062
  * Loads all file contents, builds indices, and emits 'modelReady'.
1061
1063
  */
1062
1064
  initialize(fileContents) {
1063
- this.macros.loadBuiltins();
1064
- this.macros.loadSupplements(macro_supplements_default);
1065
1065
  this.documents.removeListener("documentOpened", this.onDocumentOpened);
1066
1066
  this.documents.removeListener("documentChanged", this.onDocumentChanged);
1067
1067
  for (const [uri, text] of fileContents) {
@@ -4860,6 +4860,7 @@ function startServer(_args) {
4860
4860
  let activePlugins = [];
4861
4861
  let workspaceRoot;
4862
4862
  connection.onInitialize((params) => {
4863
+ console.error("[spindle-lsp] onInitialize called");
4863
4864
  const initOptions = params.initializationOptions ?? {};
4864
4865
  workspaceRoot = initOptions.workspaceRoot ?? (params.workspaceFolders?.[0]?.uri ? uriToFsPath(params.workspaceFolders[0].uri) : void 0);
4865
4866
  const projectConfig = workspaceRoot ? loadConfigFromDisk(workspaceRoot) : { macros: {} };
@@ -4869,18 +4870,21 @@ function startServer(_args) {
4869
4870
  workspaceRoot
4870
4871
  };
4871
4872
  workspace = new WorkspaceModel();
4873
+ console.error("[spindle-lsp] workspaceRoot:", workspaceRoot ?? "undefined");
4872
4874
  activePlugins = loadPlugins(allPlugins, config);
4875
+ console.error("[spindle-lsp] plugins loaded:", activePlugins.map((p) => p.id).join(", "));
4873
4876
  for (const plugin of activePlugins) {
4874
4877
  plugin.initialize({ connection, workspace, config });
4875
4878
  }
4876
4879
  if (Object.keys(projectConfig.macros).length > 0) {
4877
4880
  workspace.macros.loadSupplements(projectConfig.macros);
4881
+ console.error("[spindle-lsp] loaded config macros:", Object.keys(projectConfig.macros).length);
4878
4882
  }
4879
4883
  return {
4880
4884
  capabilities: buildCapabilities(activePlugins)
4881
4885
  };
4882
4886
  });
4883
- connection.onInitialized(async () => {
4887
+ connection.onInitialized(() => {
4884
4888
  connection.client.register(DidChangeWatchedFilesNotification.type, {
4885
4889
  watchers: [
4886
4890
  { globPattern: "**/*.tw" },
@@ -4890,10 +4894,19 @@ function startServer(_args) {
4890
4894
  { globPattern: "**/spindle.config.*" },
4891
4895
  { globPattern: "**/*twee-config.*" }
4892
4896
  ]
4897
+ }).catch(() => {
4893
4898
  });
4894
4899
  if (workspace) {
4895
- const fileContents = await scanWorkspaceFiles(workspaceRoot);
4896
- workspace.initialize(fileContents);
4900
+ setImmediate(async () => {
4901
+ try {
4902
+ const fileContents = await scanWorkspaceFiles(workspaceRoot);
4903
+ console.error("[spindle-lsp] scanned", fileContents.size, "files from root:", workspaceRoot ?? "undefined");
4904
+ workspace.initialize(fileContents);
4905
+ console.error("[spindle-lsp] workspace initialized, macros:", workspace.macros.getAllMacros().length);
4906
+ } catch (err) {
4907
+ console.error("[spindle-lsp] workspace scan failed:", err);
4908
+ }
4909
+ });
4897
4910
  }
4898
4911
  });
4899
4912
  connection.onDidOpenTextDocument(({ textDocument }) => {