@px-lsp/protocol 0.1.0 → 0.2.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.
package/dist/kinds.js ADDED
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ /**
3
+ * One kind map, four surfaces.
4
+ *
5
+ * Every place the product names a concept - the hover badge, the completion
6
+ * list icon, the tree leaf, the breadcrumb/outline entry - reads its glyph from
7
+ * here, so a trigger looks like a trigger everywhere.
8
+ *
9
+ * The colour is not a second decision. VS Code paints a completion row from the
10
+ * `symbolIcon.*Foreground` token of the `CompletionItemKind` we send, and we
11
+ * cannot override it, so the kind IS the colour. The hover badge reuses that
12
+ * same token, which is why there is no colour column to keep in sync. Four
13
+ * groups come out of that, and choosing the kind is choosing the group:
14
+ *
15
+ * purple asks a question Method
16
+ * orange makes it happen Class, Event, Enum, Value
17
+ * blue you stored it Variable, Field, Interface, EnumMember
18
+ * grey syntax, everything else all the rest
19
+ *
20
+ * Three facts shape the table and are easy to re-break:
21
+ *
22
+ * 1. **Codicon aliases collapse.** `symbol-method`, `symbol-function` and
23
+ * `symbol-constructor` are one codepoint, so they are one picture. Same for
24
+ * `symbol-enum`/`symbol-value`, `symbol-key`/`symbol-text`,
25
+ * `symbol-struct`/`symbol-structure`, `symbol-unit`/`symbol-ruler` and
26
+ * `symbol-type-parameter`/`symbol-parameter`. Check a proposed mapping
27
+ * against codepoints, not against the names. Prefer the canonical name of a
28
+ * pair: only it carries the `symbolIcon.*Foreground` rule, so a themed tree
29
+ * leaf tints and an alias does not.
30
+ * 2. **Only `CompletionItemKind` reaches the suggest widget.** 25 values,
31
+ * 22 distinct pictures after the collapse. A concept that appears in a
32
+ * completion list cannot use a glyph from outside that set in the list,
33
+ * even though the hover and the tree can draw all 461 codicons.
34
+ * 3. **Only `SymbolKind` reaches the outline.** Breadcrumbs, the outline,
35
+ * sticky scroll and Ctrl+T take an LSP `SymbolKind`, and VS Code draws
36
+ * member `X` with the codicon `symbol-<kebab X>`. `symbolKind` names the
37
+ * member drawing the same picture as `codicon`, so the breadcrumb bar and
38
+ * the hover badge cannot disagree; it is null for a picture no member
39
+ * draws. The server resolves the name to the numeric enum.
40
+ *
41
+ * `codicon`, `completionKind` and `symbolKind` are separate fields for exactly
42
+ * that reason. They name the same picture everywhere except two entries:
43
+ * `texture`, whose `file-media` glyph no completion kind can produce, and
44
+ * `list`, whose array glyph no *free* completion kind can produce (the colour
45
+ * has to stay blue, and all four blue kinds are taken), so the suggest widget
46
+ * alone still draws it as an enum member.
47
+ *
48
+ * Uniqueness is promised *within a completion list*, not globally: script, gui
49
+ * and datafunction completions never appear together, so they may share glyphs.
50
+ *
51
+ * No imports: this is shared by the server and the VS Code client.
52
+ */
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.DEFAULT_KIND_STYLE = void 0;
55
+ exports.kindStyle = kindStyle;
56
+ exports.hasKindStyle = hasKindStyle;
57
+ exports.mappedKinds = mappedKinds;
58
+ /**
59
+ * The `SymbolKind` member VS Code draws with each picture the table uses. VS
60
+ * Code renders member `X` as `symbol-<kebab X>`, so this is that rule read
61
+ * backwards, with the alias pairs resolved to the member owning the codepoint
62
+ * (`symbol-value` is `symbol-enum`, `symbol-text` is `symbol-key`). A codicon
63
+ * absent here has no `SymbolKind` at all: there are 26 members against 461
64
+ * codicons.
65
+ */
66
+ const SYMBOL_KIND_BY_CODICON = {
67
+ "symbol-array": "Array",
68
+ "symbol-class": "Class",
69
+ "symbol-constant": "Constant",
70
+ "symbol-enum-member": "EnumMember",
71
+ "symbol-event": "Event",
72
+ "symbol-field": "Field",
73
+ "symbol-interface": "Interface",
74
+ "symbol-method": "Method",
75
+ "symbol-module": "Module",
76
+ "symbol-operator": "Operator",
77
+ "symbol-property": "Property",
78
+ "symbol-struct": "Struct",
79
+ "symbol-text": "Key",
80
+ "symbol-type-parameter": "TypeParameter",
81
+ "symbol-value": "Enum",
82
+ "symbol-variable": "Variable",
83
+ };
84
+ /**
85
+ * The only completion kinds VS Code tints; the other 15 render in the plain
86
+ * editor foreground, so their badge emits no span at all.
87
+ */
88
+ const TINT = {
89
+ Method: "method",
90
+ Function: "function",
91
+ Constructor: "constructor",
92
+ Class: "class",
93
+ Enum: "enumerator",
94
+ Value: "enumerator",
95
+ Event: "event",
96
+ Variable: "variable",
97
+ Field: "field",
98
+ Interface: "interface",
99
+ EnumMember: "enumeratorMember",
100
+ };
101
+ /**
102
+ * `colorFrom` defaults to the completion kind, which is what keeps the badge
103
+ * and the row the same colour. `on_action` is the one entry that overrides it:
104
+ * it wants the interface glyph with the orange of the group it belongs to, and
105
+ * a completion row cannot have both.
106
+ */
107
+ const c = (codicon, completionKind, colorFrom = completionKind) => ({
108
+ codicon,
109
+ completionKind,
110
+ symbolKind: SYMBOL_KIND_BY_CODICON[codicon] ?? null,
111
+ color: TINT[colorFrom] ? `var(--vscode-symbolIcon-${TINT[colorFrom]}Foreground)` : null,
112
+ });
113
+ const SCRIPT = {
114
+ // purple: asks a question.
115
+ trigger: c("symbol-method", "Method"),
116
+ scripted_trigger: c("symbol-method", "Method"),
117
+ datafn: c("symbol-method", "Method"),
118
+ // orange: makes it happen.
119
+ effect: c("symbol-event", "Event"),
120
+ scripted_effect: c("symbol-event", "Event"),
121
+ event: c("symbol-class", "Class"),
122
+ decision: c("symbol-class", "Class"),
123
+ gui_type: c("symbol-class", "Class"),
124
+ data_type: c("symbol-class", "Class"),
125
+ on_action: c("symbol-interface", "Interface", "Class"),
126
+ trait: c("symbol-value", "Value"),
127
+ // blue: you stored it. A name that resolves to a scope or a stored value.
128
+ variable: c("symbol-variable", "Variable"),
129
+ local_variable: c("symbol-variable", "Variable"),
130
+ global_variable: c("symbol-variable", "Variable"),
131
+ promote: c("symbol-variable", "Variable"),
132
+ saved_scope: c("symbol-field", "Field"),
133
+ event_target: c("symbol-interface", "Interface"),
134
+ // The four list kinds each get their own picture. `add_to_list` builds a
135
+ // collection that lives for one effect block and is never saved, so it takes
136
+ // the array picture; the three `*_variable_list` kinds are entries in
137
+ // variable storage, split by storage class: the object-attached one keeps
138
+ // the enum-member picture, the event-chain-local one the plain list, the
139
+ // game-global one the globe.
140
+ // All four stay on `EnumMember`: the four blue completion kinds are already
141
+ // spoken for by variable, saved_scope and event_target, so the suggest widget
142
+ // draws every list as one blue enum-member row; the split shows in the hover
143
+ // badge and the tree. Of the four pictures only `symbol-enum-member` carries
144
+ // a `symbolIcon` colour rule, so the other three render tree leaves in the
145
+ // plain icon foreground while their badges stay blue (the map emits the
146
+ // colour); `list-unordered` and `globe` are pictures no SymbolKind draws, so
147
+ // those two fall back to Object in symbol lists.
148
+ list: c("symbol-array", "EnumMember"),
149
+ variable_list: c("symbol-enum-member", "EnumMember"),
150
+ local_variable_list: c("list-unordered", "EnumMember"),
151
+ global_variable_list: c("globe", "EnumMember"),
152
+ // grey: syntax and everything else.
153
+ scope_word: c("symbol-constant", "Constant"),
154
+ structure_key: c("symbol-struct", "Struct"),
155
+ descriptor_field: c("symbol-struct", "Struct"),
156
+ keyword: c("symbol-keyword", "Keyword"),
157
+ modifier: c("symbol-property", "Property"),
158
+ scripted_modifier: c("symbol-property", "Property"),
159
+ gui_property: c("symbol-property", "Property"),
160
+ script_value: c("symbol-operator", "Operator"),
161
+ define: c("symbol-unit", "Unit"),
162
+ namespace: c("symbol-module", "Module"),
163
+ loc_key: c("symbol-text", "Text"),
164
+ macro_param: c("symbol-type-parameter", "TypeParameter"),
165
+ text_format: c("symbol-color", "Color"),
166
+ gui_enum_value: c("symbol-constant", "Constant"),
167
+ format_suffix: c("symbol-constant", "Constant"),
168
+ gui_template: c("symbol-snippet", "Snippet"),
169
+ // The picture-frame glyph no completion kind can draw: the hover and the tree
170
+ // get `file-media`, the completion row falls back to the plain file glyph.
171
+ texture: c("file-media", "File"),
172
+ };
173
+ /** Anything the map does not name: a definition we have no opinion about. */
174
+ exports.DEFAULT_KIND_STYLE = c("go-to-file", "Reference");
175
+ /** Glyph, completion kind and badge colour for a kind name. Never throws. */
176
+ function kindStyle(kind) {
177
+ return SCRIPT[kind] ?? exports.DEFAULT_KIND_STYLE;
178
+ }
179
+ /** True when the map has an opinion, i.e. the kind is not falling through. */
180
+ function hasKindStyle(kind) {
181
+ return Object.prototype.hasOwnProperty.call(SCRIPT, kind);
182
+ }
183
+ /** Every mapped kind, for the coverage test that keeps this table honest. */
184
+ function mappedKinds() {
185
+ return Object.keys(SCRIPT);
186
+ }
@@ -17,6 +17,16 @@ export interface ParadoxSettings {
17
17
  locLanguage: string;
18
18
  /** Show inferred scope after scope-changing block openers (off by default). */
19
19
  scopeInlayHints: boolean;
20
+ /**
21
+ * How much a hover shows. `standard` applies every cap in the design;
22
+ * `compact` drops prose and examples; `full` lifts the example cap and shows
23
+ * every distinct meaning.
24
+ */
25
+ hoverDetail?: "compact" | "standard" | "full";
26
+ /** Custom era calendar (total-conversion mods): how script dates display in
27
+ * game. Absent = no calendar features. Shape: calendar.ts `CalendarSetting`;
28
+ * the server sanitizes it on intake, so clients may pass raw JSON. */
29
+ calendar?: import("./calendar").CalendarSetting;
20
30
  /** Our diagnostic codes to suppress everywhere. */
21
31
  diagnosticsIgnore: string[];
22
32
  /** Glob patterns (workspace-relative paths) whose diagnostics are suppressed. */
@@ -54,6 +64,25 @@ export interface ParadoxClientCapabilities {
54
64
  * registers one whenever the client supports dynamic registration.
55
65
  */
56
66
  ownFileWatcher?: boolean;
67
+ /**
68
+ * The client's hover renderer navigates `file:` links, so provenance lines
69
+ * ("where is this defined") may be markdown links. Default false: the same
70
+ * `file.txt:12` label is rendered as plain text, which reads correctly in a
71
+ * client that would otherwise show a dead link.
72
+ *
73
+ * Note that `textDocument.completion.completionItem.snippetSupport` — the
74
+ * other axis an embedder should declare — is a STANDARD LSP capability, not
75
+ * one of these: send it in the initialize params, not here.
76
+ */
77
+ fileLinks?: boolean;
78
+ /**
79
+ * The client renders `$(codicon)` theme icons in hover markdown, i.e. it sets
80
+ * `supportThemeIcons` on the MarkdownString. Default false, and the default
81
+ * matters: a client without it prints the literal text `$(symbol-method)`,
82
+ * which is worse than the plain `■` it would otherwise get. Implies
83
+ * {@link ParadoxClientCapabilities.hoverHtml} is respected for colour.
84
+ */
85
+ hoverIcons?: boolean;
57
86
  }
58
87
  /** initializationOptions passed at LanguageClient start. All fields optional:
59
88
  * the server has fail-soft fallbacks for bare clients. */
@@ -66,9 +95,9 @@ export interface ParadoxInitOptions {
66
95
  /**
67
96
  * @deprecated Send {@link ParadoxInitOptions.client} instead. `true` is an
68
97
  * alias for `{ hoverHtml: true, commands: <every id in clientCommands>,
69
- * ownFileWatcher: true }` (what the VSCode extension declared before the
70
- * capabilities object existed); false/absent means all-off. Ignored when
71
- * `client` is present.
98
+ * ownFileWatcher: true, fileLinks: true }` plus snippet support (what the
99
+ * VSCode extension declared before the capabilities object existed);
100
+ * false/absent means all-off. Ignored when `client` is present.
72
101
  */
73
102
  clientCommands?: boolean;
74
103
  /**
@@ -100,6 +129,7 @@ export declare const clientCommands: {
100
129
  readonly editLocalization: "px.editLocalization";
101
130
  readonly openLocalizationSideBySide: "px.openLocalizationSideBySide";
102
131
  readonly showReferences: "px.showReferences";
132
+ readonly showExamplesWiki: "px.showExamplesWiki";
103
133
  };
104
134
  /** Every id in {@link clientCommands}: what a fully capable client registers. */
105
135
  export declare const allClientCommandIds: string[];
@@ -143,6 +173,10 @@ export interface StatusPayload {
143
173
  * (data/<gameId>/script_docs) rather than the user's own dump. */
144
174
  tokensFromBundledDumps?: boolean;
145
175
  definitions: number;
176
+ /** Tokens the bundled wiki added that script_docs did not have. The wiki is
177
+ * merged even when the user has their own dump, but its real contribution is
178
+ * usage examples; the extra NAMES are mostly deprecated API. */
179
+ tokensWikiOnly?: number;
146
180
  /** True while a (re)scan is running. */
147
181
  indexing: boolean;
148
182
  }
@@ -374,6 +408,148 @@ export interface EventDetail {
374
408
  options: EventOptionInfo[];
375
409
  refs: EventRefInfo[];
376
410
  }
411
+ /**
412
+ * Request: the searchable catalog behind the Examples Wiki;
413
+ * `null` -> {@link ExampleWikiIndex}.
414
+ *
415
+ * One compact row per name the server knows about, so a client can filter and
416
+ * rank the whole vocabulary without asking again. Everything expensive (the
417
+ * full documentation, the usage block, the vanilla sites) is left to
418
+ * {@link exampleWikiEntryRequest}.
419
+ */
420
+ export declare const exampleWikiRequest = "paradox/exampleWiki";
421
+ /**
422
+ * What an Examples Wiki row is. The first four are engine tokens from
423
+ * script_docs or the wiki tables; the next three are `[ ... ]` datafunctions:
424
+ * a global (`GetPlayer`), a member of a data type (`Character.GetName`), and
425
+ * a data type itself (`Character`). The next seven are the variable and list
426
+ * names the definition index found in the indexed script itself, one kind per
427
+ * storage class ({@link exampleWikiVariableKinds}). The last two are the script
428
+ * grammar the game documents nowhere ({@link exampleWikiVocabularyKinds}): the
429
+ * glue keywords (`limit`, `NOT`, `base`) and the scope words (`root`, `prev`).
430
+ */
431
+ export type ExampleWikiKind = "trigger" | "effect" | "event_target" | "modifier" | "datafn_global" | "datafn_member" | "data_type" | "keyword" | "scope_word" | "variable" | "local_variable" | "global_variable" | "variable_list" | "local_variable_list" | "global_variable_list" | "list";
432
+ /** The {@link ExampleWikiKind}s whose rows come from the definition index. */
433
+ export declare const exampleWikiVariableKinds: ExampleWikiKind[];
434
+ /**
435
+ * The {@link ExampleWikiKind}s whose rows are script grammar rather than a
436
+ * name from a dump or an index. One filter chip covers both.
437
+ */
438
+ export declare const exampleWikiVocabularyKinds: ExampleWikiKind[];
439
+ export interface ExampleWikiEntry {
440
+ /** Display and lookup name; a member carries its owner (`Character.GetName`). */
441
+ name: string;
442
+ kind: ExampleWikiKind;
443
+ /** Owning data type of a member row; absent on every other kind. */
444
+ owner?: string;
445
+ /** First sentence of the documentation, capped; empty when undocumented. */
446
+ shortDoc: string;
447
+ /** Times vanilla uses the name. 0 means "not counted", not "never used". */
448
+ count: number;
449
+ }
450
+ export interface ExampleWikiIndex {
451
+ /** Every row, most-used first. */
452
+ entries: ExampleWikiEntry[];
453
+ /** Plain sentences naming where the rows came from, for an About line. */
454
+ sources: string[];
455
+ /** True when the rows do NOT come from the user's own script_docs dump, so
456
+ * a client can suggest running `script_docs` in the game console. */
457
+ needsScriptDocs: boolean;
458
+ }
459
+ /**
460
+ * Request: everything the toolkit knows about ONE Examples Wiki row;
461
+ * {@link ExampleWikiEntryParams} -> {@link ExampleWikiDetail} | null.
462
+ *
463
+ * `null` means the name is not in the catalog. Vanilla example sites are
464
+ * searched on demand and come back as absolute paths, so a client can open
465
+ * the file at the line without resolving anything itself.
466
+ */
467
+ export declare const exampleWikiEntryRequest = "paradox/exampleWikiEntry";
468
+ export interface ExampleWikiEntryParams {
469
+ name: string;
470
+ kind: ExampleWikiKind;
471
+ }
472
+ /** One place in the game or mod files that uses the name. */
473
+ export interface ExampleWikiSite {
474
+ /** The line as written, trimmed and capped. */
475
+ text: string;
476
+ /** Absolute path. */
477
+ file: string;
478
+ /** 1-based line number. */
479
+ line: number;
480
+ /**
481
+ * The lines around the site as written, dedented and capped, with the `line`
482
+ * line among them. Absent when the file could not be read.
483
+ */
484
+ context?: string[];
485
+ /** 1-based line number of `context[0]`; absent with `context`. */
486
+ contextStart?: number;
487
+ /** What the site does with the name ("set", "read"); absent when it only uses it. */
488
+ label?: string;
489
+ }
490
+ export interface ExampleWikiDetail {
491
+ name: string;
492
+ kind: ExampleWikiKind;
493
+ owner?: string;
494
+ count: number;
495
+ /** Full documentation prose; empty when nothing documents the name. */
496
+ doc: string;
497
+ /** Scopes an engine token works in; empty when unknown. */
498
+ scopes: string[];
499
+ /** The token's remaining script_docs metadata lines, verbatim. */
500
+ traits?: string;
501
+ /** The `usage:` example block from script_docs or the wiki, verbatim. */
502
+ usage?: string;
503
+ /** Datafunction return type; absent when unknown. */
504
+ ret?: string;
505
+ /** Datafunction argument types, when the dump recorded them. */
506
+ args?: string[];
507
+ /** A datafunction is either read like a field or called with parentheses. */
508
+ callKind?: "promote" | "function";
509
+ /** Literal arguments vanilla passes, most used first. */
510
+ literals: string[];
511
+ /** Literals found before the list was capped. */
512
+ literalsTotal: number;
513
+ /** Members of a data type, or nothing on other kinds. */
514
+ members: string[];
515
+ membersTotal: number;
516
+ /** Datafunctions that return this data type. */
517
+ producers: string[];
518
+ producersTotal: number;
519
+ /** What a variable holds, in words ("character", "list of title", "unknown"). */
520
+ valueType?: string;
521
+ /** Top-level definitions a variable is set inside, most sites first. */
522
+ containers?: string[];
523
+ /** Containers found before the list was capped. */
524
+ containersTotal?: number;
525
+ /** Vanilla uses, capped; empty when the search found none. */
526
+ examples: ExampleWikiSite[];
527
+ /** Why the example list looks the way it does, in one sentence. */
528
+ examplesNote?: string;
529
+ /**
530
+ * What can be written FROM each scope this token produces, one entry per
531
+ * `output: S` scope. Present only on a token that declares one; every list
532
+ * is derived from the declared scopes of the other catalog rows.
533
+ */
534
+ fromScope?: ExampleWikiFromScope[];
535
+ /** Where the facts above come from, in one sentence. */
536
+ provenance: string;
537
+ }
538
+ /** Names usable once a token has moved the scope to {@link scope}, most used
539
+ * first. Each list is capped; the `*Total` is what was found before the cap. */
540
+ export interface ExampleWikiFromScope {
541
+ /** The produced scope word, as the game's own docs write it ("faith"). */
542
+ scope: string;
543
+ /** Triggers whose declared scopes include this one. */
544
+ triggers: string[];
545
+ triggersTotal: number;
546
+ /** Effects whose declared scopes include this one. */
547
+ effects: string[];
548
+ effectsTotal: number;
549
+ /** Event targets that take this scope as input. */
550
+ targets: string[];
551
+ targetsTotal: number;
552
+ }
377
553
  /** Request: GUI widget tree for a .gui document; {@link GuiTreeParams} -> {@link GuiTree}. */
378
554
  export declare const guiTreeRequest = "paradox/guiTree";
379
555
  export interface GuiTreeParams {
@@ -404,7 +580,7 @@ export interface GuiTree {
404
580
  /**
405
581
  * Request: rendered GUI layout for a .gui document;
406
582
  * {@link GuiLayoutParams} -> {@link GuiLayoutResult}. Rectangles come from
407
- * the measured layout engine (docs/gui-designer/calibration/spec.md), with
583
+ * the measured layout engine (docs/gui-designer/spec.md), with
408
584
  * templates/types resolved against the vanilla + mod gui tree.
409
585
  */
410
586
  export declare const guiLayoutRequest = "paradox/guiLayout";
package/dist/protocol.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scopeAtRequest = exports.dependenciesRequest = exports.eventValueOptionsRequest = exports.EVENT_VOCABULARY_MAX_VALUES = exports.EVENT_VOCABULARY_MAX_TOKENS = exports.eventVocabularyRequest = exports.eventBannerRequest = exports.eventGraphRequest = exports.guiWidgetEditRequest = exports.guiSourceEditRequest = exports.guiSaveValuesRequest = exports.GUI_PREVIEW_MAX = exports.guiPreviewRequest = exports.guiVocabularyRequest = exports.guiDependenciesRequest = exports.guiWidgetInfoRequest = exports.guiLayoutRequest = exports.guiTreeRequest = exports.eventDetailRequest = exports.overridesRequest = exports.locCoverageRequest = exports.modOverviewRequest = exports.progressNotification = exports.indexChangedNotification = exports.statusNotification = exports.lookupLocRequest = exports.indexStatsRequest = exports.reloadDocsRequest = exports.modFileChangedNotification = exports.configChangedNotification = exports.allClientCommandIds = exports.clientCommands = void 0;
3
+ exports.scopeAtRequest = exports.dependenciesRequest = exports.eventValueOptionsRequest = exports.EVENT_VOCABULARY_MAX_VALUES = exports.EVENT_VOCABULARY_MAX_TOKENS = exports.eventVocabularyRequest = exports.eventBannerRequest = exports.eventGraphRequest = exports.guiWidgetEditRequest = exports.guiSourceEditRequest = exports.guiSaveValuesRequest = exports.GUI_PREVIEW_MAX = exports.guiPreviewRequest = exports.guiVocabularyRequest = exports.guiDependenciesRequest = exports.guiWidgetInfoRequest = exports.guiLayoutRequest = exports.guiTreeRequest = exports.exampleWikiEntryRequest = exports.exampleWikiVocabularyKinds = exports.exampleWikiVariableKinds = exports.exampleWikiRequest = exports.eventDetailRequest = exports.overridesRequest = exports.locCoverageRequest = exports.modOverviewRequest = exports.progressNotification = exports.indexChangedNotification = exports.statusNotification = exports.lookupLocRequest = exports.indexStatsRequest = exports.reloadDocsRequest = exports.modFileChangedNotification = exports.configChangedNotification = exports.allClientCommandIds = exports.clientCommands = void 0;
4
4
  // ---- client command ids ----------------------------------------------------
5
5
  /**
6
6
  * Client commands the server references in code actions and hover links (part
@@ -14,6 +14,7 @@ exports.clientCommands = {
14
14
  editLocalization: "px.editLocalization",
15
15
  openLocalizationSideBySide: "px.openLocalizationSideBySide",
16
16
  showReferences: "px.showReferences",
17
+ showExamplesWiki: "px.showExamplesWiki",
17
18
  };
18
19
  /** Every id in {@link clientCommands}: what a fully capable client registers. */
19
20
  exports.allClientCommandIds = Object.values(exports.clientCommands);
@@ -48,12 +49,46 @@ exports.locCoverageRequest = "paradox/locCoverage";
48
49
  exports.overridesRequest = "paradox/overrides";
49
50
  /** Request: full event detail for the graph inspector; {@link EventDetailParams} -> {@link EventDetail} | null. */
50
51
  exports.eventDetailRequest = "paradox/eventDetail";
52
+ /**
53
+ * Request: the searchable catalog behind the Examples Wiki;
54
+ * `null` -> {@link ExampleWikiIndex}.
55
+ *
56
+ * One compact row per name the server knows about, so a client can filter and
57
+ * rank the whole vocabulary without asking again. Everything expensive (the
58
+ * full documentation, the usage block, the vanilla sites) is left to
59
+ * {@link exampleWikiEntryRequest}.
60
+ */
61
+ exports.exampleWikiRequest = "paradox/exampleWiki";
62
+ /** The {@link ExampleWikiKind}s whose rows come from the definition index. */
63
+ exports.exampleWikiVariableKinds = [
64
+ "variable",
65
+ "local_variable",
66
+ "global_variable",
67
+ "variable_list",
68
+ "local_variable_list",
69
+ "global_variable_list",
70
+ "list",
71
+ ];
72
+ /**
73
+ * The {@link ExampleWikiKind}s whose rows are script grammar rather than a
74
+ * name from a dump or an index. One filter chip covers both.
75
+ */
76
+ exports.exampleWikiVocabularyKinds = ["keyword", "scope_word"];
77
+ /**
78
+ * Request: everything the toolkit knows about ONE Examples Wiki row;
79
+ * {@link ExampleWikiEntryParams} -> {@link ExampleWikiDetail} | null.
80
+ *
81
+ * `null` means the name is not in the catalog. Vanilla example sites are
82
+ * searched on demand and come back as absolute paths, so a client can open
83
+ * the file at the line without resolving anything itself.
84
+ */
85
+ exports.exampleWikiEntryRequest = "paradox/exampleWikiEntry";
51
86
  /** Request: GUI widget tree for a .gui document; {@link GuiTreeParams} -> {@link GuiTree}. */
52
87
  exports.guiTreeRequest = "paradox/guiTree";
53
88
  /**
54
89
  * Request: rendered GUI layout for a .gui document;
55
90
  * {@link GuiLayoutParams} -> {@link GuiLayoutResult}. Rectangles come from
56
- * the measured layout engine (docs/gui-designer/calibration/spec.md), with
91
+ * the measured layout engine (docs/gui-designer/spec.md), with
57
92
  * templates/types resolved against the vanilla + mod gui tree.
58
93
  */
59
94
  exports.guiLayoutRequest = "paradox/guiLayout";
@@ -0,0 +1,42 @@
1
+ /** Title/description pair of one Workshop language. Absent field = not translated. */
2
+ export interface WorkshopTranslation {
3
+ title?: string;
4
+ description?: string;
5
+ }
6
+ /** The fields of `workshop.json` this toolkit reads or writes. */
7
+ export interface WorkshopMeta {
8
+ /** Workshop item id (decimal string), for the games whose descriptor has no field for it. */
9
+ publishedFileId?: string;
10
+ /** The item's description in the default language, BBCode as Steam renders it. */
11
+ description?: string;
12
+ /** Keyed by Steam API language code (`german`, `schinese`, ...), never the default language. */
13
+ translations?: Record<string, WorkshopTranslation>;
14
+ }
15
+ /** Mod-root-relative path of the record, forward slashes. */
16
+ export declare function workshopMetaRelPath(configDirName: string): string;
17
+ /** The parsed `<dir>/<configDir>/workshop.json`, or null when absent/unreadable. */
18
+ export declare function readWorkshopMeta(dir: string, configDirName: string): WorkshopMeta | null;
19
+ /**
20
+ * Merge `patch` into the record and write it back. Unknown keys of the file
21
+ * survive; a patch key set to `undefined` is left as it was. `translations`
22
+ * replaces as a whole (the caller edits the full map).
23
+ */
24
+ export declare function upsertWorkshopMeta(dir: string, configDirName: string, patch: WorkshopMeta): void;
25
+ /**
26
+ * The languages the Workshop accepts item text in: Steam's API language codes
27
+ * with their English names, in Steam's documented order.
28
+ * https://partner.steamgames.com/doc/store/localization/languages
29
+ */
30
+ export declare const STEAM_LANGUAGES: readonly {
31
+ api: string;
32
+ label: string;
33
+ }[];
34
+ /** English name of a Steam API language code; the code itself when unknown. */
35
+ export declare function steamLanguageLabel(api: string): string;
36
+ /**
37
+ * Steam API language code for a Paradox localization folder language
38
+ * (`translationCore.ts` LOC_LANGUAGES), or null when Steam has no counterpart.
39
+ * The two vocabularies differ where Steam's codes predate its own store pages
40
+ * (`koreana`, `schinese`).
41
+ */
42
+ export declare function steamLanguageForLoc(locLanguage: string): string | null;