Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filters to Find in Files, to ignore Code, Strings, or Comments for find/replace #100839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Wierdox
Copy link
Contributor

@Wierdox Wierdox commented Dec 27, 2024

Partially supersedes #67796
Partially addresses Proposal #563

PR: For Find in Files, add filters to include/exclude Code, Strings, or Comments from your search results.

See it in action:

godot.windows.editor.x86_64_B5vbC8DonX.webm

Notes:

  • Multiline string/comment aware, including mid line usage like func pie(/*old_param,*/ new_param);.
  • "Language Agnostic".
    • Right now it either chooses gdscript # or c style // /**/, which as far as I'm aware are the only other languages(gdshader, csharp) supported in the editor. Maybe we could expose an option so users can add delimiters.
  • Should not affect search speed if you leave everything enabled, implementation wise it's opt-in ignores.
  • Find and Replace for Code Editor toolbar is not affected in this PR, it could be added in a follow up PR.
    • This is primarily due to the Code Editor using TextEdit to handle and draw the search highlights, which we can't do much about unless we copy pasta a lot of code or add coding related flags to TextEdit::SearchFlags. The latter of which was said to be avoided in the superseded PR.
    • Also, if we can squeeze this into 4.4, I think it's preferable to having to wait longer to also figure out how to make it work for local Find and Replace toolbar.
  • Uses the phrase "Inside:" on its own line. You could also put them alongside "Match Case" and "Whole Words", but it causes the prompt to widen in a way that makes it more ugly I think.
  • Strings filter is just a bonus while I was working on it, it could be removed if it's seen as not very useful. I for one don't have a use for it, but I saw a comment on the superseded PR bring it up.

@Wierdox Wierdox requested a review from a team as a code owner December 27, 2024 03:28
@Wierdox Wierdox changed the title Add filters to Find in Files, to ignore Code, Strings, and Comments for find/replace Add filters to Find in Files, to ignore Code, Strings, or Comments for find/replace Dec 27, 2024
@Chaosus Chaosus added this to the 4.x milestone Dec 27, 2024
@Wierdox
Copy link
Contributor Author

Wierdox commented Dec 27, 2024

Related to #75607, which replaces a bunch of internal functions, adds a file-extension-aware scanner, and allows .tscn files to be scanned for built-in scripts by default.

@Wierdox Wierdox force-pushed the add_three_new_filters_to_find_and_replace branch from f1c221c to b0ac40b Compare December 31, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants