Uh oh!
There was an error while loading. Please reload this page.
Added ignored directories for on-save functionality - #191
Merged
Conversation
NathanLovato
commented
Jan 11, 2026
Contributor
Thank you for taking the time to contribute! It's much appreciated. |
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…ng slash Fixes a bug introduced in GDQuest#191 Directory paths with a trailing "/" (e.g. "addons/") would produce a trailing empty string when split on "/", which could never match a real path segment. This silently broke the ignore rule for any entry with a trailing slash. This fix trims the trailing "/" before splitting.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…eeper than script path Fixes a bug introduced in GDQuest#191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…eeper than script path Fixes a bug introduced in GDQuest#191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…s entries Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…s entries Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 12, 2026
…s entries Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead.
2 tasks
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 13, 2026
…e an earlier entry after normalization Fixes a bug introduced in GDQuest#191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…eeper than script path Fixes a bug introduced in GDQuest#191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…s entries Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…e an earlier entry after normalization Fixes a bug introduced in GDQuest#191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…ng slash Fixes a bug introduced in GDQuest#191 Directory paths with a trailing "/" (e.g. "addons/") would produce a trailing empty string when split on "/", which could never match a real path segment. This silently broke the ignore rule for any entry with a trailing slash. This fix trims the trailing "/" before splitting.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…eeper than script path Fixes a bug introduced in GDQuest#191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…s entries Fixes a bug introduced in GDQuest#191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…e an earlier entry after normalization Fixes a bug introduced in GDQuest#191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with.
NoahGreer added a commit
to NoahGreer/GDScript-formatter
that referenced
this pull request
Aug 14, 2026
…duplicate an earlier entry after normalization Fixes a bug introduced in GDQuest#191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with.
NathanLovato added a commit
that referenced
this pull request
Aug 14, 2026
* fix(plugin): resolve ignored directories never matching due to trailing slash Fixes a bug introduced in #191 Directory paths with a trailing "/" (e.g. "addons/") would produce a trailing empty string when split on "/", which could never match a real path segment. This silently broke the ignore rule for any entry with a trailing slash. This fix trims the trailing "/" before splitting. * fix(plugin): resolve out-of-bounds access when ignored directory is deeper than script path Fixes a bug introduced in #191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix. * fix(plugin): skip and warn on blank format on save ignored directories entries Fixes a bug introduced in #191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead. * fix(plugin): warn on format on save ignored directories entries that duplicate an earlier entry after normalization Fixes a bug introduced in #191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with. * refactor: trim comments, rename variables --------- Co-authored-by: Nathan Lovato <12694995+NathanLovato@users.noreply.github.com>
NathanLovato added a commit
that referenced
this pull request
Aug 14, 2026
* fix(plugin): resolve ignored directories never matching due to trailing slash Fixes a bug introduced in #191 Directory paths with a trailing "/" (e.g. "addons/") would produce a trailing empty string when split on "/", which could never match a real path segment. This silently broke the ignore rule for any entry with a trailing slash. This fix trims the trailing "/" before splitting. * fix(plugin): resolve out-of-bounds access when ignored directory is deeper than script path Fixes a bug introduced in #191 The matching loop indexed script_path_parts[i] using the length of directory_parts, without checking that directory_parts wasn't longer. If an ignored directory's path has more segments than the script's path, and every one of those extra segments follows a full match of the script's path, the loop runs past the end of script_path_parts. Example: script at "res://addons/foo.gd" (script_path_parts = ["addons", "foo.gd"]) checked against ignored directory "addons/foo.gd/bar" (directory_parts = ["addons", "foo.gd", "bar"]). The first two segments match, then the loop tries to read script_path_parts[2], which doesn't exist. Skip directories that have more segments than the script path, since they can never match as a prefix. * fix(plugin): skip and warn on blank format on save ignored directories entries Fixes a bug introduced in #191 An ignored directory entry that is blank, "res://", or just "/" would normalize to an empty string. Splitting that on "/" produces [""], which could be compared against script path segments in unintended ways instead of being treated as an invalid entry. Skip these entries and push a warning so users know the entry has no usable path and needs to be removed or corrected. Also warns the user that if the intention was to ignore the whole project that this is not supported here and they need to turn of format on save instead. * fix(plugin): warn on format on save ignored directories entries that duplicate an earlier entry after normalization Fixes a bug introduced in #191 The Format on Save Ignored Directories list was not checked for entries that normalize to the same path despite being written differently (e.g. "res://addons" and "addons/"). This could let redundant entries sit in the list unnoticed. Track each normalized entry as it's validated, and if a later entry normalizes to the same as one already seen, skip it and push a warning naming both the duplicate and the original entry it conflicts with. * refactor: trim comments, rename variables --------- Co-authored-by: Nathan Lovato <12694995+NathanLovato@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements:
Related issue (if applicable): #
What kind of change does this PR introduce?
Adds a setting to exclude certain paths for on-save formatting/linting.
Does this PR introduce a breaking change?
It will by default cause files in the addon-folder to be excluded from on-save formatting/linting, which might confuse people who expected that to work.
New feature or change
What is the current behavior?
If "format on save" is enabled, all files are formatted and/or linted on save.
What is the new behavior?
Files that are in excluded paths are no longer formatted and/or linted on save.
Other information
I was just kinda annoyed of big reformats when tweaking other people's addons (this one included). Hoping this simple feature is helpful for someone!