Skip to content

Added ignored directories for on-save functionality - #191

Merged
NathanLovato merged 2 commits into
GDQuest:mainfrom
NGAndersson:patch-3
Jan 11, 2026
Merged

Added ignored directories for on-save functionality#191
NathanLovato merged 2 commits into
GDQuest:mainfrom
NGAndersson:patch-3

Conversation

@NGAndersson

Copy link
Copy Markdown
Contributor

Please check if the PR fulfills these requirements:

  • The commit message follows our guidelines.
  • For bug fixes and features:
    • You tested the changes.

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!

@NathanLovato
NathanLovato merged commit 0f0d66f into GDQuest:mainJan 11, 2026
@NathanLovato

Copy link
Copy Markdown
Contributor

Thank you for taking the time to contribute! It's much appreciated.

@NGAndersson
NGAndersson deleted the patch-3 branch January 12, 2026 15:22
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.
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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@NGAndersson@NathanLovato