scala.tmbundle icon indicating copy to clipboard operation
scala.tmbundle copied to clipboard

language grammar misses primitive types in parameter lists

Open JayDaley opened this issue 13 years ago • 2 comments

In the language grammar the following language rule is defined in such a way that it misses primitive types inside the parameter list and scopes them as an entity.name.class instead

parameter-list = {
  patterns = (
    { match = '([a-zA-Z$_][a-zA-Z0-9$_]*)\s*:\s*([A-Za-z0-9][\w|_|?|\.]*)?,?';
      captures = {
        1 = { name = 'variable.parameter'; };
        2 = { name = 'entity.name.class'; };
      };
    },
  );
};

I'm pretty sure that the way to fix this involves using

begin = '\(';
end = '\)';

and then recursively calling the storage and other language rules but I've no idea how to do that!

JayDaley avatar Aug 24 '11 11:08 JayDaley

Hi Jay,

Yes I think you're right and there's probably room for improvements here. It would require quite a lot of testing though to make sure that it didn't break any highlighting so will have to wait for a day where I have more time :)

mads-hartmann avatar Aug 24 '11 11:08 mads-hartmann

You can see how to apply rules recursively in 'block-comments' if you want to take a whack at it yourself.

mads-hartmann avatar Aug 24 '11 11:08 mads-hartmann