{"id":26189070,"url":"https://github.com/poeticandroid/pretty-gd-js","last_synced_at":"2026-06-04T19:31:26.638Z","repository":{"id":281551707,"uuid":"945540591","full_name":"poeticAndroid/pretty-gd-js","owner":"poeticAndroid","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-09T09:48:18.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T09:51:45.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"GAP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/poeticAndroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-09T17:03:51.000Z","updated_at":"2025-04-09T09:48:22.000Z","dependencies_parsed_at":"2025-03-27T15:38:50.990Z","dependency_job_id":null,"html_url":"https://github.com/poeticAndroid/pretty-gd-js","commit_stats":null,"previous_names":["poeticandroid/prettify-gdscript","poeticandroid/pretty-gd-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poeticAndroid%2Fpretty-gd-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poeticAndroid%2Fpretty-gd-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poeticAndroid%2Fpretty-gd-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poeticAndroid%2Fpretty-gd-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poeticAndroid","download_url":"https://codeload.github.com/poeticAndroid/pretty-gd-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248989027,"owners_count":21194516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-12T00:30:14.369Z","updated_at":"2026-02-25T17:10:35.354Z","avatar_url":"https://github.com/poeticAndroid.png","language":"GAP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pretty.gd for JavaScript\n\n![pretty godot](./images/pretty.png)\n\nA formatter for GDScript that just works!\n\n## Usage\n\n### Command line\n\n```\n$ npm install -g pretty-gd-js\n\n$ pretty-gd --help\nUsage: pretty-gd [options] [path] [files...]\n\nOptions:\n  -s, --spaces \u003csize\u003e  enforce (or, if -t is also set, convert from) space-based indentation\n  -t, --tabs           enforce tab-based indentation\n  -a, --auto           auto-detect indentation on each file separately\n  -p, --stdio          read from stdin and write it prettified to stdout\n  -d, --dir            prettify all *.gd files in [path]\n  -w, --watch          automatically prettify any modified *.gd files in [path]\n  -v, --version        display version\n  -h, --help           display help for command\n```\n\n### Godot editor\n\nFrom the terminal/command line, type the following:\n\n```\n$ cd path/to/godot/project/\n\n$ pretty-gd -w\nWatching ./ for changes...\n```\n\nThe  `-w/--watch` option alone will not check already existing files, but only those that get modified _while_ `pretty-gd -w` is running.\nYou can add `-d/--dir` to also check existing files, like this: `pretty-gd -d -w`\n\nTo disable the annoying \"Files have been modified outside Godot\" dialog box, go to the following setting and enable it:\n\n`Editor -\u003e Editor Settings -\u003e Text Editor -\u003e Behavior -\u003e Auto Reload Scripts on External Change`\n\nNote that when `pretty-gd` modifies a file, the changes doesn't show up in Godot editor right away. External changes are only detected when the Godot window changes focus.\n\n### JavaScript API\n\n  - `prettify(input: string, startInsideString: string = null): string`\n    - `input: string` // The string of GDScript to make pretty.\n    - `startInsideString: string` // If set to a string delimiter, assume `input` is starting inside a string. Default is `null`.\n  - `isInsideString: string` // If last operation ended inside a string, this will be set to the type of quotes(string delimiter) of the string. Otherwise `null`.\n  - `indent: string` // Indentation string. Default is `null` for auto-detect.\n  - `tabSize: number` // Tab size. This will be overwritten if `indent` is set or detected to be space-based. Default is `4`.\n\nTo parse a document line by line, remember to feed `isInsideString` back into the `prettify()` call as the second parameter.\n\nKeep in mind that `indent` and `tabSize` will be preserved between calls to `prettify()`.\nIf you want to auto-detect for each call, remember to reset these properties to `null`.\n\n#### Example\n\n```js\nimport fs from \"node:fs\"\nimport pretty from \"pretty-gd-js\"\n\n// configure indentation\npretty.indent = \"\\t\"\npretty.tabSize = 4\n\nlet file = \"my_script.gd\"\nlet input = fs.readFileSync(file)\nlet output = pretty.prettify(input) // \u003c- This is the main function\nfs.writeFileSync(file, output + \"\\n\")\n```\n\n## Known Issues\n\n - The Godot editor only checks for file changes when the window changes from unfocused to focused. So if you're running `pretty-gd -w` in the background, and it prettifies a script you just saved, you won't see the prettified script until you tab out and back into the editor.\n - It seems Godot editor only checks the file timestamp down to the second (at least on some systems), meaning if Godot editor saves a file that then gets changed and resaved externally within the same second, Godot editor doesn't detect it as a change. Hence why `pretty-gd -w` will wait one second before resaving the file.\n\nIf you come across any other issues with using this software, please [let me know](https://github.com/poeticAndroid/pretty-gd-js/issues).\n\n## Release Notes\n\n### 1.18.1\n\n - Another bugfix of handling of multiline strings. 🤞\n\n### 1.18.0\n\n - Making sure that lines ending with a `:` is followed by a properly indented line.\n - Positive numbers/values can now be signed with a `+`.\n - Command line tool renamed to `pretty-gd`. (`pretty.gd` still included as an alias.)\n\n### 1.17.0\n\n - `-a/--auto` option to auto-detect type of indentation on each file, instead of auto-detecting only on the first encountered file and applying it to all files, if neither `-s`, `-t` or `-a` is set.\n - `pretty.gd -w` will now prettify a file immediately after detecting a change (which can still take up to a second). Instead of delaying the file write to trigger Godot editor's change detection, `pretty.gd` will write the file straight away and then update it's modification timestamp a second later.\n - More strict parsing of number literals.\n - A `0` gets added to number literals that start or end with a decimal point or `e`(exponent marker).\n - Redundant leading zeroes gets removed from number literals.\n - Negative numbers that come after closing brackets`)}]`, strings, names or other numbers are treated as a subtraction of a unsigned number, thus separating the `-` and the number.\n - Bugfixed handling of multiline strings, so a string delimiter(`'`, `\"`, `'''` or `\"\"\"`) can now stand alone on a line and the parser will recognize it as _either_ the beginning _or_ end of a string (and not both).\n\n### 1.16.0\n\n - `match`, `tool`, `onready`, `export`, `setget`, `remote`, `master`, `puppet`, `remotesync`, `mastersync` and `puppetsync` are no longer treated as keywords that has to be surrounded by whitespace.\n\n### 1.15.0\n\n - In `--watch` mode, file changes will be delayed by one second to ensure Godot editor will detect it as an external change.\n - Added `--stdio` mode for piping data in and out.\n\n### 1.14.2\n\n - Display version with `--version`.\n - Refactored to use ES modules instead of `require`.\n - Test tool that [runs in the browser](https://github.com/poeticAndroid/pretty-gd-js/blob/main/test/test.html).\n - Fixed bug parsing multi-line strings.\n\n### 1.14.1\n\n - If `--dir` or `--watch` are used without specifying a `path`, it will default to current directory.\n - Command-line tool will safely ignore files and folders it cannot access.\n\n### 1.14.0\n\n - Number literals, including hexadecimals, will be corrected to lower case.\n - Support for all types of strings, including `r\"raw strings\"`, `'''triple-single-quoted strings'''` and `%\"node strings\"`.\n - Better handling of multiline strings of any type. API changed slightly.\n\n### 1.13.1\n\n - Command line options to prettify entire folders.\n - `not` is no longer treated as a keyword that has to be surrounded by whitespace.\n - `{ curly brackets }` are now padded inside.\n - Vertical spacing gets adjusted. `func` and `class` declarations get two blank lines above them. Maximum one consecutive blank line everywhere else.\n\n### 1.12.0\n\n - Removed `eol` property. Godot editor always saves with unix-style endings anyway.\n\n### 1.11.3\n\n - The command line tool now actually works\n - Command line options\n\n### 1.11.0\n\n - Parse indentation based on visual space, rather than character count\n\n### 1.10.0\n\n - Treat `!` as a sign (like `-` for negative values)\n\n### 1.9.0\n\n - Opening curly brackets is now its own class (which helps with spacing in enums)\n\n### 1.7.0\n\n - Recognize operators longer than one character\n - Refactored tokenizer\n\n### 1.3.0\n\n - Added support for `_` in numbers\n - Added support for `@annotations`\n - Added support for nodepaths starting with `\u0026`, `^` or `%`\n\n### 1.2.0\n\n - Recognizing node paths\n\n### 0.3.0\n\n - Giving keywords some room\n\n### 0.2.0\n\n  - Fancy icon!\n\n### 0.1.0\n\nInitial release!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoeticandroid%2Fpretty-gd-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoeticandroid%2Fpretty-gd-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoeticandroid%2Fpretty-gd-js/lists"}