Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

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

Open
RaymondLim opened this issue Jun 20, 2014 · 2 comments
Open

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

RaymondLim opened this issue Jun 20, 2014 · 2 comments

Comments

@RaymondLim
Copy link
Contributor

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).

@RaymondLim RaymondLim changed the title Need to provide replacement syntax checking in Replace With text field. Need to provide replacement text syntax checking in Replace With text field. Jun 20, 2014
@marcelgerber
Copy link
Contributor

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

@peterflynn peterflynn added this to the Brackets 1.0 milestone Jul 7, 2014
@peterflynn
Copy link
Member

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.

@peterflynn peterflynn changed the title Need to provide replacement text syntax checking in Replace With text field. Provide help or warnings for syntax in Replace With field Aug 13, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants