@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
package/README.md ADDED
@@ -0,0 +1,334 @@
1
+ <img src="media/px-lsp.svg" alt="PX LSP" width="96" align="right" />
2
+
3
+ # px-lsp server
4
+
5
+ Language server for Paradox script, localization (`.yml`) and `.gui` files,
6
+ covering **Crusader Kings III**, **Victoria 3** and **Europa Universalis V**.
7
+ This is the engine behind the
8
+ [Paradox Modding Toolkit](https://marketplace.visualstudio.com/items?itemName=JDeffner.px-toolkit)
9
+ VS Code extension, usable standalone from **any LSP-capable editor** over
10
+ `--stdio` (neovim, Zed, Helix, ...).
11
+
12
+ What you get outside VS Code: ranked completion, hover docs, go-to-definition,
13
+ find references, rename, document/workspace symbols, folding, formatting,
14
+ semantic tokens, inlay hints and the structural/localization diagnostics.
15
+ Game knowledge comes from your own game install and `script_docs` dumps; CK3
16
+ and Victoria 3 additionally ship bundled fallbacks (wiki tables and a
17
+ script_docs snapshot), EU5 does not yet (see
18
+ [Per-game support](#per-game-support)).
19
+
20
+ Hovers, code actions and logging adapt to the client automatically: a plain LSP
21
+ client gets clean markdown, real `WorkspaceEdit` quick fixes and a status
22
+ mirror in the log. Nothing has to be configured for that.
23
+
24
+ ## Requirements
25
+
26
+ - **Node.js 18+** on your PATH (not needed for the Windows zip below, which
27
+ brings its own).
28
+ - A game install (optional but strongly recommended: powers vanilla
29
+ definitions, asset paths and exact-version tokens).
30
+
31
+ ## Install
32
+
33
+ ### From npm
34
+
35
+ ```bash
36
+ npm install -g @px-lsp/server
37
+ px-lsp --version # prints the server version
38
+ px-lsp # runs over stdio (--stdio is the default transport)
39
+ ```
40
+
41
+ The npm package carries the same payload as the release tarball: the bundled
42
+ `dist/server.js` (the `px-lsp` bin), the `data/` fallbacks, and the TypeScript
43
+ sources. The sources exist for bundler consumers (esbuild, Vite) that import
44
+ pieces like `@px-lsp/server/parser` directly; plain Node cannot import them,
45
+ use the bin or the wire protocol instead.
46
+
47
+ ### The release tarball
48
+
49
+ Download `px-lsp-server-<version>.tar.gz` from the
50
+ [GitHub releases](https://github.com/JDeffner/paradox-modding-toolkit/releases)
51
+ and extract it anywhere, e.g. `~/.local/share/px-lsp/`. Layout:
52
+
53
+ ```
54
+ px-lsp-server-<version>/
55
+ dist/server.js # the bundled server
56
+ data/ck3/ # bundled fallback data, found automatically
57
+ data/vic3/
58
+ README.md LICENSE THIRD-PARTY-NOTICES.md
59
+ ```
60
+
61
+ > **Do not flatten the tarball.** The server finds its bundled data at
62
+ > `../data/<gameId>/` relative to `dist/server.js`, so `dist/` and `data/`
63
+ > must stay siblings. If you copy `server.js` somewhere on its own it still
64
+ > starts and still answers requests, it just silently loses the bundled wiki
65
+ > tokens and the completion frequency tables. The startup log line under
66
+ > [Self-diagnosis](#self-diagnosis) tells you which of the two you have.
67
+
68
+ Sanity check:
69
+
70
+ ```bash
71
+ node path/to/px-lsp-server-<version>/dist/server.js --stdio
72
+ # it waits for LSP messages on stdin; Ctrl+C to quit
73
+ ```
74
+
75
+ ### Windows: the self-contained zip
76
+
77
+ `px-lsp-win-x64-<version>.zip` from the same release is the tarball payload
78
+ plus an unmodified official Node build, so nothing has to be installed first.
79
+ It is the artifact to embed if you ship the server inside another application
80
+ (`docs/EMBEDDING.md` in the repo is the guide for doing that).
81
+
82
+ ```
83
+ px-lsp-win-x64-<version>/
84
+ px-lsp.cmd # the launcher: runs the bundled node against dist/server.js --stdio
85
+ node.exe # official nodejs.org win-x64 build, unmodified
86
+ NODE-LICENSE # Node's own license (our GPL LICENSE keeps the plain name)
87
+ dist/ data/ README.md LICENSE THIRD-PARTY-NOTICES.md
88
+ ```
89
+
90
+ Point your client's command at `px-lsp.cmd` and pass no arguments: it already
91
+ adds `--stdio`, and everything it resolves is relative to its own folder, so
92
+ the unpacked directory can live anywhere. Extra arguments are forwarded.
93
+
94
+ ## Which game
95
+
96
+ The server serves **one game per instance**, selected by the `gameId` setting
97
+ (`"ck3"` (default), `"vic3"`, `"eu5"`). There is no auto-detection outside VS
98
+ Code: set it explicitly for anything but CK3.
99
+
100
+ `gamePath` and `logsPath` always describe the **active** game:
101
+
102
+ | `gameId` | Mod is identified by | `gamePath` | `logsPath` (script_docs dumps) |
103
+ |---|---|---|---|
104
+ | `ck3` | `descriptor.mod` | `…/steamapps/common/Crusader Kings III/game` | `~/Documents/Paradox Interactive/Crusader Kings III/logs` |
105
+ | `vic3` | `.metadata/metadata.json` | `…/steamapps/common/Victoria 3/game` | `~/Documents/Paradox Interactive/Victoria 3/docs` (**not** `logs`) |
106
+ | `eu5` | `.metadata/metadata.json` + stage folders | `…/steamapps/common/Europa Universalis V/game` | `~/Documents/Paradox Interactive/Europa Universalis V/docs` (**not** `logs`) |
107
+
108
+ Path specifics worth knowing before you wire them:
109
+
110
+ - Victoria 3's and EU5's `script_docs` console command writes to
111
+ `Documents/Paradox Interactive/<Game>/docs`, **not** to `logs/`. Pointing
112
+ `logsPath` at `logs/` there finds nothing. (The data-type dump still lands
113
+ under `logs/` — the server probes the sibling `logs/` folder automatically.)
114
+ - EU5 mods put their content under a **load-stage folder**: gameplay script
115
+ lives in `<mod>/in_game/common/...`, `<mod>/in_game/events/...`, and so on
116
+ (`main_menu/` and `loading_screen/` are the other two). The mod root itself
117
+ is the folder holding `.metadata/`. Keep `root_markers`/`root_dir` on that
118
+ root, not on `in_game/`, or nothing below it classifies.
119
+
120
+ ## Neovim setup (0.11+)
121
+
122
+ **1. Filetypes.** Paradox script is plain `.txt` and localization is `.yml`, so
123
+ teach neovim which files are which. Anchor the patterns to your mod folder(s)
124
+ if the generic ones are too broad:
125
+
126
+ ```lua
127
+ vim.filetype.add({
128
+ extension = {
129
+ gui = "paradox-gui",
130
+ },
131
+ pattern = {
132
+ [".*/common/.*%.txt"] = "paradox",
133
+ [".*/events/.*%.txt"] = "paradox",
134
+ [".*/history/.*%.txt"] = "paradox",
135
+ [".*/localization/.*%.yml"] = "paradox-loc",
136
+ },
137
+ })
138
+ ```
139
+
140
+ (If a builtin pattern wins over one of these, move the rules to
141
+ `after/ftdetect/paradox.lua` — see neovim/neovim#29468. The patterns above are
142
+ suffix matches, so they also catch EU5's `in_game/common/...` layout.)
143
+
144
+ The plain `paradox` filetype stays correct for every game: the VS Code
145
+ extension sends per-game ids (`paradox-ck3`, `paradox-vic3`, `paradox-eu5`)
146
+ only to get a per-game file icon and label, and the server treats every one of
147
+ them, and plain `paradox`, as the same script language.
148
+
149
+ **Failure mode to recognize:** if a file opens with no diagnostics, no
150
+ highlighting and an empty completion popup, check `:set filetype?` first. A
151
+ `.txt` that stayed `text` never reaches the server at all, and the server
152
+ cannot report a problem it never heard about.
153
+
154
+ **2. The server.** Adjust the paths and the game id (replace `<version>`
155
+ everywhere with the release you downloaded, e.g. `0.3.0`):
156
+
157
+ ```lua
158
+ vim.lsp.config("px_lsp", {
159
+ cmd = {
160
+ "node",
161
+ vim.fn.expand("~/.local/share/px-lsp/px-lsp-server-<version>/dist/server.js"),
162
+ "--stdio",
163
+ },
164
+ filetypes = { "paradox", "paradox-loc", "paradox-gui" },
165
+ -- The mod root: the folder holding descriptor.mod (CK3) or .metadata/ (Vic3, EU5).
166
+ root_markers = { "descriptor.mod", ".metadata", ".git" },
167
+ init_options = {
168
+ settings = {
169
+ -- "ck3" (default) | "vic3" | "eu5".
170
+ gameId = "ck3",
171
+ -- The game's data folder ("<steam>/steamapps/common/<Game>/game").
172
+ gamePath = "C:/Program Files (x86)/Steam/steamapps/common/Crusader Kings III/game",
173
+ -- Folder with the script_docs dumps (see below). Omit for bundled data only.
174
+ logsPath = vim.fn.expand("~/Documents/Paradox Interactive/Crusader Kings III/logs"),
175
+ locLanguage = "english",
176
+ },
177
+ },
178
+ })
179
+ vim.lsp.enable("px_lsp")
180
+ ```
181
+
182
+ Do **not** set `client`: those capability flags are a client declaring that it
183
+ registers the `px.*` editor commands, renders the sanitized hover HTML, or runs
184
+ its own file watcher. Declaring none of them gives the plain-client behavior
185
+ described above, which is what you want here. (`clientCommands = true` is the
186
+ deprecated all-on alias; do not set it either.)
187
+
188
+ **Failure mode to recognize:** if `root_markers` never match, the server falls
189
+ back to the first workspace folder as the mod root. Open the mod folder itself
190
+ (or set `modPath`), otherwise workspace-mod-only features (reference
191
+ diagnostics, required-localization checks, the loc quick fix) stay silent
192
+ because the file belongs to no known mod.
193
+
194
+ You do NOT need to set a mod path when the root markers match: the server
195
+ indexes the workspace root automatically. Extra optional settings, same shape
196
+ as the VS Code extension: `parentPaths` (dependency mods, load order, base
197
+ first), `diagnosticsIgnore` (codes to suppress), `diagnosticsIgnorePatterns`
198
+ (globs), `scopeInlayHints` (default false).
199
+
200
+ Beyond standard LSP the server also answers custom `paradox/*` requests
201
+ (overview data, GUI layout, …) — see `docs/PROTOCOL.md` in the repo; a plain
202
+ editor client can ignore them entirely. Wiring the server into an application
203
+ instead of an editor is a different job: `docs/EMBEDDING.md` has the guide for
204
+ that (process contract, the initialization options an app should send, URI and
205
+ document-sync conventions, reference clients).
206
+
207
+ On neovim 0.10, use `require("lspconfig.configs")` with the same `cmd`/
208
+ `init_options` and `root_dir = require("lspconfig.util").root_pattern("descriptor.mod", ".metadata")`.
209
+
210
+ **3. Game-exact data (recommended, required for Vic3 and EU5).** Your own
211
+ `script_docs` dumps are what teach the server the engine's effects, triggers,
212
+ event targets and modifiers:
213
+
214
+ 1. Launch the game with `-debug_mode`.
215
+ 2. Open the console (`` ` ``) and run `script_docs`, then the data-type dump
216
+ (`DumpDataTypes` on CK3, `dump_data_types` on Vic3) if the game offers it.
217
+ 3. Point `logsPath` at the dump folder (`logs/` for CK3, `docs/` for Vic3 and
218
+ EU5), then restart the server (`:edit` a file or `:LspRestart`).
219
+
220
+ CK3 and Vic3 ship bundled fallbacks (wiki tables for CK3, a script_docs
221
+ snapshot for Vic3), so this step is an exact-version upgrade there. For EU5
222
+ nothing is bundled yet, so it is the difference between working
223
+ completion/hover and a thin index of your own definitions only.
224
+
225
+ ## What works where
226
+
227
+ Per language id, because the answer genuinely differs:
228
+
229
+ | | `paradox` (script `.txt`) | `paradox-loc` (`.yml`) | `paradox-gui` (`.gui`) |
230
+ |---|---|---|---|
231
+ | Completion | full | inside `[ … ]` expressions and `#format` tags | widget types, properties, `using` templates |
232
+ | Hover | full | `[ … ]` and `#format` tags | full |
233
+ | Go to definition | yes | `[ … ]` names (custom loc, saved scopes) | types, templates, `blockoverride` targets |
234
+ | Find references | yes | on loc-key lines | — |
235
+ | Rename | yes | — | — |
236
+ | Signature help | yes | `[ … ]` calls | `[ … ]` calls |
237
+ | Document symbols | yes | yes | yes |
238
+ | Workspace symbols | yes (index-wide, any file type) | | |
239
+ | Folding | yes | — | — |
240
+ | Formatting | yes | — | — |
241
+ | Semantic tokens | yes | — | yes |
242
+ | Code actions | yes | — | — |
243
+ | Inlay hints | loc value previews; scope hints with `scopeInlayHints = true` | translation overlay | loc value previews |
244
+ | Diagnostics | structural + references + required localization | loc header/filename/encoding checks | unbalanced braces only |
245
+
246
+ The dashes are deliberate, not stubs: the server declares the capability
247
+ globally (LSP has no per-language-id capability negotiation) and returns an
248
+ empty result for the language ids where the feature has no meaning.
249
+
250
+ ## Per-game support
251
+
252
+ | | CK3 | Victoria 3 | EU5 |
253
+ |---|---|---|---|
254
+ | Schema (folder → definition kind) | 156 entries, verified against a live install | 72 entries, verified against a live install | 518 entries, imported from [cwtools-eu5-config](https://github.com/kaiser-chris/cwtools-eu5-config), **unverified against a live install** |
255
+ | Engine tokens with no `script_docs` dump | bundled wiki fallback + bundled dump snapshot | bundled dump snapshot | none (thin until you dump) |
256
+ | `script_docs` location / format | `logs/`, classic text | `docs/`, markdown | `docs/`, markdown |
257
+ | Completion frequency ranking | bundled (vanilla + corpus) | bundled (vanilla) | none |
258
+ | `.gui` widget schema | bundled (556 types) | bundled (579 types) | none |
259
+ | `[ … ]` data-type chains | bundled tables + dump snapshot + your own dump | bundled dump snapshot + your own dump | bundled dump snapshot + your own dump |
260
+ | Required-localization diagnostics | yes | yes (49 measured claims) | none, by design |
261
+ | Deep validation (tiger) | ck3-tiger | vic3-tiger | none exists |
262
+ | Mod descriptor | `descriptor.mod` | `.metadata/metadata.json` | `.metadata/metadata.json` |
263
+ | Layout quirks | — | plural `common/on_actions` | stage roots (`in_game/` …), `REPLACE:`/`INJECT:` entry keys |
264
+
265
+ The EU5 table is a lossy projection of community CWT rules and is only as
266
+ right as those rules are. Its blast radius is bounded on purpose: a minimal
267
+ hand-checked set of reference fields and **zero** required-localization
268
+ patterns, so a wrong entry costs you navigation, never a false diagnostic. Fix
269
+ gaps locally with a `<mod>/.eu5modding/schema.json` overlay, and please report
270
+ them. Attribution and license texts: `THIRD-PARTY-NOTICES.md`, shipped in the
271
+ tarball next to this README.
272
+
273
+ ## Known limitations outside VS Code
274
+
275
+ - **No tiger diagnostics.** The download/run integration lives in the VS Code
276
+ client. Deep validation (unknown effects, unknown traits, wrong argument
277
+ types) is deliberately tiger's job, not this server's. Run
278
+ [ck3-tiger / vic3-tiger](https://github.com/amtep/tiger) yourself. The
279
+ server's own diagnostics stay in the class it can decide with certainty:
280
+ structural damage, encoding and file-layout traps, missing required
281
+ localization, and references to events that do not exist in any namespace
282
+ your mod declares (that last one works in every client).
283
+ - **No overview UIs** (event graph, GUI preview, mod report, coverage views):
284
+ those are VS Code webviews.
285
+ - **No `.dds` viewer.** Hovering a texture path still produces a hover, but the
286
+ preview is a data-URI image: clients that do not render images in hover
287
+ markdown show the link text instead of the picture.
288
+
289
+ ## Self-diagnosis
290
+
291
+ Everything the server knows about its own state goes to `window/logMessage`,
292
+ i.e. `:LspLog` in neovim. Three lines answer almost every "why is it empty"
293
+ question:
294
+
295
+ ```
296
+ [10:02:11] bundled data for 'ck3': /home/you/.local/share/px-lsp/px-lsp-server-0.3.0/data/ck3/wikidocs
297
+ [10:02:11] parsed script_docs logs (4213 tokens, 180ms)
298
+ [10:02:14] status: 4213 tokens (script_docs), 128394 definitions
299
+ ```
300
+
301
+ - The first line names the **resolved data directory** for the active game. If
302
+ it instead reads `no bundled data found for '<id>' (looked next to the server
303
+ bundle)`, either the tarball got flattened or the game ships no bundled data
304
+ (only CK3 has a wiki mirror; EU5 ships a data-type snapshot but no
305
+ script_docs snapshot yet).
306
+ - `script_docs logs path not found` or `missing log files in <path>` means
307
+ `logsPath` is wrong or the dump was never made.
308
+ - The `status:` line is the mirror of the `paradox/status` notification, logged
309
+ on transitions. `0 tokens` means no engine vocabulary, `0 definitions` means
310
+ nothing indexed (usually a mod-root problem), and `(bundled)` vs
311
+ `(script_docs)` tells you which source the tokens came from.
312
+
313
+ ## Acceptance harness
314
+
315
+ `scripts/nvim-parity/` in the repo drives headless neovim through this exact
316
+ setup against a real mod and checks the standard-LSP surface end to end,
317
+ including that hovers contain no VS Code markup or dead `command:` links, that
318
+ external edits are picked up without a restart, and that the status mirror
319
+ shows up in the log. It is run by hand before a release (it needs neovim, a
320
+ game install and a real mod), not in CI. Its README has the invocation.
321
+
322
+ ## Building from source
323
+
324
+ ```bash
325
+ pnpm install
326
+ pnpm run compile
327
+ node packages/server/dist/server.js --stdio
328
+ ```
329
+
330
+ ## License
331
+
332
+ GPL-3.0-or-later. Bundled wiki token lists are CC BY-SA 3.0 — see
333
+ `data/ck3/wikidocs/ATTRIBUTION.md`. The EU5 schema table is derived from
334
+ MIT-licensed community CWT rules, see `THIRD-PARTY-NOTICES.md`.
@@ -0,0 +1,83 @@
1
+ # Third-party notices
2
+
3
+ Paradox Modding Toolkit is GPL-3.0-or-later (see `LICENSE`). It additionally contains
4
+ material derived from the MIT-licensed projects below. Their license texts are
5
+ reproduced verbatim as required.
6
+
7
+ ---
8
+
9
+ ## cwtools-eu5-config
10
+
11
+ - Upstream: https://github.com/kaiser-chris/cwtools-eu5-config
12
+ - Pinned commit: `7f2764a9536951dc9915c0b05509d0499408381a` (targets EU5 1.3.4-beta)
13
+ - Imported: 2026-08-01
14
+
15
+ **What it is used for.** The Europa Universalis V schema table
16
+ (`packages/server/src/games/eu5/schema.generated.ts`) is machine-generated from
17
+ this project's `types = { ... }` declarations by `scripts/import-cwt-types.ts`.
18
+ The generated file is a derived work: the folder paths, definition kinds, file
19
+ extensions and the commented-out `requiredLoc` patterns all come from upstream.
20
+ No CWT source file is redistributed, and none of the rule language (aliases,
21
+ enums, cardinalities, scopes) is used, only the type-to-folder table.
22
+
23
+ ```
24
+ MIT License
25
+
26
+ Copyright (c) 2025 Chris Kaiser
27
+
28
+ Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ of this software and associated documentation files (the "Software"), to deal
30
+ in the Software without restriction, including without limitation the rights
31
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ copies of the Software, and to permit persons to whom the Software is
33
+ furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be included in all
36
+ copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
+ SOFTWARE.
45
+ ```
46
+
47
+ ---
48
+
49
+ ## cwtools-vic3-config
50
+
51
+ - Upstream: https://github.com/kaiser-chris/cwtools-vic3-config
52
+ - Consulted at commit: `d87e303234cc049051ac7ae3c5984f8047973f88`
53
+
54
+ **What it is used for.** Nothing is generated from this project. The Victoria 3
55
+ schema table (`packages/server/src/games/vic3/schema.ts`) was written by hand
56
+ against a real Vic3 install and then **cross-checked** against these rules to
57
+ confirm folder names and definition kinds (for example that Vic3 reads the
58
+ plural `common/on_actions`). Any overlap is limited to those factual folder and
59
+ kind names; the notice is kept because the cross-check informed the table.
60
+
61
+ ```
62
+ MIT License
63
+
64
+ Copyright (c) 2020 cwtools
65
+
66
+ Permission is hereby granted, free of charge, to any person obtaining a copy
67
+ of this software and associated documentation files (the "Software"), to deal
68
+ in the Software without restriction, including without limitation the rights
69
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70
+ copies of the Software, and to permit persons to whom the Software is
71
+ furnished to do so, subject to the following conditions:
72
+
73
+ The above copyright notice and this permission notice shall be included in all
74
+ copies or substantial portions of the Software.
75
+
76
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
82
+ SOFTWARE.
83
+ ```