### Usage Examples for Prettier PDX Script Plugin Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Demonstrates common command-line usages for the Prettier PDX Script plugin. These commands format single files, check formatting without modification, and format multiple files within a directory. ```bash # Format a single file npx prettier --write path/to/file.txt # Check formatting without writing npx prettier --check path/to/file.txt # Format all .txt files in a directory npx prettier --write "path/to/scripts/**/*.txt" ``` -------------------------------- ### PDX Script Formatting Example Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Illustrates the input and output of the PDXScript formatting rules applied by the Prettier plugin. It shows changes in indentation, empty block representation, block value formatting, comment alignment, and operator preservation. ```text **Input:** ``` my_declaration={ key1= value1 key2 =value2 nested={ inner_key = "hello world" } # a comment } another_decl = { } ``` **Output:** ``` my_declaration = { key1 = value1 key2 = value2 nested = { inner_key = "hello world" } # a comment } another_decl = {} ``` ``` -------------------------------- ### Install Prettier PDX Script Plugin Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Installs the prettier-plugin-pdx-script using npm. This command adds the plugin as a development dependency to your project. Prettier automatically discovers and uses the plugin without further configuration. ```bash npm install --save-dev prettier-plugin-pdx-script ``` -------------------------------- ### PDX Script Container Window Definition Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/gui_structure_input.txt Defines a basic container window type in PDX script. This example shows how to declare a window with a name, visibility, and position. It serves as a foundational element for UI layout in PDX games. ```pdxscript guiTypes = { containerWindowType = { name = "my_container" visible = no position = { x = 0 y = 0 } } } ``` -------------------------------- ### Define PDX Script Idea with Modifiers Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/hoi4_idea_input.txt This snippet shows how to define a game idea named 'my_idea' within a country's configuration. It includes properties like 'removal_cost' and 'picture', and a 'modifier' block that applies debuffs to political power gain and consumer goods. The 'allowed' block specifies the conditions under which the idea is active, in this case, 'always'. ```pdx-script ideas = { country = { my_idea = { removal_cost = -1 pictur = my_picture modifier = { political_power_gain = -0.05 consumer_goods_factor = -0.15 } allowed = { always = yes } } } } ``` -------------------------------- ### Override Grammar WASM Binary Loader in TypeScript Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Shows how to override the default grammar WASM binary loader using the `setGrammarBinary` function from the `prettier-plugin-pdx-script` package. This is useful when bundling the plugin, for example, within a VS Code extension, where the WASM file might not be directly accessible. ```typescript import { setGrammarBinary } from "prettier-plugin-pdx-script"; // Load from a bundled Uint8Array setGrammarBinary(() => myWasmBinary); ``` -------------------------------- ### Run Test Suite Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Command to execute the project's test suite using bun. ```bash bun test ``` -------------------------------- ### Build WASM Parser for PDX Script Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Instructions to clone the tree-sitter-pdx_script repository, build the WASM file using tree-sitter, and copy it to the prettier-plugin-pdx-script project. This is necessary after modifying the grammar. ```bash git clone https://github.com/Myriad4Link/tree-sitter-pdx_script cd tree-sitter-pdx_script npx tree-sitter build --wasm cp tree-sitter-pdx_script.wasm /path/to/prettier-plugin-pdx-script/tree-sitter/ ``` -------------------------------- ### Build Project Output (ESM + CJS) Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Command to build the project's compiled output, generating both ECMAScript Modules (ESM) and CommonJS (CJS) formats using tsup. ```bash bun run build ``` -------------------------------- ### PDX Script Focus Tree Structure Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/focus_tree_input.txt This snippet demonstrates the basic structure of a focus tree in Paradox Development Studio script files. It includes defining a focus tree, a country condition, and a specific focus with its properties and completion reward. ```pdx-script focus_tree = { id = my_focus_tree country = { factor = 0 } focus = { id = my_focus icon = my_icon x = 1 y = 1 cost = 10 completion_reward = { add_political_power = 150 } } } ``` -------------------------------- ### Set Grammar WASM Binary (TypeScript) Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Provides the grammar WASM binary directly, bypassing the default loading mechanism. This is essential when bundling the plugin to ensure the correct grammar WASM is used. It must be called before any parse invocation. ```typescript import { setGrammarBinary } from "prettier-plugin-pdx-script"; import wasmBinary from "./tree-sitter-pdx_script.wasm"; setGrammarBinary(() => wasmBinary); ``` -------------------------------- ### Define Country Ideas in PDX Script Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/hoi4_idea_expected.txt This snippet demonstrates the hierarchical structure for defining country ideas in Paradox Interactive script files. It includes configuration for removal costs, associated imagery, and active modifiers. ```PDX Script ideas = { country = { my_idea = { removal_cost = -1 picture = my_picture modifier = { political_power_gain = -0.05 consumer_goods_factor = -0.15 } allowed = { always = yes } } } } ``` -------------------------------- ### Override WASM Locate File Callback (TypeScript) Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/README.md Allows overriding the default `locateFile` callback used by web-tree-sitter to find its runtime WASM file. This is useful when bundling the plugin and the default resolution path is incorrect. It must be called before any parse invocation. ```typescript import { setLocateFile } from "prettier-plugin-pdx-script"; import path from "path"; setLocateFile((fileName, _scriptDir) => { return path.join(__dirname, "wasm", fileName); }); ``` -------------------------------- ### Define GUI Container Window in PDX Script Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/gui_structure_expected.txt Defines a container window element for the game interface. It specifies the window name, visibility state, and screen coordinates for positioning. ```PDX Script guiTypes = { containerWindowType = { name = "my_container" visible = no position = { x = 0 y = 0 } } } ``` -------------------------------- ### Define Focus Tree in PDX Script Source: https://github.com/myriad4link/prettier-plugin-pdx-script/blob/main/tests/__fixtures__/realistic/focus_tree_expected.txt This snippet demonstrates the syntax for creating a focus tree object. It includes the tree identifier, country-specific factor constraints, and a nested focus node with reward logic. ```PDX Script focus_tree = { id = my_focus_tree country = { factor = 0 } focus = { id = my_focus icon = my_icon x = 1 y = 1 cost = 10 completion_reward = { add_political_power = 150 } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.