GNU bug report logs -
#48567
28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes
Previous Next
Full log
Message #8 received at 48567 <at> debbugs.gnu.org (full text, mbox):
Hi!
On 21.05.2021 15:33, Sam Weerasinghe wrote:
> I have a method like this:
>
> def create!
> form_name = "Acme Corp #{shop.label("Abandon Cart")}"
> end
>
> put point at the start of the phrase "Abandon Cart"
> and press C-c ' ( ruby-toggle-string-quotes ),
>
> the line becomes:
>
> form_name = 'Acme Corp #{shop.label("Abandon Cart")}'
>
> but the line should become:
>
> form_name = "Acme Corp #{shop.label('Abandon Cart')}"
Improving this in a consistent fashion is somewhat difficult because we
don't support an infinite nesting of string literals (or percent
literals, etc), and the "inner" quote characters are not really
considered to be quote characters by the syntax scanner anymore.
So identifying the pair of quotes to change, which ones to skip over,
and which ones to quote-unquote, will require some ad-hoc heuristics.
I'd be happy to review a patch, though.
This bug report was last modified 4 years and 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.