@px-lsp/server 0.1.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 (163) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +334 -0
  3. package/THIRD-PARTY-NOTICES.md +83 -0
  4. package/data/ck3/dataTypes.json +2195 -0
  5. package/data/ck3/data_types/data_types_common.txt +2040 -0
  6. package/data/ck3/data_types/data_types_gui.txt +5264 -0
  7. package/data/ck3/data_types/data_types_internalclausewitzgui.txt +14843 -0
  8. package/data/ck3/data_types/data_types_script.txt +4251 -0
  9. package/data/ck3/data_types/data_types_uncategorized.txt +109984 -0
  10. package/data/ck3/freqs.json +1 -0
  11. package/data/ck3/guiSchema.json +6344 -0
  12. package/data/ck3/script_docs/effects.log +16059 -0
  13. package/data/ck3/script_docs/event_targets.log +2098 -0
  14. package/data/ck3/script_docs/modifiers.log +2228 -0
  15. package/data/ck3/script_docs/on_actions.log +5275 -0
  16. package/data/ck3/script_docs/triggers.log +11991 -0
  17. package/data/ck3/structures.json +9743 -0
  18. package/data/ck3/wikidocs/ATTRIBUTION.md +18 -0
  19. package/data/ck3/wikidocs/Data_types.md +2568 -0
  20. package/data/ck3/wikidocs/Effects_list.md +1176 -0
  21. package/data/ck3/wikidocs/Scopes_list.md +341 -0
  22. package/data/ck3/wikidocs/Triggers_list.md +1097 -0
  23. package/data/eu5/data_types/data_types_common.txt +2087 -0
  24. package/data/eu5/data_types/data_types_gui.txt +6732 -0
  25. package/data/eu5/data_types/data_types_internalclausewitzgui.txt +19276 -0
  26. package/data/eu5/data_types/data_types_script.txt +5688 -0
  27. package/data/eu5/data_types/data_types_uncategorized.txt +135569 -0
  28. package/data/vic3/data_types/data_types_common.txt +2021 -0
  29. package/data/vic3/data_types/data_types_gui.txt +5592 -0
  30. package/data/vic3/data_types/data_types_internalclausewitzgui.txt +17304 -0
  31. package/data/vic3/data_types/data_types_script.txt +2817 -0
  32. package/data/vic3/data_types/data_types_uncategorized.txt +84354 -0
  33. package/data/vic3/freqs.json +1 -0
  34. package/data/vic3/guiSchema.json +5578 -0
  35. package/data/vic3/script_docs/effects.log +38135 -0
  36. package/data/vic3/script_docs/event_targets.log +2028 -0
  37. package/data/vic3/script_docs/modifiers.log +18954 -0
  38. package/data/vic3/script_docs/on_actions.log +1561 -0
  39. package/data/vic3/script_docs/triggers.log +15738 -0
  40. package/data/vic3/structures.json +10189 -0
  41. package/dist/server.js +63668 -0
  42. package/media/px-lsp.svg +12 -0
  43. package/package.json +50 -0
  44. package/src/clientMode.ts +60 -0
  45. package/src/coa/coa.ts +184 -0
  46. package/src/coa/coaParse.ts +267 -0
  47. package/src/context.ts +78 -0
  48. package/src/contextKeywords.ts +224 -0
  49. package/src/data/dataBindingMacros.ts +82 -0
  50. package/src/data/dataFnDocs.ts +152 -0
  51. package/src/data/dataFnUsage.ts +431 -0
  52. package/src/data/dataTypes.ts +279 -0
  53. package/src/data/defines.ts +123 -0
  54. package/src/data/docsParser.ts +453 -0
  55. package/src/data/keywordDocs.ts +98 -0
  56. package/src/data/modifierTemplates.ts +143 -0
  57. package/src/data/textFormatting.ts +165 -0
  58. package/src/data/wikiDocs.ts +187 -0
  59. package/src/dds/decoder.ts +1007 -0
  60. package/src/dds/encode.ts +235 -0
  61. package/src/dds/index.ts +58 -0
  62. package/src/dds/png.ts +96 -0
  63. package/src/dds/tga.ts +62 -0
  64. package/src/documents.ts +35 -0
  65. package/src/features/assetPaths.ts +169 -0
  66. package/src/features/codeActions.ts +148 -0
  67. package/src/features/colors.ts +244 -0
  68. package/src/features/completion.ts +961 -0
  69. package/src/features/datafunction.ts +729 -0
  70. package/src/features/definition.ts +84 -0
  71. package/src/features/diagnostics.ts +244 -0
  72. package/src/features/folding.ts +106 -0
  73. package/src/features/formatting.ts +60 -0
  74. package/src/features/guiLanguage.ts +366 -0
  75. package/src/features/guiNavigation.ts +140 -0
  76. package/src/features/guiTree.ts +97 -0
  77. package/src/features/hover.ts +817 -0
  78. package/src/features/hoverRender.ts +222 -0
  79. package/src/features/inlayHints.ts +147 -0
  80. package/src/features/locFormatting.ts +127 -0
  81. package/src/features/references.ts +70 -0
  82. package/src/features/rename.ts +135 -0
  83. package/src/features/scopeAt.ts +65 -0
  84. package/src/features/semanticTokens.ts +188 -0
  85. package/src/features/signatureHelp.ts +72 -0
  86. package/src/features/symbols.ts +241 -0
  87. package/src/features/textureHover.ts +143 -0
  88. package/src/features/workspaceSymbols.ts +69 -0
  89. package/src/games/active.ts +19 -0
  90. package/src/games/ck3/ambientScopes.ts +273 -0
  91. package/src/games/ck3/index.ts +38 -0
  92. package/src/games/ck3/meta.ts +28 -0
  93. package/src/games/ck3/modifierPlaceholders.ts +61 -0
  94. package/src/games/ck3/saveSchema.ts +134 -0
  95. package/src/games/ck3/scaffolds.ts +197 -0
  96. package/src/games/ck3/schema.ts +422 -0
  97. package/src/games/ck3/structures.ts +887 -0
  98. package/src/games/eu5/index.ts +75 -0
  99. package/src/games/eu5/meta.ts +44 -0
  100. package/src/games/eu5/scaffolds.ts +49 -0
  101. package/src/games/eu5/schema.generated.ts +1043 -0
  102. package/src/games/jomini/variables.ts +134 -0
  103. package/src/games/profile.ts +205 -0
  104. package/src/games/registry.ts +27 -0
  105. package/src/games/vic3/index.ts +52 -0
  106. package/src/games/vic3/meta.ts +55 -0
  107. package/src/games/vic3/saveSchema.ts +77 -0
  108. package/src/games/vic3/scaffolds.ts +135 -0
  109. package/src/games/vic3/schema.ts +650 -0
  110. package/src/games/vic3/structures.ts +33 -0
  111. package/src/gui/anchorSpec.ts +66 -0
  112. package/src/gui/declMarkers.ts +30 -0
  113. package/src/gui/fillGeometry.ts +101 -0
  114. package/src/gui/guiDefs.ts +386 -0
  115. package/src/gui/guiDependencies.ts +352 -0
  116. package/src/gui/guiLinks.ts +64 -0
  117. package/src/gui/layoutEngine.ts +1998 -0
  118. package/src/gui/layoutService.ts +221 -0
  119. package/src/gui/measuredMetrics.ts +21 -0
  120. package/src/gui/previewService.ts +89 -0
  121. package/src/gui/saveSchema.ts +220 -0
  122. package/src/gui/saveValues.ts +399 -0
  123. package/src/gui/saveZip.ts +60 -0
  124. package/src/gui/sourceEdit.ts +535 -0
  125. package/src/gui/sourceEditService.ts +439 -0
  126. package/src/gui/sourceModel.ts +603 -0
  127. package/src/gui/textResolve.ts +145 -0
  128. package/src/gui/textureInfo.ts +106 -0
  129. package/src/gui/vocabulary.ts +149 -0
  130. package/src/gui/widgetEdit.ts +52 -0
  131. package/src/gui/widgetInfo.ts +245 -0
  132. package/src/index/docComments.ts +103 -0
  133. package/src/index/extract.ts +252 -0
  134. package/src/index/indexer.ts +369 -0
  135. package/src/index/intern.ts +101 -0
  136. package/src/index/lazyRefs.ts +145 -0
  137. package/src/index/modOrigin.ts +69 -0
  138. package/src/index/references.ts +534 -0
  139. package/src/overview/dependencies.ts +240 -0
  140. package/src/overview/eventBanner.ts +95 -0
  141. package/src/overview/eventDetail.ts +482 -0
  142. package/src/overview/eventGraph.ts +617 -0
  143. package/src/overview/eventVocabulary.ts +214 -0
  144. package/src/overview/locCoverage.ts +138 -0
  145. package/src/overview/modOverview.ts +29 -0
  146. package/src/overview/overrides.ts +89 -0
  147. package/src/parseCache.ts +81 -0
  148. package/src/parser/cst.ts +257 -0
  149. package/src/parser/encoding.ts +106 -0
  150. package/src/parser/index.ts +7 -0
  151. package/src/parser/lexer.ts +245 -0
  152. package/src/parser/locParser.ts +276 -0
  153. package/src/parser/parser.ts +360 -0
  154. package/src/schema/freqs.ts +70 -0
  155. package/src/schema/loader.ts +113 -0
  156. package/src/schema/types.ts +142 -0
  157. package/src/scopes/inference.ts +478 -0
  158. package/src/scopes/model.ts +148 -0
  159. package/src/scopes/varTypes.ts +290 -0
  160. package/src/server.ts +1894 -0
  161. package/src/serverData.ts +98 -0
  162. package/src/structure.ts +56 -0
  163. package/src/wordAt.ts +49 -0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The Europa Universalis V game profile (preview). Same cut line as Vic3: no
3
+ * guiDefs, no data-type chains, no wiki fallback — completion/hover/definition/
4
+ * references/structural diagnostics is the bar. No tiger exists for EU5.
5
+ *
6
+ * COMMUNITY-SOURCED AND UNVERIFIED: the schema table below is imported
7
+ * wholesale from the community CWT rules (see schema.generated.ts for the
8
+ * upstream, commit and license) and has NOT been checked against a live EU5
9
+ * install. Folder→kind mappings are only as right as those rules are; report
10
+ * gaps with the "Schema gap" issue form, and work around them locally with the
11
+ * `<mod>/.eu5modding/schema.json` overlay.
12
+ */
13
+ import type { GameProfile } from "../profile";
14
+ import type { RefField, SchemaEntry } from "../../schema/types";
15
+ import { JOMINI_VARIABLE_BLOCK_REFS } from "../jomini/variables";
16
+ import { eu5Meta } from "./meta";
17
+ import { EU5_SCHEMA } from "./schema.generated";
18
+
19
+ /**
20
+ * Deliberately tiny. A wrong entry here is worse than a missing one: it turns
21
+ * every use site into a false "unresolved reference" diagnostic. Every key
22
+ * below is declared as a `<type>` reference by the CWT config AND confirmed by
23
+ * EU5's own `script_docs` dumps (effects.log / triggers.log), and all but
24
+ * `has_law` also appear in the MEIOU-and-Taxes corpus.
25
+ *
26
+ * Notably absent: `trigger_event`. EU5 renamed it — the engine only knows
27
+ * `trigger_event_silently` / `trigger_event_non_silently` (effects.log), and
28
+ * the corpus uses those two exclusively. Also absent: `add_trait` /
29
+ * `remove_trait`, which take a trait *scope* in EU5 (`scope[trait]`), not a
30
+ * trait definition name, so wiring them would be a pure false-positive source.
31
+ */
32
+ const EU5_REF_FIELDS: RefField[] = [
33
+ // Events & on_actions. Both trigger_event_* effects take either a bare event
34
+ // id or a block (`{ id = X }` / `{ on_action = X }`); only the scalar form
35
+ // resolves through a refField, which is the common shape in the corpus.
36
+ { key: "trigger_event_silently", kinds: ["event"] },
37
+ { key: "trigger_event_non_silently", kinds: ["event"] },
38
+ { key: "has_fired_unique_event", kinds: ["event"] },
39
+ // `events = { ... }` and `on_actions = { ... }` inside on_action definitions
40
+ // and the trigger_event blocks are bare name lists.
41
+ { key: "events", kinds: ["event"], form: "list" },
42
+ { key: "on_actions", kinds: ["on_action"], form: "list" },
43
+ // Country-scope triggers over the three biggest hand-authored databases.
44
+ { key: "has_advance", kinds: ["advance"] },
45
+ { key: "has_law", kinds: ["law"] },
46
+ { key: "has_trait", kinds: ["trait"] },
47
+ ];
48
+
49
+ /**
50
+ * Hand-written rows on top of the imported table. The CWT config has no gui
51
+ * types, so the `gui` row is added here: `type X = base { … }` /
52
+ * `template X { … }` extraction is engine behaviour, the same in every Jomini
53
+ * title, so it holds without a live install. Only the flat root is claimed;
54
+ * whether EU5 also loads `<stage>/gui` is one of the open questions in the
55
+ * calibration package (docs/gui-designer/calibration/eu5-package/).
56
+ */
57
+ const EU5_HAND_ENTRIES: SchemaEntry[] = [
58
+ { path: "gui", kind: "gui_type", ext: ".gui", extraction: "gui-type" },
59
+ ];
60
+
61
+ export const eu5Profile: GameProfile = {
62
+ ...eu5Meta,
63
+ schema: [...EU5_SCHEMA, ...EU5_HAND_ENTRIES],
64
+ refFields: EU5_REF_FIELDS,
65
+ // No verified scalar-prefix references yet (EU5's `culture:x`-style links come
66
+ // from the CWT scope_links table, which the importer does not read).
67
+ prefixRefs: {},
68
+ blockRefFields: { ...JOMINI_VARIABLE_BLOCK_REFS },
69
+ // No `_*.info` docs ship with EU5, so the structures layer has no source.
70
+ structureSources: {},
71
+ modifierPlaceholders: {},
72
+ // No bundled wiki tokens in the preview cut, so nothing ever renders this.
73
+ wikiNote: "",
74
+ diagnosticSource: "eu5-script",
75
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Europa Universalis V identity and conventions. Data only — safe for the
3
+ * VSCode client to import without pulling the knowledge tables into its
4
+ * bundle. Community-sourced support: the schema table derives from
5
+ * cwtools-eu5-config (see schema.generated.ts) and is not yet verified
6
+ * against a live install.
7
+ */
8
+ import type { GameMeta } from "../profile";
9
+ import { EU5_SCAFFOLDS } from "./scaffolds";
10
+
11
+ export const eu5Meta: GameMeta = {
12
+ id: "eu5",
13
+ name: "Europa Universalis V",
14
+ shortName: "EU5",
15
+ engine: "jomini",
16
+ // EU5 mods carry .metadata/metadata.json (plus a required thumbnail.png);
17
+ // descriptor.mod is at most a vestigial launcher artifact.
18
+ descriptor: "metadata",
19
+ configDirName: ".eu5modding",
20
+ docsFolderName: "Europa Universalis V",
21
+ // EU5's `script_docs` console command writes to Documents/.../docs, not logs/.
22
+ scriptDocsSubdir: "docs",
23
+ dataTypesCommand: "dump_data_types",
24
+ steamAppId: 3450310,
25
+ eventNamespaces: true,
26
+ scaffolds: EU5_SCAFFOLDS,
27
+ // uiFont and guiTextMetrics deliberately absent: neither the font file nor
28
+ // any text box has been measured, so the GUI editor refuses to open for this
29
+ // game until the calibration pack returns
30
+ // (docs/gui-designer/calibration/eu5-package/).
31
+ // All EU5 content sits under one of three load-stage folders at the mod
32
+ // root; gameplay script lives under in_game/. Schema paths carry the
33
+ // prefix; this list drives mod detection.
34
+ stageRoots: ["in_game", "main_menu", "loading_screen"],
35
+ // Database entry modes: `REPLACE:key = { ... }` etc. are legal top-level
36
+ // definition keys in most common/ folders (not on_action or defines).
37
+ entryModes: ["INJECT", "REPLACE", "TRY_INJECT", "TRY_REPLACE", "INJECT_OR_CREATE", "REPLACE_OR_CREATE"],
38
+ // EU5's script_docs dumps are markdown (`## name`), with modifiers as
39
+ // `Tag: name, Categories: ...` lines.
40
+ scriptDocs: { format: "markdown", modifiers: "tag-line" },
41
+ // No eu5-tiger exists (amtep/tiger covers ck3/vic3/imperator only).
42
+ cacheSuffix: "-eu5",
43
+ flagBuilder: true,
44
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Europa Universalis V "New Content" templates. Nothing here is verified
3
+ * against a live install (nobody on the team owns the game), so only the two
4
+ * content types whose whole shape is engine-generic are offered: a scripted
5
+ * effect and a scripted trigger are a bare `name = { }` block, and their
6
+ * folders come from the community CWT rules (schema.generated.ts:
7
+ * in_game/common/scripted_effects, in_game/common/scripted_triggers).
8
+ *
9
+ * Events, on_action hooks and database content wait for the calibration pack
10
+ * (docs/gui-designer/calibration/eu5-package/): a template whose keys we cannot
11
+ * check would create exactly the silent failure this command exists to prevent.
12
+ *
13
+ * The `in_game/` stage prefix is NOT written here; the writer adds
14
+ * `stageRoots[0]` to every path.
15
+ */
16
+ import type { ScaffoldTemplate } from "../profile";
17
+
18
+ export const EU5_SCAFFOLDS: ScaffoldTemplate[] = [
19
+ {
20
+ id: "scripted_effect",
21
+ label: "$(symbol-method) Scripted effect",
22
+ detail: "common/scripted_effects/ (with a PdxDoc stub)",
23
+ nameLabel: "effect",
24
+ nameKind: "identifier",
25
+ scriptPath: "common/scripted_effects/$PREFIX$_scripted_effects.txt",
26
+ cursorMarker: "# effects here",
27
+ // No `@scope` line: the scope names are unverified for this game.
28
+ block: `# What this does.
29
+ # @param EXAMPLE_PARAM describe each $PARAM$ the caller must pass
30
+ $NAME$ = {
31
+ # effects here
32
+ }
33
+ `,
34
+ },
35
+ {
36
+ id: "scripted_trigger",
37
+ label: "$(symbol-boolean) Scripted trigger",
38
+ detail: "common/scripted_triggers/ (with a PdxDoc stub)",
39
+ nameLabel: "trigger",
40
+ nameKind: "identifier",
41
+ scriptPath: "common/scripted_triggers/$PREFIX$_scripted_triggers.txt",
42
+ cursorMarker: "# conditions here",
43
+ block: `# What this checks.
44
+ $NAME$ = {
45
+ # conditions here
46
+ }
47
+ `,
48
+ },
49
+ ];