From a3d40186df8c60cfc53e5ce193fde4388170e8c5 Mon Sep 17 00:00:00 2001 From: Bill Liu Date: Thu, 23 Nov 2017 00:46:56 -0800 Subject: [PATCH] Recognize new template parameter declaration syntax. Documentation for the new syntax is here: https://developers.google.com/closure/templates/docs/commands#param --- Syntaxes/Soy.YAML-tmLanguage | 13 ++++++++---- Syntaxes/Soy.tmLanguage | 41 +++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Syntaxes/Soy.YAML-tmLanguage b/Syntaxes/Soy.YAML-tmLanguage index 49eefc4..2c44bee 100644 --- a/Syntaxes/Soy.YAML-tmLanguage +++ b/Syntaxes/Soy.YAML-tmLanguage @@ -89,10 +89,7 @@ repository: endCaptures: '1': {name: punctuation.definition.comment.end.soy} patterns: - - match: (@param|@param\?)\s+(\w+) - captures: - '1': {name: support.type.soy} - '2': {name: variable.parameter.soy} + - include: '#template-param' comment-line: name: comment.line.double-slash.soy @@ -393,6 +390,7 @@ repository: - include: '#number' - include: '#primitive' - include: '#print-parameter' + - include: '#template-param' tag-simple: name: entity.name.tag.soy @@ -432,6 +430,13 @@ repository: '2': {name: keyword.operator.soy} '3': {name: string.quoted.single.soy} + template-param: + name: meta.tag.template.param.soy + match: (@param|@param\?)\s+(\w+) + captures: + '1': {name: support.type.soy} + '2': {name: variable.parameter.soy} + variable: name: variable.other.soy match: \$[\w\.]+ diff --git a/Syntaxes/Soy.tmLanguage b/Syntaxes/Soy.tmLanguage index d01db53..bc91345 100644 --- a/Syntaxes/Soy.tmLanguage +++ b/Syntaxes/Soy.tmLanguage @@ -235,21 +235,8 @@ patterns - captures - - 1 - - name - support.type.soy - - 2 - - name - variable.parameter.soy - - - match - (@param|@param\?)\s+(\w+) + include + #template-param @@ -1158,6 +1145,10 @@ include #print-parameter + + include + #template-param + tag-simple @@ -1300,6 +1291,26 @@ + template-param + + captures + + 1 + + name + support.type.soy + + 2 + + name + variable.parameter.soy + + + match + (@param|@param\?)\s+(\w+) + name + meta.tag.template.param.soy + variable match