@rejot-dev/thalo 0.0.0

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.
Files changed (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +396 -0
  3. package/dist/ast/ast-types.d.ts +469 -0
  4. package/dist/ast/ast-types.d.ts.map +1 -0
  5. package/dist/ast/ast-types.js +11 -0
  6. package/dist/ast/ast-types.js.map +1 -0
  7. package/dist/ast/builder.js +158 -0
  8. package/dist/ast/builder.js.map +1 -0
  9. package/dist/ast/extract.js +748 -0
  10. package/dist/ast/extract.js.map +1 -0
  11. package/dist/ast/node-at-position.d.ts +147 -0
  12. package/dist/ast/node-at-position.d.ts.map +1 -0
  13. package/dist/ast/node-at-position.js +382 -0
  14. package/dist/ast/node-at-position.js.map +1 -0
  15. package/dist/ast/visitor.js +232 -0
  16. package/dist/ast/visitor.js.map +1 -0
  17. package/dist/checker/check.d.ts +53 -0
  18. package/dist/checker/check.d.ts.map +1 -0
  19. package/dist/checker/check.js +105 -0
  20. package/dist/checker/check.js.map +1 -0
  21. package/dist/checker/rules/actualize-missing-updated.js +34 -0
  22. package/dist/checker/rules/actualize-missing-updated.js.map +1 -0
  23. package/dist/checker/rules/actualize-unresolved-target.js +42 -0
  24. package/dist/checker/rules/actualize-unresolved-target.js.map +1 -0
  25. package/dist/checker/rules/alter-before-define.js +53 -0
  26. package/dist/checker/rules/alter-before-define.js.map +1 -0
  27. package/dist/checker/rules/alter-undefined-entity.js +32 -0
  28. package/dist/checker/rules/alter-undefined-entity.js.map +1 -0
  29. package/dist/checker/rules/create-requires-section.js +34 -0
  30. package/dist/checker/rules/create-requires-section.js.map +1 -0
  31. package/dist/checker/rules/define-entity-requires-section.js +31 -0
  32. package/dist/checker/rules/define-entity-requires-section.js.map +1 -0
  33. package/dist/checker/rules/duplicate-entity-definition.js +37 -0
  34. package/dist/checker/rules/duplicate-entity-definition.js.map +1 -0
  35. package/dist/checker/rules/duplicate-field-in-schema.js +38 -0
  36. package/dist/checker/rules/duplicate-field-in-schema.js.map +1 -0
  37. package/dist/checker/rules/duplicate-link-id.js +52 -0
  38. package/dist/checker/rules/duplicate-link-id.js.map +1 -0
  39. package/dist/checker/rules/duplicate-metadata-key.js +21 -0
  40. package/dist/checker/rules/duplicate-metadata-key.js.map +1 -0
  41. package/dist/checker/rules/duplicate-section-heading.js +41 -0
  42. package/dist/checker/rules/duplicate-section-heading.js.map +1 -0
  43. package/dist/checker/rules/duplicate-section-in-schema.js +38 -0
  44. package/dist/checker/rules/duplicate-section-in-schema.js.map +1 -0
  45. package/dist/checker/rules/duplicate-timestamp.js +104 -0
  46. package/dist/checker/rules/duplicate-timestamp.js.map +1 -0
  47. package/dist/checker/rules/empty-required-value.js +45 -0
  48. package/dist/checker/rules/empty-required-value.js.map +1 -0
  49. package/dist/checker/rules/empty-section.js +21 -0
  50. package/dist/checker/rules/empty-section.js.map +1 -0
  51. package/dist/checker/rules/invalid-date-range-value.js +56 -0
  52. package/dist/checker/rules/invalid-date-range-value.js.map +1 -0
  53. package/dist/checker/rules/invalid-default-value.js +86 -0
  54. package/dist/checker/rules/invalid-default-value.js.map +1 -0
  55. package/dist/checker/rules/invalid-field-type.js +45 -0
  56. package/dist/checker/rules/invalid-field-type.js.map +1 -0
  57. package/dist/checker/rules/missing-required-field.js +48 -0
  58. package/dist/checker/rules/missing-required-field.js.map +1 -0
  59. package/dist/checker/rules/missing-required-section.js +51 -0
  60. package/dist/checker/rules/missing-required-section.js.map +1 -0
  61. package/dist/checker/rules/missing-title.js +56 -0
  62. package/dist/checker/rules/missing-title.js.map +1 -0
  63. package/dist/checker/rules/remove-undefined-field.js +42 -0
  64. package/dist/checker/rules/remove-undefined-field.js.map +1 -0
  65. package/dist/checker/rules/remove-undefined-section.js +42 -0
  66. package/dist/checker/rules/remove-undefined-section.js.map +1 -0
  67. package/dist/checker/rules/rules.d.ts +71 -0
  68. package/dist/checker/rules/rules.d.ts.map +1 -0
  69. package/dist/checker/rules/rules.js +102 -0
  70. package/dist/checker/rules/rules.js.map +1 -0
  71. package/dist/checker/rules/synthesis-empty-query.js +35 -0
  72. package/dist/checker/rules/synthesis-empty-query.js.map +1 -0
  73. package/dist/checker/rules/synthesis-missing-prompt.js +42 -0
  74. package/dist/checker/rules/synthesis-missing-prompt.js.map +1 -0
  75. package/dist/checker/rules/synthesis-missing-sources.js +32 -0
  76. package/dist/checker/rules/synthesis-missing-sources.js.map +1 -0
  77. package/dist/checker/rules/synthesis-unknown-query-entity.js +39 -0
  78. package/dist/checker/rules/synthesis-unknown-query-entity.js.map +1 -0
  79. package/dist/checker/rules/timestamp-out-of-order.js +55 -0
  80. package/dist/checker/rules/timestamp-out-of-order.js.map +1 -0
  81. package/dist/checker/rules/unknown-entity.js +32 -0
  82. package/dist/checker/rules/unknown-entity.js.map +1 -0
  83. package/dist/checker/rules/unknown-field.js +40 -0
  84. package/dist/checker/rules/unknown-field.js.map +1 -0
  85. package/dist/checker/rules/unknown-section.js +47 -0
  86. package/dist/checker/rules/unknown-section.js.map +1 -0
  87. package/dist/checker/rules/unresolved-link.js +34 -0
  88. package/dist/checker/rules/unresolved-link.js.map +1 -0
  89. package/dist/checker/rules/update-without-create.js +65 -0
  90. package/dist/checker/rules/update-without-create.js.map +1 -0
  91. package/dist/checker/visitor.d.ts +69 -0
  92. package/dist/checker/visitor.d.ts.map +1 -0
  93. package/dist/checker/visitor.js +67 -0
  94. package/dist/checker/visitor.js.map +1 -0
  95. package/dist/checker/workspace-index.d.ts +50 -0
  96. package/dist/checker/workspace-index.d.ts.map +1 -0
  97. package/dist/checker/workspace-index.js +108 -0
  98. package/dist/checker/workspace-index.js.map +1 -0
  99. package/dist/commands/actualize.d.ts +113 -0
  100. package/dist/commands/actualize.d.ts.map +1 -0
  101. package/dist/commands/actualize.js +111 -0
  102. package/dist/commands/actualize.js.map +1 -0
  103. package/dist/commands/check.d.ts +65 -0
  104. package/dist/commands/check.d.ts.map +1 -0
  105. package/dist/commands/check.js +61 -0
  106. package/dist/commands/check.js.map +1 -0
  107. package/dist/commands/format.d.ts +90 -0
  108. package/dist/commands/format.d.ts.map +1 -0
  109. package/dist/commands/format.js +80 -0
  110. package/dist/commands/format.js.map +1 -0
  111. package/dist/commands/query.d.ts +152 -0
  112. package/dist/commands/query.d.ts.map +1 -0
  113. package/dist/commands/query.js +151 -0
  114. package/dist/commands/query.js.map +1 -0
  115. package/dist/constants.d.ts +31 -0
  116. package/dist/constants.d.ts.map +1 -0
  117. package/dist/constants.js +51 -0
  118. package/dist/constants.js.map +1 -0
  119. package/dist/files.d.ts +58 -0
  120. package/dist/files.d.ts.map +1 -0
  121. package/dist/files.js +103 -0
  122. package/dist/files.js.map +1 -0
  123. package/dist/formatters.d.ts +39 -0
  124. package/dist/formatters.d.ts.map +1 -0
  125. package/dist/formatters.js +200 -0
  126. package/dist/formatters.js.map +1 -0
  127. package/dist/fragment.d.ts +22 -0
  128. package/dist/fragment.d.ts.map +1 -0
  129. package/dist/git/git.js +240 -0
  130. package/dist/git/git.js.map +1 -0
  131. package/dist/merge/conflict-detector.d.ts +89 -0
  132. package/dist/merge/conflict-detector.d.ts.map +1 -0
  133. package/dist/merge/conflict-detector.js +352 -0
  134. package/dist/merge/conflict-detector.js.map +1 -0
  135. package/dist/merge/conflict-formatter.js +143 -0
  136. package/dist/merge/conflict-formatter.js.map +1 -0
  137. package/dist/merge/driver.d.ts +54 -0
  138. package/dist/merge/driver.d.ts.map +1 -0
  139. package/dist/merge/driver.js +112 -0
  140. package/dist/merge/driver.js.map +1 -0
  141. package/dist/merge/entry-matcher.d.ts +50 -0
  142. package/dist/merge/entry-matcher.d.ts.map +1 -0
  143. package/dist/merge/entry-matcher.js +141 -0
  144. package/dist/merge/entry-matcher.js.map +1 -0
  145. package/dist/merge/entry-merger.js +194 -0
  146. package/dist/merge/entry-merger.js.map +1 -0
  147. package/dist/merge/merge-result-builder.d.ts +62 -0
  148. package/dist/merge/merge-result-builder.d.ts.map +1 -0
  149. package/dist/merge/merge-result-builder.js +89 -0
  150. package/dist/merge/merge-result-builder.js.map +1 -0
  151. package/dist/mod.d.ts +31 -0
  152. package/dist/mod.js +23 -0
  153. package/dist/model/document.d.ts +134 -0
  154. package/dist/model/document.d.ts.map +1 -0
  155. package/dist/model/document.js +275 -0
  156. package/dist/model/document.js.map +1 -0
  157. package/dist/model/line-index.d.ts +85 -0
  158. package/dist/model/line-index.d.ts.map +1 -0
  159. package/dist/model/line-index.js +159 -0
  160. package/dist/model/line-index.js.map +1 -0
  161. package/dist/model/workspace.d.ts +296 -0
  162. package/dist/model/workspace.d.ts.map +1 -0
  163. package/dist/model/workspace.js +562 -0
  164. package/dist/model/workspace.js.map +1 -0
  165. package/dist/parser.js +27 -0
  166. package/dist/parser.js.map +1 -0
  167. package/dist/parser.native.d.ts +51 -0
  168. package/dist/parser.native.d.ts.map +1 -0
  169. package/dist/parser.native.js +62 -0
  170. package/dist/parser.native.js.map +1 -0
  171. package/dist/parser.shared.d.ts +99 -0
  172. package/dist/parser.shared.d.ts.map +1 -0
  173. package/dist/parser.shared.js +124 -0
  174. package/dist/parser.shared.js.map +1 -0
  175. package/dist/parser.web.d.ts +67 -0
  176. package/dist/parser.web.d.ts.map +1 -0
  177. package/dist/parser.web.js +49 -0
  178. package/dist/parser.web.js.map +1 -0
  179. package/dist/schema/registry.d.ts +108 -0
  180. package/dist/schema/registry.d.ts.map +1 -0
  181. package/dist/schema/registry.js +281 -0
  182. package/dist/schema/registry.js.map +1 -0
  183. package/dist/semantic/analyzer.d.ts +107 -0
  184. package/dist/semantic/analyzer.d.ts.map +1 -0
  185. package/dist/semantic/analyzer.js +261 -0
  186. package/dist/semantic/analyzer.js.map +1 -0
  187. package/dist/services/change-tracker/change-tracker.d.ts +111 -0
  188. package/dist/services/change-tracker/change-tracker.d.ts.map +1 -0
  189. package/dist/services/change-tracker/change-tracker.js +62 -0
  190. package/dist/services/change-tracker/change-tracker.js.map +1 -0
  191. package/dist/services/change-tracker/create-tracker.d.ts +42 -0
  192. package/dist/services/change-tracker/create-tracker.d.ts.map +1 -0
  193. package/dist/services/change-tracker/create-tracker.js +53 -0
  194. package/dist/services/change-tracker/create-tracker.js.map +1 -0
  195. package/dist/services/change-tracker/git-tracker.d.ts +59 -0
  196. package/dist/services/change-tracker/git-tracker.d.ts.map +1 -0
  197. package/dist/services/change-tracker/git-tracker.js +218 -0
  198. package/dist/services/change-tracker/git-tracker.js.map +1 -0
  199. package/dist/services/change-tracker/timestamp-tracker.d.ts +22 -0
  200. package/dist/services/change-tracker/timestamp-tracker.d.ts.map +1 -0
  201. package/dist/services/change-tracker/timestamp-tracker.js +74 -0
  202. package/dist/services/change-tracker/timestamp-tracker.js.map +1 -0
  203. package/dist/services/definition.d.ts +37 -0
  204. package/dist/services/definition.d.ts.map +1 -0
  205. package/dist/services/definition.js +43 -0
  206. package/dist/services/definition.js.map +1 -0
  207. package/dist/services/entity-navigation.d.ts +200 -0
  208. package/dist/services/entity-navigation.d.ts.map +1 -0
  209. package/dist/services/entity-navigation.js +211 -0
  210. package/dist/services/entity-navigation.js.map +1 -0
  211. package/dist/services/hover.d.ts +81 -0
  212. package/dist/services/hover.d.ts.map +1 -0
  213. package/dist/services/hover.js +669 -0
  214. package/dist/services/hover.js.map +1 -0
  215. package/dist/services/query.d.ts +116 -0
  216. package/dist/services/query.d.ts.map +1 -0
  217. package/dist/services/query.js +225 -0
  218. package/dist/services/query.js.map +1 -0
  219. package/dist/services/references.d.ts +52 -0
  220. package/dist/services/references.d.ts.map +1 -0
  221. package/dist/services/references.js +66 -0
  222. package/dist/services/references.js.map +1 -0
  223. package/dist/services/semantic-tokens.d.ts +54 -0
  224. package/dist/services/semantic-tokens.d.ts.map +1 -0
  225. package/dist/services/semantic-tokens.js +213 -0
  226. package/dist/services/semantic-tokens.js.map +1 -0
  227. package/dist/services/synthesis.d.ts +90 -0
  228. package/dist/services/synthesis.d.ts.map +1 -0
  229. package/dist/services/synthesis.js +113 -0
  230. package/dist/services/synthesis.js.map +1 -0
  231. package/dist/source-map.d.ts +42 -0
  232. package/dist/source-map.d.ts.map +1 -0
  233. package/dist/source-map.js +170 -0
  234. package/dist/source-map.js.map +1 -0
  235. package/package.json +128 -0
  236. package/tree-sitter-thalo.wasm +0 -0
  237. package/web-tree-sitter.wasm +0 -0
@@ -0,0 +1,200 @@
1
+ import { Entry, InstanceEntry, Location, SchemaEntry } from "../ast/ast-types.js";
2
+ import { Workspace } from "../model/workspace.js";
3
+
4
+ //#region src/services/entity-navigation.d.ts
5
+
6
+ /**
7
+ * Result of finding an entity definition (define-entity)
8
+ */
9
+ interface EntityDefinitionResult {
10
+ /** The file containing the definition */
11
+ file: string;
12
+ /** Location of the definition */
13
+ location: Location;
14
+ /** The schema entry that defines this entity */
15
+ entry: SchemaEntry;
16
+ }
17
+ /**
18
+ * A reference to an entity (instance entry using that entity type)
19
+ */
20
+ interface EntityReferenceLocation {
21
+ /** The file containing the reference */
22
+ file: string;
23
+ /** Location of the entry using this entity */
24
+ location: Location;
25
+ /** The instance entry using this entity */
26
+ entry: InstanceEntry | SchemaEntry;
27
+ /** Whether this is the definition (always false for entity refs) */
28
+ isDefinition: boolean;
29
+ }
30
+ /**
31
+ * Result of finding entity references
32
+ */
33
+ interface EntityReferencesResult {
34
+ /** The entity name */
35
+ entityName: string;
36
+ /** The definition (if it exists) */
37
+ definition: EntityDefinitionResult | undefined;
38
+ /** All instance entries using this entity */
39
+ references: EntityReferenceLocation[];
40
+ /** All locations (definition + references if includeDefinition) */
41
+ locations: (EntityDefinitionResult | EntityReferenceLocation)[];
42
+ }
43
+ /**
44
+ * Find the define-entity for an entity name
45
+ *
46
+ * @param workspace - The workspace to search in
47
+ * @param entityName - The entity name to find
48
+ * @returns The definition result, or undefined if not found
49
+ */
50
+ declare function findEntityDefinition(workspace: Workspace, entityName: string): EntityDefinitionResult | undefined;
51
+ /**
52
+ * Find all references to an entity type
53
+ *
54
+ * @param workspace - The workspace to search in
55
+ * @param entityName - The entity name to find references for
56
+ * @param includeDefinition - Whether to include the definition in results
57
+ * @returns The references result
58
+ */
59
+ declare function findEntityReferences(workspace: Workspace, entityName: string, includeDefinition?: boolean): EntityReferencesResult;
60
+ /**
61
+ * A reference to a tag (entry with that tag)
62
+ */
63
+ interface TagReferenceLocation {
64
+ /** The file containing the reference */
65
+ file: string;
66
+ /** Location of the entry with this tag */
67
+ location: Location;
68
+ /** The entry with this tag */
69
+ entry: Entry;
70
+ }
71
+ /**
72
+ * Result of finding tag references
73
+ */
74
+ interface TagReferencesResult {
75
+ /** The tag name (without # prefix) */
76
+ tagName: string;
77
+ /** All entries with this tag */
78
+ references: TagReferenceLocation[];
79
+ }
80
+ /**
81
+ * Find all entries with a given tag
82
+ *
83
+ * @param workspace - The workspace to search in
84
+ * @param tagName - The tag name (without # prefix)
85
+ * @returns The references result
86
+ */
87
+ declare function findTagReferences(workspace: Workspace, tagName: string): TagReferencesResult;
88
+ /**
89
+ * Result of finding a field definition
90
+ */
91
+ interface FieldDefinitionResult {
92
+ /** The file containing the definition */
93
+ file: string;
94
+ /** Location of the field definition */
95
+ location: Location;
96
+ /** The entity name this field belongs to */
97
+ entityName: string;
98
+ /** The schema entry containing this field */
99
+ schemaEntry: SchemaEntry;
100
+ }
101
+ /**
102
+ * A reference to a field (instance entry using that metadata key)
103
+ */
104
+ interface FieldReferenceLocation {
105
+ /** The file containing the reference */
106
+ file: string;
107
+ /** Location of the metadata line */
108
+ location: Location;
109
+ /** The instance entry using this field */
110
+ entry: InstanceEntry;
111
+ }
112
+ /**
113
+ * Result of finding field references
114
+ */
115
+ interface FieldReferencesResult {
116
+ /** The field name */
117
+ fieldName: string;
118
+ /** The entity context (if known) */
119
+ entityName: string | undefined;
120
+ /** The definition (if it exists) */
121
+ definition: FieldDefinitionResult | undefined;
122
+ /** All instance entries using this field */
123
+ references: FieldReferenceLocation[];
124
+ }
125
+ /**
126
+ * Find the field definition in a schema
127
+ *
128
+ * @param workspace - The workspace to search in
129
+ * @param fieldName - The field name to find
130
+ * @param entityName - Optional entity name to constrain the search
131
+ * @returns The definition result, or undefined if not found
132
+ */
133
+ declare function findFieldDefinition(workspace: Workspace, fieldName: string, entityName?: string): FieldDefinitionResult | undefined;
134
+ /**
135
+ * Find all references to a field
136
+ *
137
+ * @param workspace - The workspace to search in
138
+ * @param fieldName - The field name to find references for
139
+ * @param entityName - Optional entity name to constrain the search
140
+ * @returns The references result
141
+ */
142
+ declare function findFieldReferences(workspace: Workspace, fieldName: string, entityName?: string): FieldReferencesResult;
143
+ /**
144
+ * Result of finding a section definition
145
+ */
146
+ interface SectionDefinitionResult {
147
+ /** The file containing the definition */
148
+ file: string;
149
+ /** Location of the section definition */
150
+ location: Location;
151
+ /** The entity name this section belongs to */
152
+ entityName: string;
153
+ /** The schema entry containing this section */
154
+ schemaEntry: SchemaEntry;
155
+ }
156
+ /**
157
+ * A reference to a section (instance entry with that section)
158
+ */
159
+ interface SectionReferenceLocation {
160
+ /** The file containing the reference */
161
+ file: string;
162
+ /** Location of the entry with this section */
163
+ location: Location;
164
+ /** The instance entry with this section */
165
+ entry: InstanceEntry;
166
+ }
167
+ /**
168
+ * Result of finding section references
169
+ */
170
+ interface SectionReferencesResult {
171
+ /** The section name */
172
+ sectionName: string;
173
+ /** The entity context (if known) */
174
+ entityName: string | undefined;
175
+ /** The definition (if it exists) */
176
+ definition: SectionDefinitionResult | undefined;
177
+ /** All instance entries with this section */
178
+ references: SectionReferenceLocation[];
179
+ }
180
+ /**
181
+ * Find the section definition in a schema
182
+ *
183
+ * @param workspace - The workspace to search in
184
+ * @param sectionName - The section name to find
185
+ * @param entityName - Optional entity name to constrain the search
186
+ * @returns The definition result, or undefined if not found
187
+ */
188
+ declare function findSectionDefinition(workspace: Workspace, sectionName: string, entityName?: string): SectionDefinitionResult | undefined;
189
+ /**
190
+ * Find all references to a section
191
+ *
192
+ * @param workspace - The workspace to search in
193
+ * @param sectionName - The section name to find references for
194
+ * @param entityName - Optional entity name to constrain the search
195
+ * @returns The references result
196
+ */
197
+ declare function findSectionReferences(workspace: Workspace, sectionName: string, entityName?: string): SectionReferencesResult;
198
+ //#endregion
199
+ export { EntityDefinitionResult, EntityReferenceLocation, EntityReferencesResult, FieldDefinitionResult, FieldReferenceLocation, FieldReferencesResult, SectionDefinitionResult, SectionReferenceLocation, SectionReferencesResult, TagReferenceLocation, TagReferencesResult, findEntityDefinition, findEntityReferences, findFieldDefinition, findFieldReferences, findSectionDefinition, findSectionReferences, findTagReferences };
200
+ //# sourceMappingURL=entity-navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-navigation.d.ts","names":[],"sources":["../../src/services/entity-navigation.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAYiB,UAZA,sBAAA,CAYuB;EAI5B;EAEH,IAAA,EAAA,MAAA;EAAgB;EAAW,QAAA,EAdxB,QAcwB;EAQnB;EAIH,KAAA,EAxBL,WAwBK;;;;;AAcE,UAhCC,uBAAA,CAiCJ;EA6BG;EA0DC,IAAA,EAAA,MAAA;EAYA;EA+BD,QAAA,EA/JJ,QA+JI;EA4BC;EAcA,KAAA,EAvMR,aAuMQ,GAvMQ,WAuMc;EAYtB;EAmBD,YAAA,EAAA,OAAA;AAwDhB;AA8CA;AAcA;AAYA;AAmCgB,UAjYC,sBAAA,CAiYoB;EA0DrB;;;cAvbF;;cAEA;;cAEA,yBAAyB;;;;;;;;;iBAUvB,oBAAA,YACH,gCAEV;;;;;;;;;iBA2Ba,oBAAA,YACH,6DAGV;;;;UAsDc,oBAAA;;;;YAIL;;SAEH;;;;;UAMQ,mBAAA;;;;cAIH;;;;;;;;;iBA2BE,iBAAA,YAA6B,6BAA6B;;;;UA4BzD,qBAAA;;;;YAIL;;;;eAIG;;;;;UAME,sBAAA;;;;YAIL;;SAEH;;;;;UAMQ,qBAAA;;;;;;cAMH;;cAEA;;;;;;;;;;iBAWE,mBAAA,YACH,oDAGV;;;;;;;;;iBAoDa,mBAAA,YACH,oDAGV;;;;UA0Cc,uBAAA;;;;YAIL;;;;eAIG;;;;;UAME,wBAAA;;;;YAIL;;SAEH;;;;;UAMQ,uBAAA;;;;;;cAMH;;cAEA;;;;;;;;;;iBA2BE,qBAAA,YACH,sDAGV;;;;;;;;;iBAsDa,qBAAA,YACH,sDAGV"}
@@ -0,0 +1,211 @@
1
+ //#region src/services/entity-navigation.ts
2
+ /**
3
+ * Find the define-entity for an entity name
4
+ *
5
+ * @param workspace - The workspace to search in
6
+ * @param entityName - The entity name to find
7
+ * @returns The definition result, or undefined if not found
8
+ */
9
+ function findEntityDefinition(workspace, entityName) {
10
+ for (const model of workspace.allModels()) for (const entry of model.ast.entries) if (entry.type === "schema_entry" && entry.header.directive === "define-entity" && entry.header.entityName.value === entityName) return {
11
+ file: model.file,
12
+ location: entry.location,
13
+ entry
14
+ };
15
+ }
16
+ /**
17
+ * Find all references to an entity type
18
+ *
19
+ * @param workspace - The workspace to search in
20
+ * @param entityName - The entity name to find references for
21
+ * @param includeDefinition - Whether to include the definition in results
22
+ * @returns The references result
23
+ */
24
+ function findEntityReferences(workspace, entityName, includeDefinition = true) {
25
+ const definition = findEntityDefinition(workspace, entityName);
26
+ const references = [];
27
+ for (const model of workspace.allModels()) for (const entry of model.ast.entries) {
28
+ if (entry.type === "instance_entry" && entry.header.entity === entityName) references.push({
29
+ file: model.file,
30
+ location: entry.location,
31
+ entry,
32
+ isDefinition: false
33
+ });
34
+ if (entry.type === "schema_entry" && entry.header.directive === "alter-entity" && entry.header.entityName.value === entityName) references.push({
35
+ file: model.file,
36
+ location: entry.location,
37
+ entry,
38
+ isDefinition: false
39
+ });
40
+ }
41
+ const locations = [];
42
+ if (includeDefinition && definition) locations.push(definition);
43
+ locations.push(...references);
44
+ return {
45
+ entityName,
46
+ definition,
47
+ references,
48
+ locations
49
+ };
50
+ }
51
+ /**
52
+ * Get tags from an entry
53
+ */
54
+ function getEntryTags(entry) {
55
+ switch (entry.type) {
56
+ case "instance_entry": return entry.header.tags.map((t) => t.name);
57
+ case "schema_entry": return entry.header.tags.map((t) => t.name);
58
+ case "synthesis_entry": return entry.header.tags.map((t) => t.name);
59
+ case "actualize_entry": return [];
60
+ }
61
+ }
62
+ /**
63
+ * Find all entries with a given tag
64
+ *
65
+ * @param workspace - The workspace to search in
66
+ * @param tagName - The tag name (without # prefix)
67
+ * @returns The references result
68
+ */
69
+ function findTagReferences(workspace, tagName) {
70
+ const references = [];
71
+ for (const model of workspace.allModels()) for (const entry of model.ast.entries) if (getEntryTags(entry).includes(tagName)) references.push({
72
+ file: model.file,
73
+ location: entry.location,
74
+ entry
75
+ });
76
+ return {
77
+ tagName,
78
+ references
79
+ };
80
+ }
81
+ /**
82
+ * Find the field definition in a schema
83
+ *
84
+ * @param workspace - The workspace to search in
85
+ * @param fieldName - The field name to find
86
+ * @param entityName - Optional entity name to constrain the search
87
+ * @returns The definition result, or undefined if not found
88
+ */
89
+ function findFieldDefinition(workspace, fieldName, entityName) {
90
+ if (entityName) {
91
+ const schema = workspace.schemaRegistry.get(entityName);
92
+ if (schema) {
93
+ if (schema.fields.get(fieldName)) for (const model of workspace.allModels()) for (const entry of model.ast.entries) {
94
+ if (entry.type !== "schema_entry") continue;
95
+ if (entry.header.entityName.value !== entityName) continue;
96
+ const fieldDef = entry.metadataBlock?.fields.find((f) => f.name.value === fieldName);
97
+ if (fieldDef) return {
98
+ file: model.file,
99
+ location: fieldDef.location,
100
+ entityName,
101
+ schemaEntry: entry
102
+ };
103
+ }
104
+ }
105
+ return;
106
+ }
107
+ for (const schemaEntityName of workspace.schemaRegistry.entityNames()) {
108
+ const result = findFieldDefinition(workspace, fieldName, schemaEntityName);
109
+ if (result) return result;
110
+ }
111
+ }
112
+ /**
113
+ * Find all references to a field
114
+ *
115
+ * @param workspace - The workspace to search in
116
+ * @param fieldName - The field name to find references for
117
+ * @param entityName - Optional entity name to constrain the search
118
+ * @returns The references result
119
+ */
120
+ function findFieldReferences(workspace, fieldName, entityName) {
121
+ const definition = findFieldDefinition(workspace, fieldName, entityName);
122
+ const references = [];
123
+ for (const model of workspace.allModels()) for (const entry of model.ast.entries) {
124
+ if (entry.type !== "instance_entry") continue;
125
+ if (entityName && entry.header.entity !== entityName) continue;
126
+ const meta = entry.metadata.find((m) => m.key.value === fieldName);
127
+ if (meta) references.push({
128
+ file: model.file,
129
+ location: meta.location,
130
+ entry
131
+ });
132
+ }
133
+ return {
134
+ fieldName,
135
+ entityName,
136
+ definition,
137
+ references
138
+ };
139
+ }
140
+ /**
141
+ * Get section names from an instance entry
142
+ */
143
+ function getEntrySections(entry) {
144
+ if (!entry.content) return [];
145
+ return entry.content.children.filter((c) => c.type === "markdown_header").map((h) => {
146
+ const match = h.text.match(/^#+\s*(.+)$/);
147
+ return match ? match[1].trim() : h.text;
148
+ });
149
+ }
150
+ /**
151
+ * Find the section definition in a schema
152
+ *
153
+ * @param workspace - The workspace to search in
154
+ * @param sectionName - The section name to find
155
+ * @param entityName - Optional entity name to constrain the search
156
+ * @returns The definition result, or undefined if not found
157
+ */
158
+ function findSectionDefinition(workspace, sectionName, entityName) {
159
+ if (entityName) {
160
+ const schema = workspace.schemaRegistry.get(entityName);
161
+ if (schema) {
162
+ if (schema.sections.get(sectionName)) for (const model of workspace.allModels()) for (const entry of model.ast.entries) {
163
+ if (entry.type !== "schema_entry") continue;
164
+ if (entry.header.entityName.value !== entityName) continue;
165
+ const sectionDef = entry.sectionsBlock?.sections.find((s) => s.name.value === sectionName);
166
+ if (sectionDef) return {
167
+ file: model.file,
168
+ location: sectionDef.location,
169
+ entityName,
170
+ schemaEntry: entry
171
+ };
172
+ }
173
+ }
174
+ return;
175
+ }
176
+ for (const schemaEntityName of workspace.schemaRegistry.entityNames()) {
177
+ const result = findSectionDefinition(workspace, sectionName, schemaEntityName);
178
+ if (result) return result;
179
+ }
180
+ }
181
+ /**
182
+ * Find all references to a section
183
+ *
184
+ * @param workspace - The workspace to search in
185
+ * @param sectionName - The section name to find references for
186
+ * @param entityName - Optional entity name to constrain the search
187
+ * @returns The references result
188
+ */
189
+ function findSectionReferences(workspace, sectionName, entityName) {
190
+ const definition = findSectionDefinition(workspace, sectionName, entityName);
191
+ const references = [];
192
+ for (const model of workspace.allModels()) for (const entry of model.ast.entries) {
193
+ if (entry.type !== "instance_entry") continue;
194
+ if (entityName && entry.header.entity !== entityName) continue;
195
+ if (getEntrySections(entry).includes(sectionName)) references.push({
196
+ file: model.file,
197
+ location: entry.location,
198
+ entry
199
+ });
200
+ }
201
+ return {
202
+ sectionName,
203
+ entityName,
204
+ definition,
205
+ references
206
+ };
207
+ }
208
+
209
+ //#endregion
210
+ export { findEntityDefinition, findEntityReferences, findFieldDefinition, findFieldReferences, findSectionDefinition, findSectionReferences, findTagReferences };
211
+ //# sourceMappingURL=entity-navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-navigation.js","names":["references: EntityReferenceLocation[]","locations: (EntityDefinitionResult | EntityReferenceLocation)[]","references: TagReferenceLocation[]","references: FieldReferenceLocation[]","references: SectionReferenceLocation[]"],"sources":["../../src/services/entity-navigation.ts"],"sourcesContent":["import type { Workspace } from \"../model/workspace.js\";\nimport type { Location, Entry, SchemaEntry, InstanceEntry } from \"../ast/ast-types.js\";\n\n// ===================\n// Entity Navigation\n// ===================\n\n/**\n * Result of finding an entity definition (define-entity)\n */\nexport interface EntityDefinitionResult {\n /** The file containing the definition */\n file: string;\n /** Location of the definition */\n location: Location;\n /** The schema entry that defines this entity */\n entry: SchemaEntry;\n}\n\n/**\n * A reference to an entity (instance entry using that entity type)\n */\nexport interface EntityReferenceLocation {\n /** The file containing the reference */\n file: string;\n /** Location of the entry using this entity */\n location: Location;\n /** The instance entry using this entity */\n entry: InstanceEntry | SchemaEntry;\n /** Whether this is the definition (always false for entity refs) */\n isDefinition: boolean;\n}\n\n/**\n * Result of finding entity references\n */\nexport interface EntityReferencesResult {\n /** The entity name */\n entityName: string;\n /** The definition (if it exists) */\n definition: EntityDefinitionResult | undefined;\n /** All instance entries using this entity */\n references: EntityReferenceLocation[];\n /** All locations (definition + references if includeDefinition) */\n locations: (EntityDefinitionResult | EntityReferenceLocation)[];\n}\n\n/**\n * Find the define-entity for an entity name\n *\n * @param workspace - The workspace to search in\n * @param entityName - The entity name to find\n * @returns The definition result, or undefined if not found\n */\nexport function findEntityDefinition(\n workspace: Workspace,\n entityName: string,\n): EntityDefinitionResult | undefined {\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (\n entry.type === \"schema_entry\" &&\n entry.header.directive === \"define-entity\" &&\n entry.header.entityName.value === entityName\n ) {\n return {\n file: model.file,\n location: entry.location,\n entry,\n };\n }\n }\n }\n return undefined;\n}\n\n/**\n * Find all references to an entity type\n *\n * @param workspace - The workspace to search in\n * @param entityName - The entity name to find references for\n * @param includeDefinition - Whether to include the definition in results\n * @returns The references result\n */\nexport function findEntityReferences(\n workspace: Workspace,\n entityName: string,\n includeDefinition = true,\n): EntityReferencesResult {\n const definition = findEntityDefinition(workspace, entityName);\n\n // Find all instance entries using this entity\n const references: EntityReferenceLocation[] = [];\n\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (entry.type === \"instance_entry\" && entry.header.entity === entityName) {\n references.push({\n file: model.file,\n location: entry.location,\n entry,\n isDefinition: false,\n });\n }\n\n // Also find alter-entity entries that reference this entity\n if (\n entry.type === \"schema_entry\" &&\n entry.header.directive === \"alter-entity\" &&\n entry.header.entityName.value === entityName\n ) {\n references.push({\n file: model.file,\n location: entry.location,\n entry,\n isDefinition: false,\n });\n }\n }\n }\n\n const locations: (EntityDefinitionResult | EntityReferenceLocation)[] = [];\n if (includeDefinition && definition) {\n locations.push(definition);\n }\n locations.push(...references);\n\n return {\n entityName,\n definition,\n references,\n locations,\n };\n}\n\n// ===================\n// Tag Navigation\n// ===================\n\n/**\n * A reference to a tag (entry with that tag)\n */\nexport interface TagReferenceLocation {\n /** The file containing the reference */\n file: string;\n /** Location of the entry with this tag */\n location: Location;\n /** The entry with this tag */\n entry: Entry;\n}\n\n/**\n * Result of finding tag references\n */\nexport interface TagReferencesResult {\n /** The tag name (without # prefix) */\n tagName: string;\n /** All entries with this tag */\n references: TagReferenceLocation[];\n}\n\n/**\n * Get tags from an entry\n */\nfunction getEntryTags(entry: Entry): string[] {\n switch (entry.type) {\n case \"instance_entry\":\n return entry.header.tags.map((t) => t.name);\n case \"schema_entry\":\n return entry.header.tags.map((t) => t.name);\n case \"synthesis_entry\":\n return entry.header.tags.map((t) => t.name);\n case \"actualize_entry\":\n // Actualize entries don't have tags\n return [];\n }\n}\n\n/**\n * Find all entries with a given tag\n *\n * @param workspace - The workspace to search in\n * @param tagName - The tag name (without # prefix)\n * @returns The references result\n */\nexport function findTagReferences(workspace: Workspace, tagName: string): TagReferencesResult {\n const references: TagReferenceLocation[] = [];\n\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (getEntryTags(entry).includes(tagName)) {\n references.push({\n file: model.file,\n location: entry.location,\n entry,\n });\n }\n }\n }\n\n return {\n tagName,\n references,\n };\n}\n\n// ===================\n// Metadata Field Navigation\n// ===================\n\n/**\n * Result of finding a field definition\n */\nexport interface FieldDefinitionResult {\n /** The file containing the definition */\n file: string;\n /** Location of the field definition */\n location: Location;\n /** The entity name this field belongs to */\n entityName: string;\n /** The schema entry containing this field */\n schemaEntry: SchemaEntry;\n}\n\n/**\n * A reference to a field (instance entry using that metadata key)\n */\nexport interface FieldReferenceLocation {\n /** The file containing the reference */\n file: string;\n /** Location of the metadata line */\n location: Location;\n /** The instance entry using this field */\n entry: InstanceEntry;\n}\n\n/**\n * Result of finding field references\n */\nexport interface FieldReferencesResult {\n /** The field name */\n fieldName: string;\n /** The entity context (if known) */\n entityName: string | undefined;\n /** The definition (if it exists) */\n definition: FieldDefinitionResult | undefined;\n /** All instance entries using this field */\n references: FieldReferenceLocation[];\n}\n\n/**\n * Find the field definition in a schema\n *\n * @param workspace - The workspace to search in\n * @param fieldName - The field name to find\n * @param entityName - Optional entity name to constrain the search\n * @returns The definition result, or undefined if not found\n */\nexport function findFieldDefinition(\n workspace: Workspace,\n fieldName: string,\n entityName?: string,\n): FieldDefinitionResult | undefined {\n // If entityName is provided, look in that entity's schema\n if (entityName) {\n const schema = workspace.schemaRegistry.get(entityName);\n if (schema) {\n const field = schema.fields.get(fieldName);\n if (field) {\n // Find the schema entry that defines this field\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (entry.type !== \"schema_entry\") {\n continue;\n }\n if (entry.header.entityName.value !== entityName) {\n continue;\n }\n\n const fieldDef = entry.metadataBlock?.fields.find((f) => f.name.value === fieldName);\n if (fieldDef) {\n return {\n file: model.file,\n location: fieldDef.location,\n entityName,\n schemaEntry: entry,\n };\n }\n }\n }\n }\n }\n return undefined;\n }\n\n // Without entityName, search all schemas\n for (const schemaEntityName of workspace.schemaRegistry.entityNames()) {\n const result = findFieldDefinition(workspace, fieldName, schemaEntityName);\n if (result) {\n return result;\n }\n }\n\n return undefined;\n}\n\n/**\n * Find all references to a field\n *\n * @param workspace - The workspace to search in\n * @param fieldName - The field name to find references for\n * @param entityName - Optional entity name to constrain the search\n * @returns The references result\n */\nexport function findFieldReferences(\n workspace: Workspace,\n fieldName: string,\n entityName?: string,\n): FieldReferencesResult {\n const definition = findFieldDefinition(workspace, fieldName, entityName);\n\n const references: FieldReferenceLocation[] = [];\n\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (entry.type !== \"instance_entry\") {\n continue;\n }\n\n // If entityName is specified, only look at entries of that entity type\n if (entityName && entry.header.entity !== entityName) {\n continue;\n }\n\n const meta = entry.metadata.find((m) => m.key.value === fieldName);\n if (meta) {\n references.push({\n file: model.file,\n location: meta.location,\n entry,\n });\n }\n }\n }\n\n return {\n fieldName,\n entityName,\n definition,\n references,\n };\n}\n\n// ===================\n// Section Navigation\n// ===================\n\n/**\n * Result of finding a section definition\n */\nexport interface SectionDefinitionResult {\n /** The file containing the definition */\n file: string;\n /** Location of the section definition */\n location: Location;\n /** The entity name this section belongs to */\n entityName: string;\n /** The schema entry containing this section */\n schemaEntry: SchemaEntry;\n}\n\n/**\n * A reference to a section (instance entry with that section)\n */\nexport interface SectionReferenceLocation {\n /** The file containing the reference */\n file: string;\n /** Location of the entry with this section */\n location: Location;\n /** The instance entry with this section */\n entry: InstanceEntry;\n}\n\n/**\n * Result of finding section references\n */\nexport interface SectionReferencesResult {\n /** The section name */\n sectionName: string;\n /** The entity context (if known) */\n entityName: string | undefined;\n /** The definition (if it exists) */\n definition: SectionDefinitionResult | undefined;\n /** All instance entries with this section */\n references: SectionReferenceLocation[];\n}\n\n/**\n * Get section names from an instance entry\n */\nfunction getEntrySections(entry: InstanceEntry): string[] {\n if (!entry.content) {\n return [];\n }\n return entry.content.children\n .filter((c) => c.type === \"markdown_header\")\n .map((h) => {\n // Extract section name from \"# SectionName\" format\n const match = h.text.match(/^#+\\s*(.+)$/);\n return match ? match[1].trim() : h.text;\n });\n}\n\n/**\n * Find the section definition in a schema\n *\n * @param workspace - The workspace to search in\n * @param sectionName - The section name to find\n * @param entityName - Optional entity name to constrain the search\n * @returns The definition result, or undefined if not found\n */\nexport function findSectionDefinition(\n workspace: Workspace,\n sectionName: string,\n entityName?: string,\n): SectionDefinitionResult | undefined {\n // If entityName is provided, look in that entity's schema\n if (entityName) {\n const schema = workspace.schemaRegistry.get(entityName);\n if (schema) {\n const section = schema.sections.get(sectionName);\n if (section) {\n // Find the schema entry that defines this section\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (entry.type !== \"schema_entry\") {\n continue;\n }\n if (entry.header.entityName.value !== entityName) {\n continue;\n }\n\n const sectionDef = entry.sectionsBlock?.sections.find(\n (s) => s.name.value === sectionName,\n );\n if (sectionDef) {\n return {\n file: model.file,\n location: sectionDef.location,\n entityName,\n schemaEntry: entry,\n };\n }\n }\n }\n }\n }\n return undefined;\n }\n\n // Without entityName, search all schemas\n for (const schemaEntityName of workspace.schemaRegistry.entityNames()) {\n const result = findSectionDefinition(workspace, sectionName, schemaEntityName);\n if (result) {\n return result;\n }\n }\n\n return undefined;\n}\n\n/**\n * Find all references to a section\n *\n * @param workspace - The workspace to search in\n * @param sectionName - The section name to find references for\n * @param entityName - Optional entity name to constrain the search\n * @returns The references result\n */\nexport function findSectionReferences(\n workspace: Workspace,\n sectionName: string,\n entityName?: string,\n): SectionReferencesResult {\n const definition = findSectionDefinition(workspace, sectionName, entityName);\n\n const references: SectionReferenceLocation[] = [];\n\n for (const model of workspace.allModels()) {\n for (const entry of model.ast.entries) {\n if (entry.type !== \"instance_entry\") {\n continue;\n }\n\n // If entityName is specified, only look at entries of that entity type\n if (entityName && entry.header.entity !== entityName) {\n continue;\n }\n\n if (getEntrySections(entry).includes(sectionName)) {\n references.push({\n file: model.file,\n location: entry.location,\n entry,\n });\n }\n }\n }\n\n return {\n sectionName,\n entityName,\n definition,\n references,\n };\n}\n"],"mappings":";;;;;;;;AAsDA,SAAgB,qBACd,WACA,YACoC;AACpC,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,QAC5B,KACE,MAAM,SAAS,kBACf,MAAM,OAAO,cAAc,mBAC3B,MAAM,OAAO,WAAW,UAAU,WAElC,QAAO;EACL,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB;EACD;;;;;;;;;;AAeT,SAAgB,qBACd,WACA,YACA,oBAAoB,MACI;CACxB,MAAM,aAAa,qBAAqB,WAAW,WAAW;CAG9D,MAAMA,aAAwC,EAAE;AAEhD,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,SAAS;AACrC,MAAI,MAAM,SAAS,oBAAoB,MAAM,OAAO,WAAW,WAC7D,YAAW,KAAK;GACd,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB;GACA,cAAc;GACf,CAAC;AAIJ,MACE,MAAM,SAAS,kBACf,MAAM,OAAO,cAAc,kBAC3B,MAAM,OAAO,WAAW,UAAU,WAElC,YAAW,KAAK;GACd,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB;GACA,cAAc;GACf,CAAC;;CAKR,MAAMC,YAAkE,EAAE;AAC1E,KAAI,qBAAqB,WACvB,WAAU,KAAK,WAAW;AAE5B,WAAU,KAAK,GAAG,WAAW;AAE7B,QAAO;EACL;EACA;EACA;EACA;EACD;;;;;AAgCH,SAAS,aAAa,OAAwB;AAC5C,SAAQ,MAAM,MAAd;EACE,KAAK,iBACH,QAAO,MAAM,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK;EAC7C,KAAK,eACH,QAAO,MAAM,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK;EAC7C,KAAK,kBACH,QAAO,MAAM,OAAO,KAAK,KAAK,MAAM,EAAE,KAAK;EAC7C,KAAK,kBAEH,QAAO,EAAE;;;;;;;;;;AAWf,SAAgB,kBAAkB,WAAsB,SAAsC;CAC5F,MAAMC,aAAqC,EAAE;AAE7C,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,QAC5B,KAAI,aAAa,MAAM,CAAC,SAAS,QAAQ,CACvC,YAAW,KAAK;EACd,MAAM,MAAM;EACZ,UAAU,MAAM;EAChB;EACD,CAAC;AAKR,QAAO;EACL;EACA;EACD;;;;;;;;;;AAuDH,SAAgB,oBACd,WACA,WACA,YACmC;AAEnC,KAAI,YAAY;EACd,MAAM,SAAS,UAAU,eAAe,IAAI,WAAW;AACvD,MAAI,QAEF;OADc,OAAO,OAAO,IAAI,UAAU,CAGxC,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,SAAS;AACrC,QAAI,MAAM,SAAS,eACjB;AAEF,QAAI,MAAM,OAAO,WAAW,UAAU,WACpC;IAGF,MAAM,WAAW,MAAM,eAAe,OAAO,MAAM,MAAM,EAAE,KAAK,UAAU,UAAU;AACpF,QAAI,SACF,QAAO;KACL,MAAM,MAAM;KACZ,UAAU,SAAS;KACnB;KACA,aAAa;KACd;;;AAMX;;AAIF,MAAK,MAAM,oBAAoB,UAAU,eAAe,aAAa,EAAE;EACrE,MAAM,SAAS,oBAAoB,WAAW,WAAW,iBAAiB;AAC1E,MAAI,OACF,QAAO;;;;;;;;;;;AAeb,SAAgB,oBACd,WACA,WACA,YACuB;CACvB,MAAM,aAAa,oBAAoB,WAAW,WAAW,WAAW;CAExE,MAAMC,aAAuC,EAAE;AAE/C,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,SAAS;AACrC,MAAI,MAAM,SAAS,iBACjB;AAIF,MAAI,cAAc,MAAM,OAAO,WAAW,WACxC;EAGF,MAAM,OAAO,MAAM,SAAS,MAAM,MAAM,EAAE,IAAI,UAAU,UAAU;AAClE,MAAI,KACF,YAAW,KAAK;GACd,MAAM,MAAM;GACZ,UAAU,KAAK;GACf;GACD,CAAC;;AAKR,QAAO;EACL;EACA;EACA;EACA;EACD;;;;;AAkDH,SAAS,iBAAiB,OAAgC;AACxD,KAAI,CAAC,MAAM,QACT,QAAO,EAAE;AAEX,QAAO,MAAM,QAAQ,SAClB,QAAQ,MAAM,EAAE,SAAS,kBAAkB,CAC3C,KAAK,MAAM;EAEV,MAAM,QAAQ,EAAE,KAAK,MAAM,cAAc;AACzC,SAAO,QAAQ,MAAM,GAAG,MAAM,GAAG,EAAE;GACnC;;;;;;;;;;AAWN,SAAgB,sBACd,WACA,aACA,YACqC;AAErC,KAAI,YAAY;EACd,MAAM,SAAS,UAAU,eAAe,IAAI,WAAW;AACvD,MAAI,QAEF;OADgB,OAAO,SAAS,IAAI,YAAY,CAG9C,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,SAAS;AACrC,QAAI,MAAM,SAAS,eACjB;AAEF,QAAI,MAAM,OAAO,WAAW,UAAU,WACpC;IAGF,MAAM,aAAa,MAAM,eAAe,SAAS,MAC9C,MAAM,EAAE,KAAK,UAAU,YACzB;AACD,QAAI,WACF,QAAO;KACL,MAAM,MAAM;KACZ,UAAU,WAAW;KACrB;KACA,aAAa;KACd;;;AAMX;;AAIF,MAAK,MAAM,oBAAoB,UAAU,eAAe,aAAa,EAAE;EACrE,MAAM,SAAS,sBAAsB,WAAW,aAAa,iBAAiB;AAC9E,MAAI,OACF,QAAO;;;;;;;;;;;AAeb,SAAgB,sBACd,WACA,aACA,YACyB;CACzB,MAAM,aAAa,sBAAsB,WAAW,aAAa,WAAW;CAE5E,MAAMC,aAAyC,EAAE;AAEjD,MAAK,MAAM,SAAS,UAAU,WAAW,CACvC,MAAK,MAAM,SAAS,MAAM,IAAI,SAAS;AACrC,MAAI,MAAM,SAAS,iBACjB;AAIF,MAAI,cAAc,MAAM,OAAO,WAAW,WACxC;AAGF,MAAI,iBAAiB,MAAM,CAAC,SAAS,YAAY,CAC/C,YAAW,KAAK;GACd,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB;GACD,CAAC;;AAKR,QAAO;EACL;EACA;EACA;EACA;EACD"}
@@ -0,0 +1,81 @@
1
+ import { ActualizeEntry, Entry, InstanceEntry, Location, SchemaEntry, SynthesisEntry } from "../ast/ast-types.js";
2
+ import { EntitySchema, FieldSchema, SectionSchema } from "../schema/registry.js";
3
+ import { Workspace } from "../model/workspace.js";
4
+ import { NodeContext } from "../ast/node-at-position.js";
5
+
6
+ //#region src/services/hover.d.ts
7
+
8
+ /**
9
+ * Result of a hover lookup
10
+ */
11
+ interface HoverResult {
12
+ /** Markdown content to display */
13
+ content: string;
14
+ /** Optional range to highlight (file-absolute) */
15
+ range?: Location;
16
+ }
17
+ /**
18
+ * Format an entry for hover display
19
+ */
20
+ declare function formatEntryHover(entry: Entry, file: string): string;
21
+ /**
22
+ * Format an instance entry for hover
23
+ */
24
+ declare function formatInstanceEntry(entry: InstanceEntry, file: string): string;
25
+ /**
26
+ * Format a schema entry for hover
27
+ */
28
+ declare function formatSchemaEntry(entry: SchemaEntry, file: string): string;
29
+ /**
30
+ * Format a synthesis entry for hover
31
+ */
32
+ declare function formatSynthesisEntry(entry: SynthesisEntry, file: string): string;
33
+ /**
34
+ * Format an actualize entry for hover
35
+ */
36
+ declare function formatActualizeEntry(entry: ActualizeEntry, file: string): string;
37
+ /**
38
+ * Get documentation for a directive
39
+ */
40
+ declare function getDirectiveDocumentation(directive: string): string | null;
41
+ /**
42
+ * Format an entity schema for hover display
43
+ */
44
+ declare function formatEntitySchema(schema: EntitySchema): string;
45
+ /**
46
+ * Format a field schema for hover display
47
+ */
48
+ declare function formatFieldHover(field: FieldSchema, entityName: string): string;
49
+ /**
50
+ * Format a section schema for hover display
51
+ */
52
+ declare function formatSectionHover(section: SectionSchema, entityName: string): string;
53
+ /**
54
+ * Get documentation for a primitive type
55
+ */
56
+ declare function getPrimitiveTypeDocumentation(typeName: string): string | null;
57
+ /**
58
+ * Format tag hover information
59
+ */
60
+ declare function formatTagHover(tag: string, entries: {
61
+ entry: Entry;
62
+ file: string;
63
+ }[]): string;
64
+ /**
65
+ * Format timestamp hover
66
+ */
67
+ declare function formatTimestampHover(timestamp: string, entry: Entry | undefined, _file?: string): string;
68
+ /**
69
+ * Get hover information for a node context.
70
+ *
71
+ * This function takes a semantic node context (from findNodeAtPosition) and
72
+ * returns hover information including markdown content and an optional range.
73
+ *
74
+ * @param workspace - The workspace to look up entries, schemas, etc.
75
+ * @param context - The node context from findNodeAtPosition
76
+ * @returns Hover result with markdown content, or null if no hover info
77
+ */
78
+ declare function getHoverInfo(workspace: Workspace, context: NodeContext): HoverResult | null;
79
+ //#endregion
80
+ export { HoverResult, formatActualizeEntry, formatEntitySchema, formatEntryHover, formatFieldHover, formatInstanceEntry, formatSchemaEntry, formatSectionHover, formatSynthesisEntry, formatTagHover, formatTimestampHover, getDirectiveDocumentation, getHoverInfo, getPrimitiveTypeDocumentation };
81
+ //# sourceMappingURL=hover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover.d.ts","names":[],"sources":["../../src/services/hover.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAuBA;AA+BgB,UA/BC,WAAA,CA+Be;EAgBhB;EAkDA,OAAA,EAAA,MAAA;EA2CA;EAmCA,KAAA,CAAA,EA3KN,QA2KM;AA+BhB;AAgJA;AA8CA;AA6BA;AA2BgB,iBAraA,gBAAA,CAqa6B,KAAA,EAraL,KAqaK,EAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AA6F7C;AAiDA;AA+DA;AAAwC,iBAlmBxB,mBAAA,CAkmBwB,KAAA,EAlmBG,aAkmBH,EAAA,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;iBAhjBxB,iBAAA,QAAyB;;;;iBA2CzB,oBAAA,QAA4B;;;;iBAmC5B,oBAAA,QAA4B;;;;iBA+B5B,yBAAA;;;;iBAgJA,kBAAA,SAA2B;;;;iBA8C3B,gBAAA,QAAwB;;;;iBA6BxB,kBAAA,UAA4B;;;;iBA2B5B,6BAAA;;;;iBA6FA,cAAA;SAA8C;;;;;;iBAiD9C,oBAAA,2BAEP;;;;;;;;;;;iBA6DO,YAAA,YAAwB,oBAAoB,cAAc"}