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

Provide help or warnings for syntax in Replace With field #12725

Open
core-ai-bot opened this issue Aug 31, 2021 · 2 comments
Open

Provide help or warnings for syntax in Replace With field #12725

core-ai-bot opened this issue Aug 31, 2021 · 2 comments

Comments

@core-ai-bot
Copy link
Member

Issue by RaymondLim
Friday Jun 20, 2014 at 16:56 GMT
Originally opened as adobe/brackets#8202


replacewith

As you can see in the above screenshot, when the user types a replacement text with $1, $_ or $', we should check the regex syntax in Find text field and warn the user if the regex syntax is wrong (or won't work as expected).

@core-ai-bot
Copy link
Member Author

Comment by MarcelGerber
Saturday Jun 21, 2014 at 00:01 GMT


Notice $_ and $' won't work in Brackets.
But you're right, it would be cool to have.

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Monday Jul 07, 2014 at 19:57 GMT


Reviewed. Low priority@larz0 to think about what kind of guidance & feedback we want to give for replacement in general:

  • Should we give syntax guidance about how to insert regexp groups? ($1 vs. \1, how to escape the $, etc.). Some editors have a very fancy UI where you can insert (and drag to rearrange) little placeholder icons in the string so you don't have to think about syntax... pretty sure we don't want anything that elaborate here, but you could imagine a little button that just inserts '$1' into the string, with a tooltip or link to more info from there. Etc.
  • Should we give warnings if the user puts $1/etc. in the replacement string but the query isn't regexp mode?
  • Should we give warnings if the user appears to be misusing the replacement syntax? (E.g. if we see n they probably meant $n; if we see $n they probably meant $$n; etc.)
  • Should we give errors/warnings if the user puts $n where n is out of range? (E.g. in the example above there are zero capturing groups in the regexp, so $1 to reference the 1st capturing group is essentially invalid).

Nominated for 1.0 since we've seen a few people get confused about replacement syntax in general (it's pretty inconsistent across editors), so some kind of usability polish here is probably worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant