On 3 Apr 2014, at 9:03, Allan Odgaard wrote:

On 3 Apr 2014, at 13:45, Ingo Lantschner wrote:

[…] But it has some side-effects: E.g. the change from double-quotes to single-quotes by pressing Ctrl+Shift+" does not work any more. Plus I would like to change the formatting (color, ...) to something different.

What would be the the best way?

To make toggling quotes work, add proper scope to the string part, e.g.:

{    patterns = (
    {    name = 'comment.line.debug.perl';
        match = '\bi ((''.*'')|(".*")|(q{.*})|(qq{.*}));';
    },
    captures = {
        2 = { name = 'string.quoted.single'; };
        3 = { name = 'string.quoted.double'; };
        4 = { name = 'string.quoted.other.q.perl'; };
        5 = { name = 'string.quoted.other.qq.perl'; };
    };
);

hmh, the code above did not parse. I changed it to this one, which I could save:

  {    patterns = (
          {    name = 'comment.line.debug.perl';
              match = '\bi ''.*'';|\bi ".*";|\bi q{.*};|\bi qq{.*};';
              captures = {
                  2 = { name = 'string.quoted.single'; };
                  3 = { name = 'string.quoted.double'; };
                  4 = { name = 'string.quoted.other.q.perl'; };
                  5 = { name = 'string.quoted.other.qq.perl'; };
              };
          },
      );
  }

But it still has no effect on the toggling of quotes. Just to avoid miss-understandings: This is part of my personal bundle (Language Grammar, Grammar: source.untitled, Injection-Selector: source.perl)

As for formatting, this would need to be added to the current theme (or possibly as global settings).

Here you would target comment.line.debug.perl in the theme.

Ok, thanks! How could I create a new "target", completely unrelated to
comments. The present solution, to treat lines starting with i as comments is
more a workaround. In fact these lines are valid and executed Perl code. What I
really would like to see, is that they are presented (but not treated) like
comments.

Kind regards, Ingo

--
Ingo Lantschner