From f31e55fa219adebdf1d5f27502330c02a50dfede Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 26 Jan 2016 12:05:51 +0300 Subject: [PATCH 1/3] Add simple syntax highlighting --- Syntaxes/YARD.tmLanguage | 106 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Syntaxes/YARD.tmLanguage diff --git a/Syntaxes/YARD.tmLanguage b/Syntaxes/YARD.tmLanguage new file mode 100644 index 0000000..0d6fb6b --- /dev/null +++ b/Syntaxes/YARD.tmLanguage @@ -0,0 +1,106 @@ + + + + + fileTypes + + injectionSelector + comment + name + YARD + patterns + + + begin + (?<=#\s)(@)([a-z][\w\-]+)\b + beginCaptures + + 1 + + name + punctuation.definition.tag.yard + + 2 + + name + entity.name.tag.meta.yard + + + end + (?=\n) + name + meta.tag.yard + patterns + + + begin + (?<=\s)(\[) + beginCaptures + + 1 + + name + punctuation.definition.parameters.begin.yard + + + end + (\])(?=\s|\n) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.yard + + + name + meta.array.parameters.yard + patterns + + + captures + + 1 + + name + punctuation.definition.array.begin.yard + + 2 + + name + entity.name.type.class.yard + + 3 + + name + punctuation.definition.array.end.yard + + + match + \b(?:[A-Z]\w+(?:::[A-Z]\w+)*)(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b + name + entity.name.type.class.yard + + + match + \b([a-z]\w*)\b + name + entity.other.attribute-name.yard + + + match + ,\s* + name + punctuation.separator.parameters.yard + + + + + + + scopeName + text.yard + uuid + A8EEAEB2-BB67-4F21-9A8F-D528A9CE0830 + + From 5bd840624291e6be20646aa7bd5aa304778b4f79 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 29 Apr 2016 00:32:25 +0300 Subject: [PATCH 2/3] Better capturing --- Preferences/Deprecated.tmPreferences | 21 +++ Preferences/Keyword Tag.tmPreferences | 17 ++ Snippets/New Comment Line.tmSnippet | 2 - Syntaxes/YARD.tmLanguage | 225 +++++++++++++++++++++++++- Syntaxes/yard.textmate.tmLanguage | 71 ++++++++ 5 files changed, 327 insertions(+), 9 deletions(-) create mode 100644 Preferences/Deprecated.tmPreferences create mode 100644 Preferences/Keyword Tag.tmPreferences create mode 100644 Syntaxes/yard.textmate.tmLanguage diff --git a/Preferences/Deprecated.tmPreferences b/Preferences/Deprecated.tmPreferences new file mode 100644 index 0000000..339d15f --- /dev/null +++ b/Preferences/Deprecated.tmPreferences @@ -0,0 +1,21 @@ + + + + + name + Deprecated + scope + meta.tag.yard.deprecated keyword.other.documentation.deprecated.yard + settings + + background + #FFDDDD + fontStyle + bold + foreground + #606060 + + uuid + 2E14DFBA-00D5-46DE-A622-389B47B4D9EB + + diff --git a/Preferences/Keyword Tag.tmPreferences b/Preferences/Keyword Tag.tmPreferences new file mode 100644 index 0000000..7a05ed9 --- /dev/null +++ b/Preferences/Keyword Tag.tmPreferences @@ -0,0 +1,17 @@ + + + + + name + Keyword Tag + scope + meta.tag.yard keyword.other + settings + + foreground + #606060 + + uuid + 4F9D0E17-444C-4218-90E0-46B7EF99D2E1 + + diff --git a/Snippets/New Comment Line.tmSnippet b/Snippets/New Comment Line.tmSnippet index 1b858c4..c7bb443 100644 --- a/Snippets/New Comment Line.tmSnippet +++ b/Snippets/New Comment Line.tmSnippet @@ -11,8 +11,6 @@ New Comment Line scope comment.line.number-sign.ruby - tabTrigger - source.ruby uuid B8AD763C-830B-4A5B-AD40-5E7B90C83F0A diff --git a/Syntaxes/YARD.tmLanguage b/Syntaxes/YARD.tmLanguage index 0d6fb6b..3202c70 100644 --- a/Syntaxes/YARD.tmLanguage +++ b/Syntaxes/YARD.tmLanguage @@ -12,18 +12,18 @@ begin - (?<=#\s)(@)([a-z][\w\-]+)\b + (?<=#\s)(@)(?!return|param)([a-z][\w\-]+[a-z])\b(?!\.|\s*(?:\|\|)?=\s*) beginCaptures 1 name - punctuation.definition.tag.yard + punctuation.definition.keyword.other.documentation.tag.yard 2 name - entity.name.tag.meta.yard + keyword.other.documentation.tag.yard end @@ -44,7 +44,7 @@ end - (\])(?=\s|\n) + (\])(?:\s+([a-z]\w*))?(?=\s|\n) endCaptures 1 @@ -52,11 +52,22 @@ name punctuation.definition.parameters.end.yard + 2 + + name + entity.other.attribute-name.yard + name meta.array.parameters.yard patterns + + match + \b[A-Z]\w+(?:::[A-Z]\w+)*\b + name + keyword.other.directive.class.yard + captures @@ -68,7 +79,7 @@ 2 name - entity.name.type.class.yard + keyword.other.directive.class.yard 3 @@ -77,9 +88,9 @@ match - \b(?:[A-Z]\w+(?:::[A-Z]\w+)*)(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b + \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b name - entity.name.type.class.yard + keyword.other.directive.array.yard match @@ -97,7 +108,207 @@ + + begin + (?<=#\s)(@)(return)\b(?!\.|\s*=\s*) + beginCaptures + + 1 + + name + punctuation.definition.keyword.other.documentation.tag.yard + + 2 + + name + keyword.other.documentation.tag.yard + + + end + (?=\n|$) + name + meta.tag.yard.return + patterns + + + begin + (?<=@return\s)(\[) + beginCaptures + + 1 + + name + punctuation.definition.parameters.begin.yard + + + end + (\])(?=\s|\n|$) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.yard + + + name + meta.array.parameters.yard + patterns + + + match + \b[A-Z]\w+(?:::[A-Z]\w+)*\b + name + keyword.other.directive.class.yard + + + captures + + 1 + + name + punctuation.definition.array.begin.yard + + 2 + + name + keyword.other.directive.class.yard + + 3 + + name + punctuation.definition.array.end.yard + + + match + \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b + name + keyword.other.directive.array.yard + + + match + ,\s* + name + punctuation.separator.parameters.yard + + + + + + + begin + (?<=#\s)(@)(param)\b(?!\.|\s*=\s*) + beginCaptures + + 1 + + name + punctuation.definition.keyword.other.documentation.tag.yard + + 2 + + name + keyword.other.documentation.tag.yard + + + end + (?=\n|$) + name + meta.tag.yard.param + patterns + + + begin + (?<=@param\s)(?:\s*([a-z]\w*)\s)?\s*(\[) + beginCaptures + + 1 + + name + entity.other.attribute-name.yard + + 2 + + name + punctuation.definition.parameters.begin.yard + + + end + (\])(?=\s|\n|$) + endCaptures + + 1 + + name + punctuation.definition.parameters.end.yard + + + name + meta.array.parameters.yard + patterns + + + match + \b[A-Z]\w+(?:::[A-Z]\w+)*\b + name + keyword.other.directive.class.yard + + + captures + + 1 + + name + punctuation.definition.array.begin.yard + + 2 + + name + keyword.other.directive.class.yard + + 3 + + name + punctuation.definition.array.end.yard + + + match + \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b + name + keyword.other.directive.array.yard + + + match + ,\s* + name + punctuation.separator.parameters.yard + + + + + + + captures + + 1 + + name + punctuation.definition.keyword.other.documentation.tag.yard + + 2 + + name + keyword.other.documentation.deprecated.yard + + + match + (?<=#\s)(@)(!deprecated)(?=\n|$) + name + meta.tag.yard.deprecated + + scope + source.ruby scopeName text.yard uuid diff --git a/Syntaxes/yard.textmate.tmLanguage b/Syntaxes/yard.textmate.tmLanguage new file mode 100644 index 0000000..33ccbf8 --- /dev/null +++ b/Syntaxes/yard.textmate.tmLanguage @@ -0,0 +1,71 @@ +{ patterns = ( + { name = 'meta.tag.yard'; + begin = '(?<=#\s)(@)([_a-zA-Z][_a-zA-Z0-9\-]*)\b(?!\.|\s*=\s*)'; + end = '(?=\n|$)'; + beginCaptures = { + 1 = { name = 'punctuation.definition.keyword.other.documentation.tag.yard'; }; + 2 = { name = 'keyword.other.documentation.tag.yard'; }; + }; + patterns = ( + { include = "#name"; }, + { include = "#types"; }, + { include = "#description"; } + ); + }, + { name = 'meta.tag.yard.param'; + match = '(?<=#\s)(@)(param)'; + } + ); + repository = { + array_type = { + name = 'keyword.other.directive.array.yard'; + begin = 'Array(\<)'; + end = '\>'; + beginCaptures = { 1 = { name = 'punctuation.definition.parameters.yard'; }; }; + endCaptures = { 0 = { name = 'punctuation.definition.parameters.yard'; }; }; + patterns = ( + { begin = '(?=[A-Z])'; + end = '(?=[,>])'; + patterns = ( + { name = 'keyword.other.directive.class.yard'; + match = '\G[A-Z]\w*(?:::[A-Z]\w*)*'; + }, + { include = "$self"; } + ); + } + ); + }; + name = { + name = 'entity.other.attribute-name.yard'; + match = '(?<=\]|\s)\b([_a-zA-Z][_a-zA-Z0-9\-]*)\b(?=\[|\s)'; + }; + list_separator = { + name = 'punctuation.separator.parameters.yard'; + match = ',\s*'; + }; + types = { + name = 'meta.array.types.yard'; + begin = '\b(\[)'; + end = '\]'; + beginCaptures = { + 1 = { name = 'entity.other.attribute-name.yard'; }; + }; + endCaptures = { 0 = { name = 'punctuation.definition.parameters.yard'; }; }; + patterns = ( + { begin = '(?=[A-Z])'; + end = '(?=[,\]])'; + patterns = ( + { name = 'keyword.other.directive.class.yard'; + match = '\G[A-Z]\w*(?:::[A-Z]\w*)*'; + }, + { include = "#array_type"; }, + { include = "$self"; } + ); + } + ); + }; + description = { + match = '(?<=\s).+?(?=\n|$)'; + }; + }; +} \ No newline at end of file From cc1d80687e6a288b89d110dbcf83bfde21c40204 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 15 Nov 2021 13:06:12 +0300 Subject: [PATCH 3/3] Add snippets, commands & settings --- Commands/Start Comments.tmCommand | 2 +- Preferences/Keyword Tag.tmPreferences | 2 +- Preferences/Standalone Name.tmPreferences | 17 ++ Preferences/Swagger kw.tmPreferences | 17 ++ Snippets/@authorize_with.tmSnippet | 17 ++ Snippets/@example.tmSnippet | 18 ++ Snippets/@parameter.tmSnippet | 17 ++ Snippets/@path.tmSnippet | 17 ++ Snippets/@resource.tmSnippet | 19 ++ Snippets/@response.tmSnippet | 17 ++ Snippets/@response_type.tmSnippet | 17 ++ Snippets/@route.tmSnippet | 17 ++ Snippets/Action doc.tmSnippet | 20 ++ Snippets/Alias Of.tmSnippet | 16 ++ Snippets/Available Since.tmSnippet | 16 ++ Snippets/Calls Method.tmSnippet | 16 ++ Snippets/Categories.tmSnippet | 16 ++ Snippets/Parameter.tmSnippet | 16 ++ Snippets/Raises Exception.tmSnippet | 16 ++ Snippets/Returns.tmSnippet | 16 ++ Snippets/See Also.tmSnippet | 16 ++ Snippets/Yields Block.tmSnippet | 16 ++ Snippets/Yields Parameter.tmSnippet | 16 ++ Syntaxes/YARD.tmLanguage | 235 ++++++++++++---------- 24 files changed, 481 insertions(+), 111 deletions(-) create mode 100644 Preferences/Standalone Name.tmPreferences create mode 100644 Preferences/Swagger kw.tmPreferences create mode 100644 Snippets/@authorize_with.tmSnippet create mode 100644 Snippets/@example.tmSnippet create mode 100644 Snippets/@parameter.tmSnippet create mode 100644 Snippets/@path.tmSnippet create mode 100644 Snippets/@resource.tmSnippet create mode 100644 Snippets/@response.tmSnippet create mode 100644 Snippets/@response_type.tmSnippet create mode 100644 Snippets/@route.tmSnippet create mode 100644 Snippets/Action doc.tmSnippet create mode 100644 Snippets/Alias Of.tmSnippet create mode 100644 Snippets/Available Since.tmSnippet create mode 100644 Snippets/Calls Method.tmSnippet create mode 100644 Snippets/Categories.tmSnippet create mode 100644 Snippets/Parameter.tmSnippet create mode 100644 Snippets/Raises Exception.tmSnippet create mode 100644 Snippets/Returns.tmSnippet create mode 100644 Snippets/See Also.tmSnippet create mode 100644 Snippets/Yields Block.tmSnippet create mode 100644 Snippets/Yields Parameter.tmSnippet diff --git a/Commands/Start Comments.tmCommand b/Commands/Start Comments.tmCommand index f18b2e3..d88fa1d 100644 --- a/Commands/Start Comments.tmCommand +++ b/Commands/Start Comments.tmCommand @@ -1,5 +1,5 @@ - + beforeRunningCommand diff --git a/Preferences/Keyword Tag.tmPreferences b/Preferences/Keyword Tag.tmPreferences index 7a05ed9..36d207a 100644 --- a/Preferences/Keyword Tag.tmPreferences +++ b/Preferences/Keyword Tag.tmPreferences @@ -5,7 +5,7 @@ name Keyword Tag scope - meta.tag.yard keyword.other + meta.tag.yard keyword.other, meta.tag.yard keyword.swagger settings foreground diff --git a/Preferences/Standalone Name.tmPreferences b/Preferences/Standalone Name.tmPreferences new file mode 100644 index 0000000..0297268 --- /dev/null +++ b/Preferences/Standalone Name.tmPreferences @@ -0,0 +1,17 @@ + + + + + name + Standalone Name + scope + meta.tag.yard entity.other.standalone-name.yard + settings + + foreground + #9090FF + + uuid + 96A2688D-B383-4F96-89FD-E33364325503 + + diff --git a/Preferences/Swagger kw.tmPreferences b/Preferences/Swagger kw.tmPreferences new file mode 100644 index 0000000..e8224ab --- /dev/null +++ b/Preferences/Swagger kw.tmPreferences @@ -0,0 +1,17 @@ + + + + + name + Swagger kw + scope + meta.tag.yard.swagger + settings + + background + #ECECFF + + uuid + 5759089C-E7AB-431C-BC7E-CC150E9A8FE5 + + diff --git a/Snippets/@authorize_with.tmSnippet b/Snippets/@authorize_with.tmSnippet new file mode 100644 index 0000000..1a54fcd --- /dev/null +++ b/Snippets/@authorize_with.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + @authorize_with ${1:header_authorization} +# $0 + name + @authorize_with + scope + comment.line.number-sign.ruby + tabTrigger + @auth + uuid + 9A1C7BF4-CFE3-4DEC-8252-E7537BA79779 + + diff --git a/Snippets/@example.tmSnippet b/Snippets/@example.tmSnippet new file mode 100644 index 0000000..c436893 --- /dev/null +++ b/Snippets/@example.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + # @example${1: ${2|name,200,201,301,302,401,404,422|}} +# ${4:{ $5 }}${6: +# ${7|@ro,@p,@para,@resp,@exa|}}$0 + name + @example + scope + comment.line.number-sign.ruby + tabTrigger + # @exa + uuid + C8EBBCA0-68E0-4524-87BB-9342D57448F6 + + diff --git a/Snippets/@parameter.tmSnippet b/Snippets/@parameter.tmSnippet new file mode 100644 index 0000000..6d7034a --- /dev/null +++ b/Snippets/@parameter.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + # @parameter ${1:name}${2:(${3|body,query,path,formData,required,nullable,multiple|})} [${4|integer,boolean,string,object<>,number,date,time,date-time,uuid,enum<>,array<>|}] ${5:description}${6: +# ${7|@ro,@p,@para,@resp,@exa|}}$0 + name + @parameter + scope + comment.line.number-sign.ruby + tabTrigger + # @para + uuid + 8248FC4F-D711-4576-8512-8BE9BD0E1896 + + diff --git a/Snippets/@path.tmSnippet b/Snippets/@path.tmSnippet new file mode 100644 index 0000000..05b075a --- /dev/null +++ b/Snippets/@path.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + # @path [${1|GET,POST,PATCH,PUT,DELETE|}] ${3:/api}${4:/v${5:1}}/${6:path}${7: +# ${8|@ro,@p,@para,@resp,@exa|}}$0 + name + @path + scope + comment.line.number-sign.ruby + tabTrigger + # @p + uuid + 769051AC-23B4-4B7B-AD41-179F307DFF77 + + diff --git a/Snippets/@resource.tmSnippet b/Snippets/@resource.tmSnippet new file mode 100644 index 0000000..15d3f2d --- /dev/null +++ b/Snippets/@resource.tmSnippet @@ -0,0 +1,19 @@ + + + + + content + ## +# @resource ${1:Resource}${2: +# ${3:Resource Title}}${4: +# @auth}$0 + name + @resource + scope + comment.line.number-sign.ruby + tabTrigger + # @res + uuid + 4A4FD985-8D75-48C7-8316-7D20F49E2F85 + + diff --git a/Snippets/@response.tmSnippet b/Snippets/@response.tmSnippet new file mode 100644 index 0000000..a149cd9 --- /dev/null +++ b/Snippets/@response.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + # @response${1: [${2:Model}]}${3: ${4|200,201,301,302,401,404,422|}}${5: +# ${6|@ro,@p,@para,@resp,@exa|}}$0 + name + @response + scope + comment.line.number-sign.ruby + tabTrigger + # @resp + uuid + 9161CF72-009D-4C8C-9AFC-D1E3E4F3BBE6 + + diff --git a/Snippets/@response_type.tmSnippet b/Snippets/@response_type.tmSnippet new file mode 100644 index 0000000..f3411a5 --- /dev/null +++ b/Snippets/@response_type.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + # @response_type [${1|Model,integer,boolean,string,object<>,number,date,time,date-time,uuid,enum<>,array<>|}]${2: +# ${3|@ro,@p,@para,@resp,@exa|}}$0 + name + @response_type + scope + comment.line.number-sign.ruby + tabTrigger + # @resp + uuid + 1D79331F-E6D6-47D2-8ED9-0315D9D8D961 + + diff --git a/Snippets/@route.tmSnippet b/Snippets/@route.tmSnippet new file mode 100644 index 0000000..a6eb2aa --- /dev/null +++ b/Snippets/@route.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + # @route ${1:helper_method}${2: +# ${3|@ro,@p,@para,@resp,@exa|}}$0 + name + @route + scope + comment.line.number-sign.ruby + tabTrigger + # @ro + uuid + 711D911E-80B7-46C6-8DB2-555D7C6FC3DC + + diff --git a/Snippets/Action doc.tmSnippet b/Snippets/Action doc.tmSnippet new file mode 100644 index 0000000..d51c8db --- /dev/null +++ b/Snippets/Action doc.tmSnippet @@ -0,0 +1,20 @@ + + + + + content + ${1:# # ${2:Title} +# +}${3:# ${4:Description} +# +}${5:# ${6|@ro,@p,@para,@resp,@exa|}}$0 + name + Action doc + scope + comment.line.number-sign.ruby + tabTrigger + # # + uuid + F810FEE5-98F6-4953-8DB4-6D4903634FBC + + diff --git a/Snippets/Alias Of.tmSnippet b/Snippets/Alias Of.tmSnippet new file mode 100644 index 0000000..d3a842c --- /dev/null +++ b/Snippets/Alias Of.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @alias + name + Alias Of + scope + comment.line.number-sign.ruby + tabTrigger + alias + uuid + A537FD23-3EFA-48CF-AE22-714C1A134940 + + diff --git a/Snippets/Available Since.tmSnippet b/Snippets/Available Since.tmSnippet new file mode 100644 index 0000000..cf146c0 --- /dev/null +++ b/Snippets/Available Since.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @since ${1:number} + name + Available Since + scope + comment.line.number-sign.ruby + tabTrigger + since + uuid + 312627F9-3C3D-4924-8D9A-64784B5E3842 + + diff --git a/Snippets/Calls Method.tmSnippet b/Snippets/Calls Method.tmSnippet new file mode 100644 index 0000000..57be7d5 --- /dev/null +++ b/Snippets/Calls Method.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @calls + name + Calls Method + scope + comment.line.number-sign.ruby + tabTrigger + calls + uuid + E05CA577-3978-4591-9AE9-B723ACA4EC47 + + diff --git a/Snippets/Categories.tmSnippet b/Snippets/Categories.tmSnippet new file mode 100644 index 0000000..5b01e8e --- /dev/null +++ b/Snippets/Categories.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @category ${0:categories} + name + Categories + scope + comment.line.number-sign.ruby + tabTrigger + cat + uuid + CB762D11-43B1-446A-8548-7A39581A9A89 + + diff --git a/Snippets/Parameter.tmSnippet b/Snippets/Parameter.tmSnippet new file mode 100644 index 0000000..661b941 --- /dev/null +++ b/Snippets/Parameter.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @param [${1:Types}] ${2:Name} ${3:Description} + name + Parameter + scope + comment.line.number-sign.ruby + tabTrigger + param + uuid + BA8B95D4-FB68-4988-840A-D3A23B21C6AD + + diff --git a/Snippets/Raises Exception.tmSnippet b/Snippets/Raises Exception.tmSnippet new file mode 100644 index 0000000..33802d0 --- /dev/null +++ b/Snippets/Raises Exception.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @raise [${1:ExceptionClass}] ${3:Description} + name + Raises Exception + scope + comment.line.number-sign.ruby + tabTrigger + raise + uuid + 444C3FB9-D597-4023-B50A-5ECCDAB75B7C + + diff --git a/Snippets/Returns.tmSnippet b/Snippets/Returns.tmSnippet new file mode 100644 index 0000000..989b94d --- /dev/null +++ b/Snippets/Returns.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @return [${1:Types}] ${2:Description} + name + Returns + scope + comment.line.number-sign.ruby + tabTrigger + return + uuid + 17011F12-BDDB-4FFB-8CDC-CCB5522F1A7C + + diff --git a/Snippets/See Also.tmSnippet b/Snippets/See Also.tmSnippet new file mode 100644 index 0000000..ad97b11 --- /dev/null +++ b/Snippets/See Also.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @see ${1:Name or URL} + name + See Also + scope + comment.line.number-sign.ruby + tabTrigger + see + uuid + E824781F-6806-462D-9051-4A1D3E2A1925 + + diff --git a/Snippets/Yields Block.tmSnippet b/Snippets/Yields Block.tmSnippet new file mode 100644 index 0000000..41e16a4 --- /dev/null +++ b/Snippets/Yields Block.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @yield [${1:parameter names}] ${3:Description} + name + Yields Block + scope + comment.line.number-sign.ruby + tabTrigger + yield + uuid + 821239A6-FD8A-4CC3-BDCD-BAC24AEFECE8 + + diff --git a/Snippets/Yields Parameter.tmSnippet b/Snippets/Yields Parameter.tmSnippet new file mode 100644 index 0000000..d26a377 --- /dev/null +++ b/Snippets/Yields Parameter.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + @yieldparam [${1:Types}] ${2:name} ${3:Description} + name + Yields Parameter + scope + comment.line.number-sign.ruby + tabTrigger + yparam + uuid + 51A5C475-1977-4408-BCAB-7F3BFEA3664F + + diff --git a/Syntaxes/YARD.tmLanguage b/Syntaxes/YARD.tmLanguage index 3202c70..fb6a690 100644 --- a/Syntaxes/YARD.tmLanguage +++ b/Syntaxes/YARD.tmLanguage @@ -12,7 +12,7 @@ begin - (?<=#\s)(@)(?!return|param)([a-z][\w\-]+[a-z])\b(?!\.|\s*(?:\|\|)?=\s*) + (?<=#\s)\s*(@)(?!return|param\b|groups|model|\!model|resource)(!?[a-z][\w\-]+[a-z])\b(?!\.|\s*(?:\|\|)?=\s*) beginCaptures 1 @@ -34,7 +34,7 @@ begin - (?<=\s)(\[) + (?<=\s)\s*(\[) beginCaptures 1 @@ -63,46 +63,20 @@ patterns - match - \b[A-Z]\w+(?:::[A-Z]\w+)*\b - name - keyword.other.directive.class.yard + include + #directive_class - captures - - 1 - - name - punctuation.definition.array.begin.yard - - 2 - - name - keyword.other.directive.class.yard - - 3 - - name - punctuation.definition.array.end.yard - - - match - \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b - name - keyword.other.directive.array.yard + include + #directive_array - match - \b([a-z]\w*)\b - name - entity.other.attribute-name.yard + include + #attr_name - match - ,\s* - name - punctuation.separator.parameters.yard + include + #param_seperator @@ -110,7 +84,7 @@ begin - (?<=#\s)(@)(return)\b(?!\.|\s*=\s*) + (?<=#\s)\s*(@)(return)\b(?!\.|\s*=\s*) beginCaptures 1 @@ -132,10 +106,15 @@ begin - (?<=@return\s)(\[) + (?<=@return\s)\s*(?:\s*([a-z]\w*)\s)?\s*(\[) beginCaptures 1 + + name + entity.other.attribute-name.yard + + 2 name punctuation.definition.parameters.begin.yard @@ -156,40 +135,8 @@ patterns - match - \b[A-Z]\w+(?:::[A-Z]\w+)*\b - name - keyword.other.directive.class.yard - - - captures - - 1 - - name - punctuation.definition.array.begin.yard - - 2 - - name - keyword.other.directive.class.yard - - 3 - - name - punctuation.definition.array.end.yard - - - match - \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b - name - keyword.other.directive.array.yard - - - match - ,\s* - name - punctuation.separator.parameters.yard + include + #array_params @@ -197,7 +144,7 @@ begin - (?<=#\s)(@)(param)\b(?!\.|\s*=\s*) + (?<=#\s)\s*(@)(param)\b(?!\.|\s*=\s*) beginCaptures 1 @@ -219,7 +166,7 @@ begin - (?<=@param\s)(?:\s*([a-z]\w*)\s)?\s*(\[) + (?<=@param\s)\s*(?:\s*([a-z]\w*)\s)?\s*(\[) beginCaptures 1 @@ -248,40 +195,8 @@ patterns - match - \b[A-Z]\w+(?:::[A-Z]\w+)*\b - name - keyword.other.directive.class.yard - - - captures - - 1 - - name - punctuation.definition.array.begin.yard - - 2 - - name - keyword.other.directive.class.yard - - 3 - - name - punctuation.definition.array.end.yard - - - match - \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b - name - keyword.other.directive.array.yard - - - match - ,\s* - name - punctuation.separator.parameters.yard + include + #array_params @@ -302,11 +217,113 @@ match - (?<=#\s)(@)(!deprecated)(?=\n|$) + (?<=#\s)\s*(@)(!deprecated)(?=\n|$) name meta.tag.yard.deprecated + + begin + (?<=#\s)\s*(@)(!?model|resource)\b(?!\.|\s*=\s*) + beginCaptures + + 1 + + name + punctuation.definition.keyword.other.documentation.tag.yard + + 2 + + name + keyword.swagger.documentation.tag.yard + + + end + (?=\n|$) + name + meta.tag.yard.swagger + patterns + + + include + #standalone_name + + + + repository + + array_params + + patterns + + + include + #directive_class + + + include + #directive_array + + + include + #param_seperator + + + + attr_name + + match + \b([a-z]\w*)\b + name + entity.other.attribute-name.yard + + directive_array + + captures + + 1 + + name + punctuation.definition.array.begin.yard + + 2 + + name + keyword.other.directive.class.yard + + 3 + + name + punctuation.definition.array.end.yard + + + match + \bArray(?:(\<)([A-Z]\w+(?:::[A-Z]\w+)*)(\>))?\b + name + keyword.other.directive.array.yard + + directive_class + + match + \b[A-Z]\w+(?:::[A-Z]\w+)*\b + name + keyword.other.directive.class.yard + + param_seperator + + match + ,\s* + name + punctuation.separator.parameters.yard + + standalone_name + + match + \b[A-Z]\w+(?:::[A-Z]\w+)*\b + name + entity.other.standalone-name.yard + + scope source.ruby scopeName