From 815e55c862532c2beb6dbcff1fb9d5e25d1a1ab8 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 16 Dec 2014 01:50:09 -0600 Subject: [PATCH 01/77] Update grammar TODO First example is invalid in 2.0 without whitespace removed, octal matching has been corrected. #ignore --- Syntaxes/Ruby.plist | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 23e1110..0a3fe8e 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -7,7 +7,7 @@ TODO: unresolved issues text: - "p << end + "p <<end print me! end" symptoms: @@ -27,13 +27,6 @@ symtoms: From Programming Ruby p306; should be a non-interpolated heredoc. - text: - "a\332a" - symptoms: - '\332' is not recognized as slash3.. which should be octal 332. - solution: - plain regexp.. should be easy. - text: val?(a):p(b) val?'a':'b' From 880adadd728c6e3ffa452b7130a1fdc7767b2808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Schwaiger?= Date: Sun, 8 Feb 2015 17:18:10 +0100 Subject: [PATCH 02/77] Add keyword `fail` to grammar --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 0a3fe8e..9484cce 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -252,7 +252,7 @@ comment everything being a method but having a special function is a.. match - \b(initialize|new|loop|include|extend|prepend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!]) + \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!]) name keyword.other.special-method.ruby From 993af897c21721b632afbe955d316f95943f0cae Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Sun, 17 May 2015 17:09:23 -0500 Subject: [PATCH 03/77] Use updated documentation command on 10.10 Reversing the method here so this doesn't have to be changed again for 10.11, etc. --- ....9).tmCommand => Lookup in Documentation (Modern).tmCommand} | 2 +- Commands/Lookup in Documentation.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Commands/{Lookup in Documentation (10.9).tmCommand => Lookup in Documentation (Modern).tmCommand} (94%) diff --git a/Commands/Lookup in Documentation (10.9).tmCommand b/Commands/Lookup in Documentation (Modern).tmCommand similarity index 94% rename from Commands/Lookup in Documentation (10.9).tmCommand rename to Commands/Lookup in Documentation (Modern).tmCommand index cc23893..1fa5afa 100644 --- a/Commands/Lookup in Documentation (10.9).tmCommand +++ b/Commands/Lookup in Documentation (Modern).tmCommand @@ -23,7 +23,7 @@ echo "<meta content='0;URL=file://$("${TM_BUNDLE_SUPPORT}/bin/ri_lookup" "${T outputLocation newWindow scope - source.ruby & attr.os-version.10.9 + source.ruby semanticClass lookup.define.ruby uuid diff --git a/Commands/Lookup in Documentation.plist b/Commands/Lookup in Documentation.plist index 5b95a83..96e0952 100644 --- a/Commands/Lookup in Documentation.plist +++ b/Commands/Lookup in Documentation.plist @@ -26,7 +26,7 @@ outputLocation toolTip scope - source.ruby + source.ruby & attr.os-version.10.6, source.ruby & attr.os-version.10.7, source.ruby & attr.os-version.10.8 semanticClass lookup.define.ruby uuid From 944e8deb33bd281477b8b3ba43e5148c9ebb5bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Simo?= Date: Thu, 30 Jul 2015 16:23:03 +0300 Subject: [PATCH 04/77] Toggle Hash Syntax: Support multiple carets This commit makes the "Toggle Ruby Hash 1.8/1.9 Syntax" command to works correctly with discontinuous selections. --- .../Convert Ruby hash to 1_9 syntax.tmCommand | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand index 2ab2652..4b609de 100644 --- a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand +++ b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand @@ -7,10 +7,19 @@ command #!/usr/bin/env ruby18 -print case str = STDIN.read - when /=>/; str.gsub(/:(\w+)[\s]+=>[\s]+/, '\1: ') - when /(\w+):/; str.gsub(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =>\\2") - else; str +def toggle_ruby_hash_syntax(str) + case str + when /\=>/ + str.gsub!(/:(\w+)\s+=>\s+/, '\1: ') + when /(\w+):/ + str.gsub!(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =>\\2") + else + str + end +end + +while str = $stdin.gets + print toggle_ruby_hash_syntax(str) end fallbackInput From 6c5431d25487a31b184df89f097e8cd61c0f5a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Simo?= Date: Thu, 30 Jul 2015 16:13:37 +0300 Subject: [PATCH 05/77] Toggle String/Symbol: Support multiple carets This commit makes the "Toggle String/Symbol" command to works correctly with discontinuous selections. Now it toggles each selected string/symbol. --- Commands/Toggle String:Symbol.tmCommand | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Commands/Toggle String:Symbol.tmCommand b/Commands/Toggle String:Symbol.tmCommand index 0619d80..425aa36 100644 --- a/Commands/Toggle String:Symbol.tmCommand +++ b/Commands/Toggle String:Symbol.tmCommand @@ -9,12 +9,24 @@ command #!/usr/bin/env ruby18 -print case str = STDIN.read - # Handle standard quotes - when /\A["'](\w+)["']\z/ then ":" + $1 - when /\A:(\w+)\z/ then '"' + $1 + '"' - # Default case - else str +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' + +def toggle_string_symbol(str) + case str + # "string" => :symbol + when /("|')(\w+)\1/ + str.gsub!(/("|')(\w+)\1/, ':\2') + # :symbol => "string" + when /:(\w+)/ + str.gsub!(/:(\w+)/, '"\1"') + # initial case (no changes) + else + str + end +end + +while str = $stdin.gets + print toggle_string_symbol(str) end fallbackInput @@ -28,7 +40,7 @@ end output replaceSelectedText scope - source.ruby string.quoted, source.ruby constant.other.symbol.ruby + source.ruby string.quoted, source.ruby constant.other.symbol uuid B297E4B8-A8FF-49CE-B9C4-6D4911724D43 From 6b4061d27486a71ab3a4d7c7f674d081df7ea80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Ahlstr=C3=B6m?= Date: Mon, 23 Sep 2013 14:20:57 -0700 Subject: [PATCH 06/77] Make the Toggle String/Symbol command work on hashkeys --- Commands/Toggle String:Symbol.tmCommand | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands/Toggle String:Symbol.tmCommand b/Commands/Toggle String:Symbol.tmCommand index 425aa36..3e5ca36 100644 --- a/Commands/Toggle String:Symbol.tmCommand +++ b/Commands/Toggle String:Symbol.tmCommand @@ -40,7 +40,7 @@ end output replaceSelectedText scope - source.ruby string.quoted, source.ruby constant.other.symbol + source.ruby string.quoted, source.ruby constant.other.symbol, source.ruby constant.other.symbol.hashkey.ruby uuid B297E4B8-A8FF-49CE-B9C4-6D4911724D43 From 535dd86bf8b8013cd4e60a846f66fac758686b17 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 3 Feb 2014 10:47:49 +0100 Subject: [PATCH 07/77] =?UTF-8?q?Add=20"i=E2=87=A5"=20to=20insert=20inspec?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Snippets/#inspect.tmSnippet | 16 ++++++++++++++++ info.plist | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 Snippets/#inspect.tmSnippet diff --git a/Snippets/#inspect.tmSnippet b/Snippets/#inspect.tmSnippet new file mode 100644 index 0000000..9e21b36 --- /dev/null +++ b/Snippets/#inspect.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + inspect + name + #inspect + scope + source.ruby + tabTrigger + i + uuid + 2BB6D28F-914E-4132-BC53-E43CF5060BFA + + diff --git a/info.plist b/info.plist index c1e7ff3..ace8fee 100644 --- a/info.plist +++ b/info.plist @@ -87,6 +87,8 @@ 0BA2B2F1-E767-4A03-9791-0AC0183251F1 B46D35B8-5DEB-4C10-A110-BA1965A2EB9C 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD + ------------------------------------ + 2BB6D28F-914E-4132-BC53-E43CF5060BFA name Idioms From 2b650de94586c06790fc8c5cca704a7d0062256e Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 3 Feb 2014 10:49:31 +0100 Subject: [PATCH 08/77] Use single quotes on require --- .../require '..' (req).plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename "Snippets/require \"..\" (req).plist" => Snippets/require '..' (req).plist (86%) diff --git "a/Snippets/require \"..\" (req).plist" b/Snippets/require '..' (req).plist similarity index 86% rename from "Snippets/require \"..\" (req).plist" rename to Snippets/require '..' (req).plist index ec8d265..a1919f4 100644 --- "a/Snippets/require \"..\" (req).plist" +++ b/Snippets/require '..' (req).plist @@ -3,9 +3,9 @@ content - require "$0" + require '$0' name - require ".." + require '..' scope source.ruby tabTrigger From 5c9f97436a599f15d52f6f56b1f10393ec74611d Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 10 Feb 2014 16:31:48 +0100 Subject: [PATCH 09/77] Add @ expantion to memoized ivar --- Commands/@variable ||= memoized.tmCommand | 39 +++++++++++++++++++++++ info.plist | 1 + 2 files changed, 40 insertions(+) create mode 100644 Commands/@variable ||= memoized.tmCommand diff --git a/Commands/@variable ||= memoized.tmCommand b/Commands/@variable ||= memoized.tmCommand new file mode 100644 index 0000000..b78ae63 --- /dev/null +++ b/Commands/@variable ||= memoized.tmCommand @@ -0,0 +1,39 @@ + + + + + beforeRunningCommand + nop + command + #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU + +line_number = ENV['TM_LINE_NUMBER'].to_i - 1 +line = STDIN.lines.to_a[line_number-1] + +ivar_name = 'instance_variable' +ivar_name = $1 if line =~ /def (?:self\.)?([a-z\d_]+)/i + +print "@${1:#{ivar_name}} ||= $0" + + input + document + inputFormat + text + name + @variable ||= memoized + outputCaret + afterOutput + outputFormat + snippet + outputLocation + atCaret + scope + source.ruby + tabTrigger + @ + uuid + 20ACDEEE-1F1D-4CFB-8B66-940E902693EF + version + 2 + + diff --git a/info.plist b/info.plist index ace8fee..99f2a31 100644 --- a/info.plist +++ b/info.plist @@ -87,6 +87,7 @@ 0BA2B2F1-E767-4A03-9791-0AC0183251F1 B46D35B8-5DEB-4C10-A110-BA1965A2EB9C 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD + 20ACDEEE-1F1D-4CFB-8B66-940E902693EF ------------------------------------ 2BB6D28F-914E-4132-BC53-E43CF5060BFA From c4e60f5b9b98b971fc9d40971ee98af14301241e Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 21 Jul 2014 00:51:52 +0200 Subject: [PATCH 10/77] =?UTF-8?q?Don=E2=80=99t=20use=20||=3D=20inside=20#i?= =?UTF-8?q?nitialize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Commands/@variable ||= memoized.tmCommand | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Commands/@variable ||= memoized.tmCommand b/Commands/@variable ||= memoized.tmCommand index b78ae63..f7b17cf 100644 --- a/Commands/@variable ||= memoized.tmCommand +++ b/Commands/@variable ||= memoized.tmCommand @@ -8,19 +8,26 @@ #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU line_number = ENV['TM_LINE_NUMBER'].to_i - 1 -line = STDIN.lines.to_a[line_number-1] +# line = STDIN.lines.to_a[line_number-1] +# method_name = $1 if line =~ /def (?:self\.)?([a-z\d_]+)/i -ivar_name = 'instance_variable' -ivar_name = $1 if line =~ /def (?:self\.)?([a-z\d_]+)/i +method_name = nil +lines = STDIN.lines.to_a[0..line_number-1].reverse +line = lines.find {|l| l =~ /\bdef (?:self\.)?([a-zA-Z\d_]+)/} +method_name = $1 if line -print "@${1:#{ivar_name}} ||= $0" +ivar_name = (method_name != 'initialize' && method_name) || 'instance_variable' +assignment = method_name == 'initialize' ? '=' : '${2:||}=' + +print "@${1:#{ivar_name}} #{assignment} " +print '${3:$1}' unless ENV['TM_CURRENT_WORD'] input document inputFormat text name - @variable ||= memoized + @variable outputCaret afterOutput outputFormat From a7cfbc06878ee0c0a7f2b298c808e5c3416aa570 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 21 Jul 2014 00:54:56 +0200 Subject: [PATCH 11/77] Skip multiple extensions in the class name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. an Opal would probably be called my_file.js.rb inside a Rails application. Previously it generated a class named “MyFile.js”. --- Snippets/class .. end (cla).plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snippets/class .. end (cla).plist b/Snippets/class .. end (cla).plist index 8839f4c..566a349 100644 --- a/Snippets/class .. end (cla).plist +++ b/Snippets/class .. end (cla).plist @@ -3,7 +3,7 @@ content - class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.[a-z]+)*/(?2::\u$1)/g}} $0 end name From 0b5c0f398bc3c1b76a96bca3255f4645b25a413d Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 21 Jul 2014 01:05:15 +0200 Subject: [PATCH 12/77] Point to ruby 1.8 shim --- Commands/@variable ||= memoized.tmCommand | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands/@variable ||= memoized.tmCommand b/Commands/@variable ||= memoized.tmCommand index f7b17cf..843f2e3 100644 --- a/Commands/@variable ||= memoized.tmCommand +++ b/Commands/@variable ||= memoized.tmCommand @@ -5,7 +5,7 @@ beforeRunningCommand nop command - #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -wKU + #!/usr/bin/env ruby18 line_number = ENV['TM_LINE_NUMBER'].to_i - 1 # line = STDIN.lines.to_a[line_number-1] From 4551f557d3a757d514da844480e03ef96d1078f0 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Sun, 13 Sep 2015 03:40:10 -0500 Subject: [PATCH 13/77] Improve scoping of class names Match components of the scope individually rather than as a block. Originally noted by @giucal. --- Preferences/Symbol List: Class.tmPreferences | 19 +++++++++++++++++++ Syntaxes/Ruby.plist | 14 +++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 Preferences/Symbol List: Class.tmPreferences diff --git a/Preferences/Symbol List: Class.tmPreferences b/Preferences/Symbol List: Class.tmPreferences new file mode 100644 index 0000000..1d861b9 --- /dev/null +++ b/Preferences/Symbol List: Class.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + Symbol List: Class + scope + meta.class.ruby + settings + + showInSymbolList + + symbolTransformation + s/^\s*class\s+// + + uuid + 64AFA1C0-BDC7-42DE-B3B5-C597538975E9 + + diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 9484cce..9f434e7 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -81,6 +81,11 @@ name entity.name.type.class.ruby + 3 + + name + keyword.operator.other.ruby + 4 name @@ -89,21 +94,16 @@ 5 name - punctuation.separator.inheritance.ruby + keyword.operator.other.ruby 6 name variable.other.object.ruby - 7 - - name - punctuation.definition.variable.ruby - match - ^\s*(class)\s+(([.a-zA-Z0-9_:]+(\s*(<)\s*[.a-zA-Z0-9_:]+)?)|((<<)\s*[.a-zA-Z0-9_:]+)) + ^\s*(class)\s+(?:([.a-zA-Z0-9_:]+)(?:\s*(<)\s*([.a-zA-Z0-9_:]+))?|(<<)\s*([.a-zA-Z0-9_:]+)) name meta.class.ruby From 91879087e11d19321fe9aa66be782effe3ec026e Mon Sep 17 00:00:00 2001 From: Timothy Xu Date: Sun, 29 Mar 2015 17:15:23 +0100 Subject: [PATCH 14/77] Add command to run script in Terminal Executes the current script. Defaults to running in Terminal.app but will use iTerm instead if it is already running. Can also be customized using the `TM_TERMINAL` variable set to `iTerm`. Also respects the `TM_RUBY` variable. --- Commands/Run Script in Terminal.tmCommand | 82 +++++++++++++++++++++++ info.plist | 1 + 2 files changed, 83 insertions(+) create mode 100644 Commands/Run Script in Terminal.tmCommand diff --git a/Commands/Run Script in Terminal.tmCommand b/Commands/Run Script in Terminal.tmCommand new file mode 100644 index 0000000..ce76097 --- /dev/null +++ b/Commands/Run Script in Terminal.tmCommand @@ -0,0 +1,82 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash +[[ -z "$TM_FILEPATH" ]] && TM_TMPFILE=$(mktemp -t rubyInTerm) +: "${TM_FILEPATH:=$TM_TMPFILE}"; cat >"$TM_FILEPATH" + +# run script using either Terminal.app or iTerm.app +# if iTerm is open or if TM_TERMINAL is set to iTerm then use iTerm +# otherwise default to Terminal.app since that is standard. +TP=${TM_TERMINAL:=Terminal} +TPY=${TM_RUBY:=ruby} + +esc () { +STR="$1" ruby18 <<"RUBY" + str = ENV['STR'] + str = str.gsub(/'/, "'\\\\''") + str = str.gsub(/[\\"]/, '\\\\\\0') + print "'#{str}'" +RUBY +} + +iTerm_running () { + ruby <<"RUBY" + all = `ps -U "$USER" -o ucomm` + split = all.split("\n") + if split.find { |cmd| 'iTerm' == cmd.strip } + STDOUT.write 0 + else + STDOUT.write 1 + end +RUBY +} + +if [ "$TP" == iTerm ] || [ $(iTerm_running) == 0 ]; then + osascript <<END + tell application "iTerm" + activate + tell the current terminal + tell (launch session "TextMate") + write text "clear; cd $(esc "${TM_DIRECTORY}"); $(esc "${TPY}") $(esc "${TM_FILEPATH}"); rm -f $(esc "${TM_TMPFILE}")" + end tell + end tell + end tell +END +else + osascript <<- APPLESCRIPT + tell app "Terminal" + launch + activate + do script "clear; cd $(esc "${TM_DIRECTORY}"); $(esc "${TPY}") $(esc "${TM_FILEPATH}"); rm -f $(esc "${TM_TMPFILE}")" + set position of first window to { 100, 100 } + end tell +APPLESCRIPT +fi + + input + document + inputFormat + text + keyEquivalent + ^@R + name + Run in Terminal + outputCaret + afterOutput + outputFormat + text + outputLocation + discard + scope + source.ruby + uuid + 4444CB9A-8345-4116-8349-C359ADDA390C + version + 2 + + diff --git a/info.plist b/info.plist index 99f2a31..98a545e 100644 --- a/info.plist +++ b/info.plist @@ -39,6 +39,7 @@ items 35222962-C50D-4D58-A6AE-71E7AD980BE4 + 4444CB9A-8345-4116-8349-C359ADDA390C 5289EE40-86B8-11D9-A8D4-000A95E13C98 ------------------------------------ D5660BB2-C554-4694-9E0F-F20CDB6B9EA0 From f9c884e3fc709b2499e6f79d3e13adac24d72c26 Mon Sep 17 00:00:00 2001 From: Kai Wood Date: Thu, 19 Feb 2015 11:23:07 +0100 Subject: [PATCH 15/77] Syntax checker now populates the gutter --- Commands/Check ERB Syntax.plist | 19 ++++++++++++++++--- Commands/Check Ruby Syntax.plist | 18 +++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Commands/Check ERB Syntax.plist b/Commands/Check ERB Syntax.plist index bcde7c9..d62d70d 100644 --- a/Commands/Check ERB Syntax.plist +++ b/Commands/Check ERB Syntax.plist @@ -6,11 +6,24 @@ nop command #!/usr/bin/env ruby18 +require "shellwords" require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' + puts "Using " + `"${TM_RUBY:=ruby}" -e'puts "ruby-" + RUBY_VERSION.to_s'`.chomp + " / " + `"${TM_ERB:=erb}" --version 2>&1`.chomp -result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2>&1` -puts result -TextMate.go_to :line => $1 if result =~ /-:(\d+):/ +puts result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2>&1` + +if result =~ /-:(\d+):(.*)/ + TextMate.go_to :line => $1 + `"$TM_MATE" -c warning` + result.each_line do |line| + if line =~ /-:(\d+):(.*)/ + `"$TM_MATE" --set-mark warning:#{Shellwords.escape($2)} --line #{$1}` + end + end +else + `"$TM_MATE" -c warning` +end + input document inputFormat diff --git a/Commands/Check Ruby Syntax.plist b/Commands/Check Ruby Syntax.plist index fa18747..fef49c0 100644 --- a/Commands/Check Ruby Syntax.plist +++ b/Commands/Check Ruby Syntax.plist @@ -6,11 +6,23 @@ nop command #!/usr/bin/env ruby18 +require "shellwords" require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' + puts `"${TM_RUBY:=ruby}" -e'puts "Using ruby-" + RUBY_VERSION.to_s'` -result = `"${TM_RUBY:=ruby}" -wc 2>&1` -puts result -TextMate.go_to :line => $1 if result =~ /-:(\d+):/ +puts result = `"${TM_RUBY:=ruby}" -wc 2>&1` + +if result =~ /-:(\d+):(.*)/ + TextMate.go_to :line => $1 + `"$TM_MATE" -c warning` + result.each_line do |line| + if line =~ /-:(\d+):(.*)/ + `"$TM_MATE" --set-mark warning:#{Shellwords.escape($2)} --line #{$1}` + end + end +else + `"$TM_MATE" -c warning` +end input document From 843e7e5575b656fb819dcf36b8d0be908681819d Mon Sep 17 00:00:00 2001 From: Walter Dolce Date: Sun, 30 Nov 2014 20:00:54 +0000 Subject: [PATCH 16/77] Add Cheffile and Hobofile to recognized file types --- Syntaxes/Ruby.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 9f434e7..9c40f44 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -51,8 +51,10 @@ capfile ru prawn + Cheffile Gemfile Guardfile + Hobofile Vagrantfile Appraisals Rantfile From a6a17019df8899528485e5d500be2dbf94dafc61 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Wed, 16 Sep 2015 03:44:01 -0500 Subject: [PATCH 17/77] Overhaul matching of percent delimited literals This adds new types and improves the scoping to better match the contents, includes several test cases in a new test file. One limitation I am aware of is that `%q foo ` is not recognized as a string when it should be. Allowing whitespace as a delimiter though adds a lot of ambiguity I don't think is worth getting into. Based on patches from @pelargir, @noniq, and @elia, thanks to @elia for testing help. Fixes #41. --- Syntaxes/Ruby.plist | 4252 +++++++++++++++++++++++-------------- Tests/percent_literals.rb | 128 ++ 2 files changed, 2733 insertions(+), 1647 deletions(-) create mode 100644 Tests/percent_literals.rb diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 9c40f44..91bbd89 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -737,205 +737,8 @@ - begin - %x\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - - begin - %x\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - - begin - %x\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - - begin - %x\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - - begin - %x([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - + include + #percent_literals begin @@ -1002,583 +805,722 @@ - begin - %r\{ - beginCaptures + captures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.definition.constant.ruby comment - regular expressions (literal) - end - \}[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + symbols + match + (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - + constant.other.symbol.ruby begin - %r\[ - beginCaptures + ^=begin + captures 0 name - punctuation.definition.string.begin.ruby + punctuation.definition.comment.ruby comment - regular expressions (literal) + multiline comments end - \][eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + ^=end name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - + comment.block.documentation.ruby begin - %r\( + (^[ \t]+)?(?=#) beginCaptures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.whitespace.comment.leading.ruby - comment - regular expressions (literal) end - \)[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby + (?!\G) patterns - include - #regex_sub - - - include - #nest_parens_r + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.ruby + + + end + \n + name + comment.line.number-sign.ruby + + comment + + matches questionmark-letters. + + examples (1st alternation = hex): + ?\x1 ?\x61 + + examples (2nd alternation = octal): + ?\0 ?\07 ?\017 + + examples (3rd alternation = escaped): + ?\n ?\b + + examples (4th alternation = meta-ctrl): + ?\C-a ?\M-a ?\C-\M-\C-\M-a + + examples (4th alternation = normal): + ?a ?A ?0 + ?* ?" ?( + ?. ?# + + + the negative lookbehind prevents against matching + p(42.tainted?) + + match + (?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\]) + name + constant.numeric.ruby + begin - %r\< - beginCaptures + ^__END__\n + captures 0 name - punctuation.definition.string.begin.ruby + string.unquoted.program-block.ruby comment - regular expressions (literal) + __END__ marker + contentName + text.plain end - \>[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby + (?=not)impossible patterns - include - #regex_sub - - - include - #nest_ltgt_r + begin + (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) + end + (?=not)impossible + name + text.html.embedded.ruby + patterns + + + include + text.html.basic + + begin - %r([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)HTML)\b\1)) comment - regular expressions (literal) + Heredoc with embedded html end - \1[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.regexp.mod-r.ruby + meta.embedded.block.html patterns - include - #regex_sub + begin + (?><<-("?)((?:[_\w]+_|)HTML)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + text.html + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + text.html.basic + + + include + #escaped_char + + begin - %[QWSR]?\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)SQL)\b\1)) comment - literal capable of interpolation () + Heredoc with embedded sql end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.sql patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i + begin + (?><<-("?)((?:[_\w]+_|)SQL)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.sql + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.sql + + + include + #escaped_char + + begin - %[QWSR]?\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)CSS)\b\1)) comment - literal capable of interpolation [] + Heredoc with embedded css end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.css patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - - begin - %[QWSR]?\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation <> - end - \> - endCaptures - - 0 - + begin + (?><<-("?)((?:[_\w]+_|)CSS)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.css + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.upper.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.css + + + include + #escaped_char + + begin - %[QWSR]?\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)CPP)\b\1)) comment - literal capable of interpolation -- {} + Heredoc with embedded c++ end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.double.ruby.mod + meta.embedded.block.c++ patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i + begin + (?><<-("?)((?:[_\w]+_|)CPP)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.c++ + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.c++ + + + include + #escaped_char + + begin - %[QWSR]([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)C)\b\1)) comment - literal capable of interpolation -- wildcard + Heredoc with embedded c end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.c patterns - include - #interpolated_ruby - - - include - #escaped_char + begin + (?><<-("?)((?:[_\w]+_|)C)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.c + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.c + + + include + #escaped_char + + begin - %([^\w\s=]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) comment - literal capable of interpolation -- wildcard + Heredoc with embedded javascript end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.other.ruby + meta.embedded.block.js patterns - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - %[qws]\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- () - end - \) - endCaptures - - 0 - + begin + (?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.js + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - punctuation.definition.string.end.ruby + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.js + + + include + #escaped_char + + - + + + + begin + (?=(?><<-("?)((?:[_\w]+_|)JQUERY)\b\1)) + comment + Heredoc with embedded jQuery javascript + end + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.js.jquery patterns - match - \\\)|\\\\ + begin + (?><<-("?)((?:[_\w]+_|)JQUERY)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.js.jquery + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_parens + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.js.jquery + + + include + #escaped_char + + begin - %[qws]\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) comment - literal incapable of interpolation -- <> + Heredoc with embedded shell end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.shell patterns - match - \\\>|\\\\ + begin + (?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.shell + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_ltgt + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.shell + + + include + #escaped_char + + begin - %[qws]\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)LUA)\b\1)) comment - literal incapable of interpolation -- [] + Heredoc with embedded lua end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.lua patterns - match - \\\]|\\\\ + begin + (?><<-("?)((?:[_\w]+_|)LUA)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.lua + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_brackets + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.lua + + + include + #escaped_char + + begin - %[qws]\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<-("?)((?:[_\w]+_|)RUBY)\b\1)) comment - literal incapable of interpolation -- {} + Heredoc with embedded ruby end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.ruby patterns - match - \\\}|\\\\ + begin + (?><<-("?)((?:[_\w]+_|)RUBY)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.ruby + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_curly + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.ruby + + + include + #escaped_char + + begin - %[qws]([\W_]) + (?>\=\s*<<(\w+)) beginCaptures 0 @@ -1587,10 +1529,8 @@ punctuation.definition.string.begin.ruby - comment - literal incapable of interpolation -- wildcard end - \1 + ^\1$ endCaptures 0 @@ -1600,513 +1540,909 @@ name - string.quoted.other.literal.lower.ruby + string.unquoted.heredoc.ruby patterns - comment - Cant be named because its not neccesarily an escape. - match - \\. + include + #heredoc - - - - captures - - 1 - name - punctuation.definition.constant.ruby + include + #interpolated_ruby - - comment - symbols - match - (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) - name - constant.other.symbol.ruby + + include + #escaped_char + + begin - ^=begin - captures + (?><<-(\w+)) + beginCaptures 0 name - punctuation.definition.comment.ruby + punctuation.definition.string.begin.ruby comment - multiline comments + heredoc with indented terminator end - ^=end - name - comment.block.documentation.ruby - - - begin - (^[ \t]+)?(?=#) - beginCaptures + \s*\1$ + endCaptures - 1 + 0 name - punctuation.whitespace.comment.leading.ruby + punctuation.definition.string.end.ruby - end - (?!\G) + name + string.unquoted.heredoc.ruby patterns - begin - # - beginCaptures - - 0 - - name - punctuation.definition.comment.ruby - - - end - \n - name - comment.line.number-sign.ruby + include + #heredoc + + + include + #interpolated_ruby + + + include + #escaped_char - - comment - - matches questionmark-letters. - - examples (1st alternation = hex): - ?\x1 ?\x61 - - examples (2nd alternation = octal): - ?\0 ?\07 ?\017 - - examples (3rd alternation = escaped): - ?\n ?\b - - examples (4th alternation = meta-ctrl): - ?\C-a ?\M-a ?\C-\M-\C-\M-a - - examples (4th alternation = normal): - ?a ?A ?0 - ?* ?" ?( - ?. ?# - - - the negative lookbehind prevents against matching - p(42.tainted?) - - match - (?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\]) - name - constant.numeric.ruby - begin - ^__END__\n + (?<=\{|do|\{\s|do\s)(\|) captures - 0 + 1 name - string.unquoted.program-block.ruby + punctuation.separator.variable.ruby - comment - __END__ marker - contentName - text.plain end - (?=not)impossible + (\|) patterns - begin - (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) - end - (?=not)impossible + match + [_a-zA-Z][_a-zA-Z0-9]* name - text.html.embedded.ruby - patterns - - - include - text.html.basic - - + variable.other.block.ruby - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)HTML)\b\1)) - comment - Heredoc with embedded html - end - (?!\G) - name - meta.embedded.block.html - patterns - - begin - (?><<-("?)((?:[_\w]+_|)HTML)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - contentName - text.html - end - \s*\2$\n? - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + match + , name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - text.html.basic - - - include - #escaped_char - - + punctuation.separator.variable.ruby - begin - (?=(?><<-("?)((?:[_\w]+_|)SQL)\b\1)) - comment - Heredoc with embedded sql - end - (?!\G) + match + => name - meta.embedded.block.sql + punctuation.separator.key-value + + + match + <<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< + name + keyword.operator.assignment.augmented.ruby + + + match + <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? + name + keyword.operator.comparison.ruby + + + match + (?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^ + name + keyword.operator.logical.ruby + + + match + (%|&|\*\*|\*|\+|\-|/) + name + keyword.operator.arithmetic.ruby + + + match + = + name + keyword.operator.assignment.ruby + + + match + \||~|>> + name + keyword.operator.other.ruby + + + match + : + name + punctuation.separator.other.ruby + + + match + \; + name + punctuation.separator.statement.ruby + + + match + , + name + punctuation.separator.object.ruby + + + match + \.|:: + name + punctuation.separator.method.ruby + + + match + \{ + name + punctuation.section.scope.begin.ruby + + + match + \} + name + punctuation.section.scope.end.ruby + + + match + \[ + name + punctuation.section.array.begin.ruby + + + match + \] + name + punctuation.section.array.end.ruby + + + match + \(|\) + name + punctuation.section.function.ruby + + + repository + + escaped_char + + match + \\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.) + name + constant.character.escape.ruby + + heredoc + + begin + ^<<-?\w+ + end + $ + patterns + + + include + $self + + + + interpolated_ruby + patterns begin - (?><<-("?)((?:[_\w]+_|)SQL)\b\1) + #\{ beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.section.embedded.begin.ruby contentName - source.sql + source.ruby end - \s*\2$\n? + (\}) endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.section.embedded.end.ruby + + 1 + + name + source.ruby name - string.unquoted.heredoc.ruby + meta.embedded.line.ruby patterns include - #heredoc - - - include - #interpolated_ruby + #nest_curly_and_self include - source.sql + $self + + repository + + nest_curly_and_self - include - #escaped_char + patterns + + + begin + \{ + captures + + 0 + + name + punctuation.section.scope.ruby + + + end + \} + patterns + + + include + #nest_curly_and_self + + + + + include + $self + + - + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)CSS)\b\1)) - comment - Heredoc with embedded css - end - (?!\G) - name - meta.embedded.block.css - patterns - - begin - (?><<-("?)((?:[_\w]+_|)CSS)\b\1) - beginCaptures + captures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.definition.variable.ruby - contentName - source.css - end - \s*\2$\n? - endCaptures + match + (#@)[a-zA-Z_]\w* + name + variable.other.readwrite.instance.ruby + + + captures - 0 + 1 name - punctuation.definition.string.end.ruby + punctuation.definition.variable.ruby + match + (#@@)[a-zA-Z_]\w* name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.css - + variable.other.readwrite.class.ruby + + + captures + + 1 - include - #escaped_char + name + punctuation.definition.variable.ruby - + + match + (#\$)[a-zA-Z_]\w* + name + variable.other.readwrite.global.ruby + percent_literals - begin - (?=(?><<-("?)((?:[_\w]+_|)CPP)\b\1)) - comment - Heredoc with embedded c++ - end - (?!\G) - name - meta.embedded.block.c++ patterns begin - (?><<-("?)((?:[_\w]+_|)CPP)\b\1) + %i(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.section.array.begin.ruby - contentName - source.c++ end - \s*\2$\n? + [)\]}>]|\1\2 endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.section.array.end.ruby name - string.unquoted.heredoc.ruby + meta.array.symbol.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #symbol + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #symbol + + - include - source.c++ - + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #symbol + + + - include - #escaped_char + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #symbol + + - - - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)C)\b\1)) - comment - Heredoc with embedded c - end - (?!\G) - name - meta.embedded.block.c - patterns - - - begin - (?><<-("?)((?:[_\w]+_|)C)\b\1) - beginCaptures - - 0 - name - punctuation.definition.string.begin.ruby + include + #symbol - - contentName - source.c - end - \s*\2$\n? - endCaptures + + repository - 0 + angles - name - punctuation.definition.string.end.ruby + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\<|\\> + name + constant.other.symbol.ruby + + + begin + < + captures + + 0 + + name + constant.other.symbol.ruby + + + end + > + patterns + + + include + #angles + + + include + #symbol + + + + - - name - string.unquoted.heredoc.ruby - patterns - + braces - include - #heredoc + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\{|\\\} + name + constant.other.symbol.ruby + + + begin + \{ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \} + patterns + + + include + #braces + + + include + #symbol + + + + + brackets - include - #interpolated_ruby + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\[|\\\] + name + constant.other.symbol.ruby + + + begin + \[ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #symbol + + + + + parens - include - source.c + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\(|\\\) + name + constant.other.symbol.ruby + + + begin + \( + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \) + patterns + + + include + #parens + + + include + #symbol + + + + + symbol - include - #escaped_char + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\\|\\[ ] + name + constant.other.symbol.ruby + + + match + \S\w* + name + constant.other.symbol.ruby + + - + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) - comment - Heredoc with embedded javascript - end - (?!\G) - name - meta.embedded.block.js - patterns - begin - (?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) + %I(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.section.array.begin.ruby - contentName - source.js end - \s*\2$\n? + [)\]}>]|\1\2 endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.section.array.end.ruby name - string.unquoted.heredoc.ruby + meta.array.symbol.interpolated.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #symbol + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #symbol + + - include - source.js + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #symbol + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #symbol + + include - #escaped_char + #symbol + repository + + angles + + patterns + + + begin + < + captures + + 0 + + name + constant.other.symbol.ruby + + + end + > + patterns + + + include + #angles + + + include + #symbol + + + + + + braces + + patterns + + + begin + \{ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \} + patterns + + + include + #braces + + + include + #symbol + + + + + + brackets + + patterns + + + begin + \[ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #symbol + + + + + + parens + + patterns + + + begin + \( + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \) + patterns + + + include + #parens + + + include + #symbol + + + + + + symbol + + patterns + + + begin + (?=\\|#\{) + end + (?!\G) + name + constant.other.symbol.ruby + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + + + match + \S\w* + name + constant.other.symbol.ruby + + + + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)JQUERY)\b\1)) - comment - Heredoc with embedded jQuery javascript - end - (?!\G) - name - meta.embedded.block.js.jquery - patterns - begin - (?><<-("?)((?:[_\w]+_|)JQUERY)\b\1) + %q(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 @@ -2115,10 +2451,8 @@ punctuation.definition.string.begin.ruby - contentName - source.js.jquery end - \s*\2$\n? + [)\]}>]|\1\2 endCaptures 0 @@ -2128,43 +2462,169 @@ name - string.unquoted.heredoc.ruby + string.quoted.other.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + - include - source.js.jquery + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + - include - #escaped_char + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + repository + + angles + + patterns + + + match + \\<|\\>|\\\\ + name + constant.character.escape.ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + match + \\\{|\\\}|\\\\ + name + constant.character.escape.ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + match + \\\[|\\\]|\\\\ + name + constant.character.escape.ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + match + \\\(|\\\)|\\\\ + name + constant.character.escape.ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) - comment - Heredoc with embedded shell - end - (?!\G) - name - meta.embedded.block.shell - patterns - begin - (?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) + %Q?(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 @@ -2173,10 +2633,8 @@ punctuation.definition.string.begin.ruby - contentName - source.shell end - \s*\2$\n? + [)\]}>]|\1\2 endCaptures 0 @@ -2186,43 +2644,185 @@ name - string.unquoted.heredoc.ruby + string.quoted.other.interpolated.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + - include - source.shell + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + include #escaped_char - + + include + #interpolated_ruby + + + repository + + angles + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)LUA)\b\1)) - comment - Heredoc with embedded lua - end - (?!\G) - name - meta.embedded.block.lua - patterns - begin - (?><<-("?)((?:[_\w]+_|)LUA)\b\1) + %r(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 @@ -2231,10 +2831,8 @@ punctuation.definition.string.begin.ruby - contentName - source.lua end - \s*\2$\n? + ([)\]}>]|\1\2)[eimnosux]* endCaptures 0 @@ -2244,746 +2842,1106 @@ name - string.unquoted.heredoc.ruby + string.regexp.percent.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + - include - source.lua + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + include - #escaped_char + #regex_sub + repository + + angles + + patterns + + + include + #regex_sub + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #regex_sub + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #regex_sub + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #regex_sub + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)RUBY)\b\1)) - comment - Heredoc with embedded ruby - end - (?!\G) - name - meta.embedded.block.ruby - patterns - begin - (?><<-("?)((?:[_\w]+_|)RUBY)\b\1) + %s(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.definition.constant.begin.ruby - contentName - source.ruby end - \s*\2$\n? + [)\]}>]|\1\2 endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.definition.constant.end.ruby name - string.unquoted.heredoc.ruby + constant.other.symbol.percent.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + - include - source.ruby + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + - include - #escaped_char + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + repository + + angles + + patterns + + + match + \\<|\\>|\\\\ + name + constant.character.escape.ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + match + \\\{|\\\}|\\\\ + name + constant.character.escape.ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + match + \\\[|\\\]|\\\\ + name + constant.character.escape.ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + match + \\\(|\\\)|\\\\ + name + constant.character.escape.ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - - begin - (?>\=\s*<<(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - end - ^\1$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with indented terminator - end - \s*\1$ - endCaptures - - 0 + begin + %w(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.section.array.begin.ruby + + + end + [)\]}>]|\1\2 + endCaptures + + 0 + + name + punctuation.section.array.end.ruby + + name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?<=\{|do|\{\s|do\s)(\|) - captures - - 1 - - name - punctuation.separator.variable.ruby - - - end - (\|) - patterns - - - match - [_a-zA-Z][_a-zA-Z0-9]* - name - variable.other.block.ruby - - - match - , - name - punctuation.separator.variable.ruby - - - - - match - => - name - punctuation.separator.key-value - - - match - <<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< - name - keyword.operator.assignment.augmented.ruby - - - match - <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? - name - keyword.operator.comparison.ruby - - - match - (?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^ - name - keyword.operator.logical.ruby - - - match - (%|&|\*\*|\*|\+|\-|/) - name - keyword.operator.arithmetic.ruby - - - match - = - name - keyword.operator.assignment.ruby - - - match - \||~|>> - name - keyword.operator.other.ruby - - - match - : - name - punctuation.separator.other.ruby - - - match - \; - name - punctuation.separator.statement.ruby - - - match - , - name - punctuation.separator.object.ruby - - - match - \.|:: - name - punctuation.separator.method.ruby - - - match - \{ - name - punctuation.section.scope.begin.ruby - - - match - \} - name - punctuation.section.scope.end.ruby - - - match - \[ - name - punctuation.section.array.begin.ruby - - - match - \] - name - punctuation.section.array.end.ruby - - - match - \(|\) - name - punctuation.section.function.ruby - - - repository - - escaped_char - - match - \\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.) - name - constant.character.escape.ruby - - heredoc - - begin - ^<<-?\w+ - end - $ - patterns - - - include - $self + meta.array.string.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #string + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #string + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #string + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #string + + + + + include + #string + + + repository + + angles + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\<|\\> + name + string.other.ruby + + + begin + < + captures + + 0 + + name + string.other.ruby + + + end + > + patterns + + + include + #angles + + + include + #string + + + + + + braces + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\{|\\\} + name + string.other.ruby + + + begin + \{ + captures + + 0 + + name + string.other.ruby + + + end + \} + patterns + + + include + #braces + + + include + #string + + + + + + brackets + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\[|\\\] + name + string.other.ruby + + + begin + \[ + captures + + 0 + + name + string.other.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #string + + + + + + parens + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\(|\\\) + name + string.other.ruby + + + begin + \( + captures + + 0 + + name + string.other.ruby + + + end + \) + patterns + + + include + #parens + + + include + #string + + + + + + string + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\\|\\[ ] + name + string.other.ruby + + + match + \S\w* + name + string.other.ruby + + + + - - - interpolated_ruby - - patterns - begin - #\{ + %W(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 name - punctuation.section.embedded.begin.ruby + punctuation.section.array.begin.ruby - contentName - source.ruby end - (\}) + [)\]}>]|\1\2 endCaptures 0 name - punctuation.section.embedded.end.ruby - - 1 - - name - source.ruby + punctuation.section.array.end.ruby name - meta.embedded.line.ruby + meta.array.string.interpolated.ruby patterns - include - #nest_curly_and_self + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #string + + - include - $self + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #string + + - - - - captures - - 1 - name - punctuation.definition.variable.ruby + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #string + + - - match - (#@)[a-zA-Z_]\w* - name - variable.other.readwrite.instance.ruby - - - captures + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #string + + + + + include + #string + + + repository - 1 + angles - name - punctuation.definition.variable.ruby + patterns + + + begin + < + captures + + 0 + + name + string.other.ruby + + + end + > + patterns + + + include + #angles + + + include + #string + + + + + + braces + + patterns + + + begin + \{ + captures + + 0 + + name + string.other.ruby + + + end + \} + patterns + + + include + #braces + + + include + #string + + + + + + brackets + + patterns + + + begin + \[ + captures + + 0 + + name + string.other.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #string + + + + + + parens + + patterns + + + begin + \( + captures + + 0 + + name + string.other.ruby + + + end + \) + patterns + + + include + #parens + + + include + #string + + + + + + string + + patterns + + + begin + (?=\\|#\{) + end + (?!\G) + name + string.other.ruby + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + + + match + \S\w* + name + string.other.ruby + + - match - (#@@)[a-zA-Z_]\w* - name - variable.other.readwrite.class.ruby - captures + begin + %x(?:([(\[{<])|([^\w\s]|_)) + beginCaptures - 1 + 0 name - punctuation.definition.variable.ruby + punctuation.definition.string.begin.ruby - match - (#\$)[a-zA-Z_]\w* - name - variable.other.readwrite.global.ruby - - - - nest_brackets - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #nest_brackets - - - - nest_brackets_i - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - nest_brackets_r - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - - - nest_curly - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #nest_curly - - - - nest_curly_and_self - - patterns - - - begin - \{ - captures + end + [)\]}>]|\1\2 + endCaptures 0 name - punctuation.section.scope.ruby + punctuation.definition.string.end.ruby - end - \} + name + string.interpolated.percent.ruby patterns + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include - #nest_curly_and_self + #escaped_char + + + include + #interpolated_ruby - - - include - $self - - - - nest_curly_i - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - nest_curly_r - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - - - nest_ltgt - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #nest_ltgt - - - - nest_ltgt_i - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - nest_ltgt_r - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #regex_sub - - - include - #nest_ltgt_r - - - - nest_parens - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #nest_parens - - - - nest_parens_i - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - nest_parens_r - - begin - \( - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #regex_sub - - - include - #nest_parens_r + repository + + angles + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + diff --git a/Tests/percent_literals.rb b/Tests/percent_literals.rb new file mode 100644 index 0000000..2934093 --- /dev/null +++ b/Tests/percent_literals.rb @@ -0,0 +1,128 @@ +# Default – Interpolated +%(The quick #{color} fox jumps over the #{temperment} dog) +%[The quick #{color} fox jumps over the #{temperment} dog] +%{The quick #{color} fox jumps over the #{temperment} dog} +% +%:The quick #{color} fox jumps over the #{temperment} dog: + +%(The quick #{color} fox (jumps over the #{temperment} dog)) +%[The quick #{color} fox [jumps over the #{temperment} dog]] +%{The quick #{color} fox {jumps over the #{temperment} dog}} +%> + + +# Non-interpolated +%q(The quick brown fox jumps over the lazy dog) +%q[The quick brown fox jumps over the lazy dog] +%q{The quick brown fox jumps over the lazy dog} +%q +%q:The quick brown fox jumps over the lazy dog: + +%q(The quick brown fox (jumps over the lazy dog)) +%q[The quick brown fox [jumps over the lazy dog]] +%q{The quick brown fox {jumps over the lazy dog}} +%q> + + +# Interpolated +%Q(The quick #{color} fox\njumps over the #{temperment} dog) +%Q[The quick #{color} fox\njumps over the #{temperment} dog] +%Q{The quick #{color} fox\njumps over the #{temperment} dog} +%Q +%Q:The quick #{color} fox\njumps over the #{temperment} dog: + +%Q(The quick #{color} fox\n(jumps over the #{temperment} dog)) +%Q[The quick #{color} fox\n[jumps over the #{temperment} dog]] +%Q{The quick #{color} fox\n{jumps over the #{temperment} dog}} +%Q> + + +# Regular expression +%r(The quick brown fox jumps over the lazy dog)i +%r[The quick brown fox jumps over the lazy dog]i +%r{The quick brown fox jumps over the lazy dog}i +%ri +%r:The quick brown fox jumps over the lazy dog:i + +%r(The quick #{color} fox (jumps over the lazy dog))i +%r[The quick #{color} fox [jumps over the lazy dog]]i +%r{The quick #{color} fox {jumps over the lazy dog}}i +%r>i + + +# Symbol Array – Non-interpolated +%i(afgan akita azawakh) +%i[afgan akita azawakh] +%i{afgan akita azawakh} +%i +%i:afgan akita azawakh: + +%i(afgan akita (azawakh)) # Symbol should include the punctuation +%i[afgan akita [ azawakh]] # [ Should be it's own separate symbol +%i{afgan akita {azawakh}} +%i> # \< Should be included in symbol and escaped + + +# Symbol Array – Interpolated +%I(afgan akita #{breed}) +%I[afgan akita #{breed}] +%I{afgan akita #{breed}} +%I +%I:afgan akita #{breed}: + +%I(afgan akita (#{breed})) +%I[afgan akita [#{breed}]] +%I{afgan akita {#{breed}}} +%I> + + +# Array – Non-interpolated +%w(cheetah leopard mountain\ lion) # mountain lion should be a single string +%w[cheetah leopard mountain\ lion] +%w{cheetah leopard mountain\ lion} +%w +%w:cheetah leopard mountain\ lion: + +%w(cheetah leopard (mountain\ lion)) +%w[cheetah leopard [mountain\ lion]] +%w{cheetah leopard {mountain\ lion}} +%w> + + +# Array – Interpolated +%W(cheetah leopard #{codename}) +%W[cheetah leopard #{codename}] +%W{cheetah leopard #{codename}} +%W +%W:cheetah leopard #{codename}: + +%W(cheetah leopard (#{codename})) +%W[cheetah leopard [#{codename}]] +%W{cheetah leopard {#{codename}}} +%W> + + +# Shell Command – Interpolated +%x(mate Bundles/#{name}.tmbundle) +%x[mate Bundles/#{name}.tmbundle] +%x{mate Bundles/#{name}.tmbundle} +%x +%x:mate Bundles/#{name}.tmbundle: + +%x(mate Bundles/(ruby).tmbundle) +%x[mate Bundles/[ruby].tmbundle] +%x{mate Bundles/{ruby}.tmbundle} +%x.tmbundle> + + +# Symbol – Non-interpolated +%s(avian) +%s[avian] +%s{avian} +%s +%s:avian: + +%s(text(mate)) +%s[text[mate]] +%s{text{mate}} +%s> From ada19a2398dd4193899121df720163abb6a35846 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Fri, 18 Sep 2015 20:12:36 -0500 Subject: [PATCH 18/77] Improve scoping of regular expression components This better lines up with the scopes given in other languages to these items. --- Syntaxes/Ruby.plist | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 91bbd89..6c2ef22 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -3963,34 +3963,42 @@ 1 name - punctuation.definition.arbitrary-repitition.ruby + punctuation.definition.quantifier.begin.ruby 3 name - punctuation.definition.arbitrary-repitition.ruby + punctuation.definition.quantifier.end.ruby match (\{)\d+(,\d+)?(\}) name - string.regexp.arbitrary-repitition.ruby + keyword.operator.quantifier.ruby begin \[(?:\^?\])? - captures + beginCaptures 0 name - punctuation.definition.character-class.ruby + punctuation.definition.character-class.begin.ruby end \] + endCaptures + + 0 + + name + punctuation.definition.character-class.end.ruby + + name - string.regexp.character-class.ruby + constant.other.character-class.set.ruby patterns @@ -4044,7 +4052,7 @@ end \) name - string.regexp.group.ruby + meta.group.regexp.ruby patterns @@ -4068,14 +4076,6 @@ We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags. end $\n? - endCaptures - - 0 - - name - punctuation.definition.comment.ruby - - name comment.line.number-sign.ruby From e053c505c21e8375b4efae820ee653f8ffb93f8a Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Sat, 19 Sep 2015 01:10:42 -0500 Subject: [PATCH 19/77] Embedded code snippet (#{}) functions in percent literals Only in the ones that allow interpolation of course. --- Snippets/embed string variable.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Snippets/embed string variable.plist b/Snippets/embed string variable.plist index 8fcbf79..eb73794 100644 --- a/Snippets/embed string variable.plist +++ b/Snippets/embed string variable.plist @@ -9,7 +9,7 @@ name Embedded Code — #{…} scope - B:(string.quoted.double.ruby|string.interpolated.ruby) - string source + source.ruby & B:(string.quoted.double|string.interpolated|meta.array.symbol.interpolated|string.quoted.other.interpolated|meta.array.string.interpolated) - string source uuid EEE6D060-C5A0-400D-A2E0-0835013C5365 From 97608b6d706b16073e5d5e3963aa431b4acda205 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Mon, 26 Oct 2015 06:20:46 -0500 Subject: [PATCH 20/77] Match argument names on the second line of definition An error in the previous regular expression was preventing the first argument of successive lines of a definition from being matched unless they were at the very beginning of the line. Fixed by strictly matching the beginning of the argument. Fixes #87 as first mentioned in github/linguist#2692. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 6c2ef22..7694af1 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -418,7 +418,7 @@ begin - (?![\s,)]) + (?=[&*_a-zA-Z]) end (?=[,)]) patterns From cc447f03a021183f8e2f950f9f0940c445726981 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 25 Dec 2015 16:33:14 +0100 Subject: [PATCH 21/77] Add puppetfile and fix definition of capfile puppetfile should be supported as custom type capfile should be uppercase as capistrano auto-generates a file called "Capfile" and not "capfile" which causes mismatches --- Syntaxes/Ruby.plist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 7694af1..710f21f 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -48,7 +48,7 @@ fcgi gemspec irbrc - capfile + Capfile ru prawn Cheffile @@ -61,6 +61,7 @@ Berksfile Berksfile.lock Thorfile + Puppetfile firstLineMatch ^#!/.*\bruby From 0bf80a366f8882fde0b64e52c2426eba8d95ce93 Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Tue, 19 Jan 2016 13:17:31 +0100 Subject: [PATCH 22/77] Support old-style hashes without spaces before/after `=>` The spaces are optional (for example, `pp` generates hashes without spaces around `=>`). --- Commands/Convert Ruby hash to 1_9 syntax.tmCommand | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand index 4b609de..2d9310f 100644 --- a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand +++ b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand @@ -10,7 +10,7 @@ def toggle_ruby_hash_syntax(str) case str when /\=>/ - str.gsub!(/:(\w+)\s+=>\s+/, '\1: ') + str.gsub!(/:(\w+)\s*=>\s*/, '\1: ') when /(\w+):/ str.gsub!(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =>\\2") else From 3e88a971ac61bec17982e5dba8e3a164ed09a4de Mon Sep 17 00:00:00 2001 From: Oleg Date: Sat, 20 Feb 2016 18:15:52 -0500 Subject: [PATCH 23/77] Add support for <<~ heredocs Fixes #91 --- Syntaxes/Ruby.plist | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 710f21f..05c2c40 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -941,7 +941,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)HTML)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)HTML)\b\1)) comment Heredoc with embedded html end @@ -952,7 +952,7 @@ begin - (?><<-("?)((?:[_\w]+_|)HTML)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)HTML)\b\1) beginCaptures 0 @@ -999,7 +999,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)SQL)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)SQL)\b\1)) comment Heredoc with embedded sql end @@ -1010,7 +1010,7 @@ begin - (?><<-("?)((?:[_\w]+_|)SQL)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)SQL)\b\1) beginCaptures 0 @@ -1057,7 +1057,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)CSS)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)CSS)\b\1)) comment Heredoc with embedded css end @@ -1068,7 +1068,7 @@ begin - (?><<-("?)((?:[_\w]+_|)CSS)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)CSS)\b\1) beginCaptures 0 @@ -1115,7 +1115,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)CPP)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)CPP)\b\1)) comment Heredoc with embedded c++ end @@ -1126,7 +1126,7 @@ begin - (?><<-("?)((?:[_\w]+_|)CPP)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)CPP)\b\1) beginCaptures 0 @@ -1173,7 +1173,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)C)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)C)\b\1)) comment Heredoc with embedded c end @@ -1184,7 +1184,7 @@ begin - (?><<-("?)((?:[_\w]+_|)C)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)C)\b\1) beginCaptures 0 @@ -1231,7 +1231,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) comment Heredoc with embedded javascript end @@ -1242,7 +1242,7 @@ begin - (?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) + (?><<[-~]("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) beginCaptures 0 @@ -1289,7 +1289,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)JQUERY)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)JQUERY)\b\1)) comment Heredoc with embedded jQuery javascript end @@ -1300,7 +1300,7 @@ begin - (?><<-("?)((?:[_\w]+_|)JQUERY)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)JQUERY)\b\1) beginCaptures 0 @@ -1347,7 +1347,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) comment Heredoc with embedded shell end @@ -1358,7 +1358,7 @@ begin - (?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) + (?><<[-~]("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) beginCaptures 0 @@ -1405,7 +1405,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)LUA)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)LUA)\b\1)) comment Heredoc with embedded lua end @@ -1416,7 +1416,7 @@ begin - (?><<-("?)((?:[_\w]+_|)LUA)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)LUA)\b\1) beginCaptures 0 @@ -1463,7 +1463,7 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)RUBY)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)RUBY)\b\1)) comment Heredoc with embedded ruby end @@ -1474,7 +1474,7 @@ begin - (?><<-("?)((?:[_\w]+_|)RUBY)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)RUBY)\b\1) beginCaptures 0 @@ -1560,7 +1560,7 @@ begin - (?><<-(\w+)) + (?><<[-~](\w+)) beginCaptures 0 @@ -1737,7 +1737,7 @@ heredoc begin - ^<<-?\w+ + ^<<[-~]?\w+ end $ patterns From 295b5cece2b5852eb6414a485a7ce01fd72a7629 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 28 Mar 2014 09:44:52 -0700 Subject: [PATCH 24/77] Add != to method name regexes Fixes atom/language-ruby#23 --- Syntaxes/Ruby.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 05c2c40..1af8353 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -380,7 +380,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method \s*(\() # the openning parenthesis for arguments beginCaptures @@ -456,7 +456,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method [ \t] # the space separating the arguments (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow @@ -533,7 +533,7 @@ ( \s+ # an optional group of whitespace followed by… ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method + |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method name meta.function.method.without-arguments.ruby From 35becc0de8b1d04415f3bcfffc6623c9569b44e1 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Mon, 7 Mar 2016 23:54:33 -0600 Subject: [PATCH 25/77] Allow ^ and !~ as method names Mentioned in atom/language-ruby#23, list taken from [method syntax documentation](http://ruby-doc.org/core-2.3.0/doc/syntax/methods_rdoc.html). --- Syntaxes/Ruby.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 1af8353..1542d5d 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -380,7 +380,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method \s*(\() # the openning parenthesis for arguments beginCaptures @@ -456,7 +456,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method [ \t] # the space separating the arguments (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow @@ -533,7 +533,7 @@ ( \s+ # an optional group of whitespace followed by… ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|!=|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method name meta.function.method.without-arguments.ruby From 0472ab709c9a1fc175cf94e819d024cf9080865a Mon Sep 17 00:00:00 2001 From: Spencer Steffen Date: Thu, 10 Apr 2014 14:25:21 -0700 Subject: [PATCH 26/77] Add kernel methods as `support.function.kernel.ruby` Discussed in atom/language-ruby#27 --- Syntaxes/Ruby.plist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 1542d5d..68b8d9a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -367,6 +367,12 @@ name support.class.ruby + + match + \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|iterator[?]?|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)\b(?![?!]) + name + support.function.kernel.ruby + match \b[A-Z]\w*\b From 92c77b6a3a27f62695e8498dbf31cbeef409ed3b Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 8 Mar 2016 00:44:57 -0600 Subject: [PATCH 27/77] Correct matching of autoload?, iterator?, and exit! A word boundary at the end of this match was preventing the rule from matching correctly. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 68b8d9a..bd3fc8e 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -369,7 +369,7 @@ match - \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|iterator[?]?|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)\b(?![?!]) + \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|iterator[?]|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)(\b|(?<=[?!]))(?![?!]) name support.function.kernel.ruby From 005bcab3f6d8f6d20bab95ad5cfc46df70b3f3a0 Mon Sep 17 00:00:00 2001 From: Henry Goodman Date: Sun, 14 Feb 2016 02:02:24 -0800 Subject: [PATCH 28/77] Change iterator? to `keyword.control.pseudo-method` This is to better match the scope given to `block_given?` which is synonymous with `iterator?` (although "mildly deprecated" according to Ruby docs). Discussed in atom/language-ruby#136 --- Syntaxes/Ruby.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index bd3fc8e..6e51755 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -235,7 +235,7 @@ comment just as above but being not a logical operation match - (?<!\.)\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\? + (?<!\.)\b(alias|alias_method|block_given[?]|break|defined[?]|iterator[?]|next|redo|retry|return|super|undef|yield)(\b|(?<=[?]))(?![?!]) name keyword.control.pseudo-method.ruby @@ -369,7 +369,7 @@ match - \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|iterator[?]|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)(\b|(?<=[?!]))(?![?!]) + \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)(\b|(?<=[?!]))(?![?!]) name support.function.kernel.ruby From 2ae484f765507907f5b2a2c0ec575546ed3b2320 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 6 Oct 2014 09:52:23 -0700 Subject: [PATCH 29/77] Scope self as variable.language.self Discussed in atom/language-ruby#54 --- Syntaxes/Ruby.plist | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 6e51755..661131d 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -247,10 +247,16 @@ match - \b(__(FILE|LINE)__|self)\b(?![?!]) + \b(__(FILE|LINE)__)\b(?![?!]) name variable.language.ruby + + match + \b(self)\b(?![?!]) + name + variable.language.self.ruby + comment everything being a method but having a special function is a.. From 04cbd463880eb34f9f91a2aa422199bff005d4e6 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 8 Mar 2016 02:20:43 -0600 Subject: [PATCH 30/77] Allow symbols to start with $ Discussed in atom/language-ruby#59. Handled in a different manner to only allow `$` as the first character similar to `@` usage. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 661131d..bacb7e8 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -829,7 +829,7 @@ comment symbols match - (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) + (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|(@@?|\$)[a-zA-Z_]\w*) name constant.other.symbol.ruby From f28dec9edd4ebb27b9e066b544e20d996322a70e Mon Sep 17 00:00:00 2001 From: Agent Antelope Date: Thu, 27 Nov 2014 14:28:49 +0000 Subject: [PATCH 31/77] Support &&= as augmented assignment This is to match ||=, |=, and &=. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index bacb7e8..52cb7e0 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1648,7 +1648,7 @@ match - <<=|%=|&=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< + <<=|%=|&{1,2}=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< name keyword.operator.assignment.augmented.ruby From 350b38fca4b286645988992590181dfa7122398f Mon Sep 17 00:00:00 2001 From: "Tobias H. Michaelsen" Date: Mon, 13 Apr 2015 14:13:08 +0200 Subject: [PATCH 32/77] Support Emacs file mode comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Files starting with a comment line of the form: # -*- ruby -*- should be recognized as Ruby source. This “standard” originates from [Emacs], but is also used by others. [Emacs]: http://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 52cb7e0..a070614 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -64,7 +64,7 @@ Puppetfile firstLineMatch - ^#!/.*\bruby + ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- keyEquivalent ^~R name From 27a3ada4cc47b2f9b6135f00ebdf5568b5fe373e Mon Sep 17 00:00:00 2001 From: Nikhil Narula Date: Mon, 18 May 2015 22:00:01 -0400 Subject: [PATCH 33/77] Fix comparable operator symbol highlighting Now correctly matches `:<=>` instead of only matching the `:<=` portion. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index a070614..7b10376 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -829,7 +829,7 @@ comment symbols match - (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|(@@?|\$)[a-zA-Z_]\w*) + (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|(@@?|\$)[a-zA-Z_]\w*) name constant.other.symbol.ruby From b20afaeb47b5e09e24db61e58c144c7481cfd2bd Mon Sep 17 00:00:00 2001 From: Nikhil Narula Date: Thu, 21 May 2015 20:17:24 -0400 Subject: [PATCH 34/77] Fix require special highlighting on method calls `require` should only be highlighted as a special method if it's not called on an object. Use negative look-behind to check if it's preceded by `.` or `::`. Discussed in atom/language-ruby#100 --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 7b10376..332ea5b 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -267,7 +267,7 @@ begin - \b(require|require_relative|gem)\b + \b(?<!\.|::)(require|require_relative|gem)\b captures 1 From 4e8cbf2d2a93c872e566102911d41cf976ff0a23 Mon Sep 17 00:00:00 2001 From: Nikhil Narula Date: Thu, 21 May 2015 20:18:15 -0400 Subject: [PATCH 35/77] Prefer `::` over consecutively matching two `:` Discussed in atom/language-ruby#101 --- Syntaxes/Ruby.plist | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 332ea5b..35badfa 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1682,12 +1682,6 @@ name keyword.operator.other.ruby - - match - : - name - punctuation.separator.other.ruby - match \; @@ -1706,6 +1700,12 @@ name punctuation.separator.method.ruby + + match + : + name + punctuation.separator.other.ruby + match \{ From 2f4eaaa096ca9f86bd65fcec0483ff20d7b1674c Mon Sep 17 00:00:00 2001 From: Nikhil Narula Date: Sat, 23 May 2015 11:09:09 -0400 Subject: [PATCH 36/77] Distinguish :: separators for methods/constants `::` isn't always a method separator in ruby, it also allows you to access module hierarchies and other constants. Constants are signified by starting with a capital letter. Discussed in atom/language-ruby#101 --- Syntaxes/Ruby.plist | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 35badfa..7eb667a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1695,12 +1695,36 @@ punctuation.separator.object.ruby + captures + + 1 + + name + punctuation.separator.namespace.ruby + + + comment + Mark as namespace separator if double colons followed by capital letter match - \.|:: - name - punctuation.separator.method.ruby + (::)\s*(?=[A-Z]) + captures + + 1 + + name + punctuation.separator.method.ruby + + + comment + Mark as method separator if double colons not followed by capital letter + match + (\.|::)\s*(?![A-Z]) + + + comment + Must come after method and constant separators to prefer double colons match : name From ade64e7c803692e487a4eff38419cbbc1ad2b758 Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Sat, 24 Oct 2015 21:31:25 -0700 Subject: [PATCH 37/77] Fixed def method *args formatting Fixes atom/language-ruby#69 --- Syntaxes/Ruby.plist | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 7eb667a..18966d2 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -506,7 +506,12 @@ 1 name - punctuation.definition.variable.ruby + storage.type.variable.ruby + + 2 + + name + variable.parameter.function.ruby match From a09cba6c9f7baf6c3ad4211a3fcb996b8ce9a9e2 Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Thu, 29 Oct 2015 17:30:27 -0700 Subject: [PATCH 38/77] Fix for multiple method arguments as symbols with parentheses --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 18966d2..527bc66 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -433,7 +433,7 @@ begin (?=[&*_a-zA-Z]) end - (?=[,)]) + (?=\,|\)\s*$) patterns From d62dfcd0768060b1e7a74e156a25119800d15d9c Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Thu, 29 Oct 2015 22:50:59 -0700 Subject: [PATCH 39/77] Give symbols in method argument a symbol hashkey scope --- Syntaxes/Ruby.plist | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 527bc66..e3be49c 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -445,13 +445,23 @@ storage.type.variable.ruby 2 + + name + constant.other.symbol.hashkey.parameter.function.ruby + + 3 + + name + punctuation.definition.constant.ruby + + 4 name variable.parameter.function.ruby match - \G([&*]?)([_a-zA-Z][_a-zA-Z0-9]*) + \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) include @@ -509,13 +519,23 @@ storage.type.variable.ruby 2 + + name + constant.other.symbol.hashkey.parameter.function.ruby + + 3 + + name + punctuation.definition.constant.ruby + + 4 name variable.parameter.function.ruby match - \G([&*]?)[_a-zA-Z][_a-zA-Z0-9]* + \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) name variable.parameter.function.ruby From 28911d4c5b3ecabe2fb42808d2be4fe17473ac02 Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Thu, 5 Nov 2015 21:02:09 -0800 Subject: [PATCH 40/77] Add stabby lambda (->) operator Fixes atom/language-ruby#117 --- Syntaxes/Ruby.plist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index e3be49c..2762749 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1671,6 +1671,12 @@ name punctuation.separator.key-value + + match + -> + name + keyword.operator.lambda.ruby + match <<=|%=|&{1,2}=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< From f2322b74d8852b5d5475c1d234860cbb942d4a84 Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Tue, 10 Nov 2015 16:02:31 -0800 Subject: [PATCH 41/77] Change stabby lambda token to match lambda scope --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 2762749..a053026 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1675,7 +1675,7 @@ match -> name - keyword.operator.lambda.ruby + support.function.kernel.lambda.ruby match From 28a5c289fc1d9cf6da812c59b8bb9b115f9f1e03 Mon Sep 17 00:00:00 2001 From: Eli Clemente Gordillo Foster Date: Thu, 19 Nov 2015 17:07:14 -0800 Subject: [PATCH 42/77] Add refinement methods Add support for the refinement methods using and refine. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index a053026..7325c6a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -261,7 +261,7 @@ comment everything being a method but having a special function is a.. match - \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!]) + \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected|refine|using)\b(?![?!]) name keyword.other.special-method.ruby From ea7210367123ec94c79be69cc90d9878cd09da9c Mon Sep 17 00:00:00 2001 From: Eli Clemente Gordillo Foster Date: Thu, 19 Nov 2015 17:05:10 -0800 Subject: [PATCH 43/77] =?UTF-8?q?Add=20refine=20snippet=20(refine=E2=86=92?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Snippets/refine.tmSnippet | 18 ++++++++++++++++++ info.plist | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 Snippets/refine.tmSnippet diff --git a/Snippets/refine.tmSnippet b/Snippets/refine.tmSnippet new file mode 100644 index 0000000..35f5f6e --- /dev/null +++ b/Snippets/refine.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + refine ${1:ClassName} do + $2 +end + name + refine … end + scope + source.ruby + tabTrigger + refine + uuid + 5CB8BCD2-20A5-45E5-A40B-7708C7B8763A + + diff --git a/info.plist b/info.plist index 98a545e..be853dd 100644 --- a/info.plist +++ b/info.plist @@ -329,6 +329,8 @@ 988C8AEF-FC71-4455-9C4F-9338C05685A4 ------------------------------------ 7BC1E159-0C90-4B0D-8808-80165C11F59C + ------------------------------------ + 5CB8BCD2-20A5-45E5-A40B-7708C7B8763A name Methods From 6a2675174c34645dc86a0ceb91bd7ae9b4b2d5dc Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 8 Mar 2016 04:40:59 -0600 Subject: [PATCH 44/77] Cleanup info.plist Remove outdated keys. --- info.plist | 214 ----------------------------------------------------- 1 file changed, 214 deletions(-) diff --git a/info.plist b/info.plist index be853dd..4961e89 100644 --- a/info.plist +++ b/info.plist @@ -6,22 +6,6 @@ wnzrf@tenlcebqhpgvbaf.arg contactName James Edward Gray II - deleted - - 3988A501-119E-4C0E-A584-C5E75FC2D6C6 - 8C102BE9-6E49-11D9-A933-000D93589AF6 - EE5F1AE5-6C02-11D9-92BA-0011242E4184 - 8394EDEF-87E8-11D9-A6A3-000D93589AF6 - BE3B3E5E-733E-11D9-A833-000A95A89C98 - 66708792-62C3-11D9-B8CF-000D93589AF6 - 667089D2-62C3-11D9-B8CF-000D93589AF6 - 667080D9-62C3-11D9-B8CF-000D93589AF6 - 667081DE-62C3-11D9-B8CF-000D93589AF6 - 66708259-62C3-11D9-B8CF-000D93589AF6 - 66708052-62C3-11D9-B8CF-000D93589AF6 - 6670881E-62C3-11D9-B8CF-000D93589AF6 - 7990EE60-C850-4779-A8C0-7FD2C853B99B - description Support for the <a href="http://www.ruby-lang.org/">Ruby</a> programming language. mainMenu @@ -438,204 +422,6 @@ name Ruby - ordering - - 35222962-C50D-4D58-A6AE-71E7AD980BE4 - 5289EE40-86B8-11D9-A8D4-000A95E13C98 - D5660BB2-C554-4694-9E0F-F20CDB6B9EA0 - 1AD6A138-2E89-4D6A-AB3F-416BF9CE968D - 931DD73E-615E-476E-9B0D-8341023AE730 - DAA69A0C-FC1E-4509-9931-DFFB38B4D6AE - 2DDB6FE0-6111-4C40-A149-8E67E76F8272 - BF4CA9F1-51CD-48D4-8357-852234F59046 - 8646378E-91F5-4771-AC7C-43FC49A93576 - EE5F19BA-6C02-11D9-92BA-0011242E4184 - 76FCF165-54CB-4213-BC55-BD60B9C6A3EC - EE5F1FB2-6C02-11D9-92BA-0011242E4184 - FBFC214F-B019-4967-95D2-028F374A3221 - 9FB64639-F776-499B-BA6F-BB45F86F80FD - 7F79BC8D-8A4F-4570-973B-05DFEC25747F - B297E4B8-A8FF-49CE-B9C4-6D4911724D43 - 835FAAC6-5431-436C-998B-241F7226B99B - 0275EF39-9357-408F-AF20-79E415CA9504 - 59E811FF-E722-46BE-8938-04713612FABB - F4EEB2B6-07D8-402F-8FC3-79B7308D2576 - 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD - 569C9822-8C41-4907-94C7-1A8A0031B66D - 6519CB08-8326-4B77-A251-54722FFBFC1F - 47D203ED-EB9B-4653-A07B-A897800CEB76 - C122CD92-DDBE-4869-9C7A-CC2B254C9411 - 121B334B-2AA6-4E9A-A8B8-BF93B627982B - 58FDEA60-10AF-4C49-AA09-29B77030DB25 - 33969819-62C5-4E03-B824-C2337205F364 - 7E084412-80E6-4B70-8092-C03D1ECE4CD2 - EC73D5CC-5F05-46B9-A6F4-82037E4A38C9 - 825B721D-4367-4DF7-98C0-F005695DF9E3 - BFB65D1C-62F1-485D-8A67-3E5A2E55107C - C649F945-DAB8-4DA2-B73C-2EFF9D7D34F3 - 5AE7CFB4-418E-4E00-AD76-06DB755EE876 - 9460392B-C036-4A76-A5AE-1191F10E4B1B - 2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA - F6BF907E-FDF7-4D9B-9E57-BE159561349D - E5158F94-CC52-4424-A495-14EF9272653F - A83F68A9-F751-4BB4-AE16-56812878C16A - 05984208-D559-4C04-A69C-2019361A985A - ED6368FB-A11D-4622-9F42-7879481094F1 - 88BC3896-DC39-4307-A271-21D33340F15A - FDFABCB9-DF58-4469-AE11-5407A4FF4D70 - 0F940CBC-2173-49FF-B6FD-98A62863F8F2 - 667083EE-62C3-11D9-B8CF-000D93589AF6 - 48D8E498-C9A5-4B1B-9A18-71A5860276FB - 4E9A7A73-875C-11D9-897C-000393CBCE2E - 7BC1E159-0C90-4B0D-8808-80165C11F59C - 6670835F-62C3-11D9-B8CF-000D93589AF6 - 667082E6-62C3-11D9-B8CF-000D93589AF6 - CD1609FA-47DA-4EE4-9C5B-5C56D953F5B1 - F53E098D-D08E-4CE2-990A-B0BD70E60614 - D121FC61-96A4-4B8F-8709-280EDA876FF3 - 488B387C-50C0-4B2D-9260-5A7E7EAF9B42 - BF487539-8085-4FF4-8601-1AD20FABAEDC - 83EED068-8C1C-4BAF-9893-902DC00616AB - 0CCBE04E-F4E2-4E55-9506-7DE67ACF8388 - 05DFF82C-5A29-4EBD-93FE-C165FFFB5EA8 - E98FB8F9-7302-431D-8BF2-275A68A6126C - AFE1D078-EA16-45F5-AD8A-FAC1B523D861 - C7AAAE45-487A-4B61-8962-D47675AAC05F - 2B73EC5F-06D2-460C-A14F-6FA05AFCF0CC - 0E85EC81-2FAB-4648-B590-119CC1BB6E41 - A71A18CF-2D71-4BFF-AA0C-D9B8C59BC4EB - A150C2D8-25B3-4339-BC92-8A0160A70486 - 3D383096-A03F-4EF8-9060-3C727045AB34 - D7A7D3C9-1714-4C50-8CC0-D83A03883E8F - AAD5D511-6BE7-41DA-8F2B-1593A48FBB08 - 6C9D6B3D-D8E9-4606-9534-577C8D21FFF6 - 7F46C90A-595B-4B83-A4F7-058F63CE4218 - 7C6E88FA-CA0E-4110-8C75-A94E54286A75 - 87D5F8AD-8DA6-4AED-A0D8-B51CAC980445 - 4E9D15B5-65D6-4A9A-9DEC-DE041D68C06F - C44ED391-614F-4BA2-BB0F-87668EEA9954 - 4A6EFD6B-88E2-4822-AD48-03460EDBC796 - 988C8AEF-FC71-4455-9C4F-9338C05685A4 - 451A0596-1F72-4AFB-AF2F-45900FABB0F7 - A05CBDD6-845D-45EB-94FB-F8787F5456BE - B2C3ADE8-E19E-4B87-9C6C-593D490114C7 - 97DE939B-D243-4D5C-B953-1C9090912E7C - 34FEBB9F-73CD-4DD4-A0A3-1CF2A5E3DE78 - E16D24D2-CC7E-4786-BE0B-1725FC865D78 - 21C0D711-F32A-4665-AA0D-B136F9DD3945 - 49D69DEC-6991-49F4-8D9B-BA60BFDD3D17 - DAE6A754-D906-4763-B816-CE67125CEF08 - 263C94DC-63CF-4BA3-9692-C5582CA8F1AB - 6021BBDC-4AAD-447B-A0C2-A4BB31721558 - 3DDB99C4-486D-4C11-A217-5680FDD8EC19 - FD010022-E0E7-44DB-827F-33F7D9310DA2 - 4991BB86-736E-4758-B9B2-E4FA90B9368F - 36853A11-0307-4AE7-B835-7CE6358717A5 - 206D54AF-E67A-4DF0-B7F4-3D42FEB81685 - 51954118-81D7-42B6-9A10-BE23D8B9FFE2 - 567E3D18-BF2B-4379-8927-2777EC9F495E - ECBA4CA0-275F-460E-85BE-E82FEA2E2B26 - 338EC03D-3FF4-4435-94E8-1CEF20CEC75D - FDD73070-6D32-4301-A86A-C55B77C3D8ED - 3C04589C-5127-478E-97B3-CA7DD2EA7ECD - 689120C9-AB40-4081-8268-9362E00FA4A0 - E54F7077-3C33-4B53-A4F7-21E16132D3AD - 02913388-EE8E-4C55-AC94-94F3D751F47E - 7A3CECED-452B-438E-A5C6-95B6BDC43243 - CD748479-D2A4-4AB5-95BD-4C89512BA210 - 844DBD70-BC23-4FBF-9C18-F4A610239DF2 - 1DD13CF5-39C0-4F10-B655-56DACEBC7F94 - F3C5F719-EF03-4FF7-A777-4A8402FE3B6B - B563E0D7-513D-49B4-9733-1B04A6F25A74 - 5A3754FC-43A3-462B-AB42-E3E951872E6F - BD4CFD7B-1AC0-4569-9BDA-FD491F41F4E6 - 9E0B4D4B-2956-4B3A-800A-3D8CE54E66BF - BA9440C9-36C3-4031-BB61-67B581D5B179 - B0CE57EC-FB2E-4482-8CCE-448DC2588715 - 07D1F987-7CDB-4EAD-B64A-27A93051700E - A3B9B76B-2BC5-425C-AB24-9FAAFC375798 - 5DA9E1E8-2C54-420A-9B84-B040A1AF2B9E - 669A86AD-936F-4EDA-8E4E-6863804072DA - 6C6B9849-9631-49FF-A9F9-F0E94A1512C5 - 1F72122A-35AD-4BA1-AA01-889A10319666 - E23FE534-8061-4828-98A5-46270B6910B0 - 197709C5-8382-4A59-B6D7-31A0CC0F23B7 - 9D9E7BA3-8C5D-4532-83EA-326358C2F5BB - 98182B9E-7C61-4824-BE4C-9CD69C816037 - CB03D11A-7204-48D0-92C1-E109034403E7 - 52B8BF63-F09E-4789-8407-06168A8AE666 - B79B9DAB-ABEF-44F6-BF7E-635E7BA11DFD - 4E409AA4-E7D4-46B7-A4E9-E32F992B33E9 - 8021944C-CEA4-4983-8D1C-78D18D4004A1 - 2514FC26-468C-4D08-A788-494A444C4286 - 66802933-B49F-479B-9DF9-1D898FF1FA90 - 855FC4EF-7B1E-48EE-AD4E-5ECB8ED79D1C - 4B72C5C3-6CA7-41AC-B2F9-51DEA25D469E - 21E75321-0CF7-45E8-A297-BCC7C0DDDD15 - E16EE658-1CA0-4950-954B-B962E50B754F - 840B9C4C-7037-4C3B-9028-EB9DC75EDB3E - B9E3A6DF-875D-11D9-897C-000393CBCE2E - 418F1817-255F-430A-B09A-222964ED66A7 - 8F594E5E-6F46-4E98-B5FB-1C8F3BA9828F - 50C56AC8-48F3-42A0-AF10-8164464AFAEF - 397FA09F-A30F-4EE4-920C-318D5004EE97 - 332AA973-AA71-48CB-AEE9-1D71E11019AC - 8EBBB26F-980E-404E-8366-74E5772298F6 - 678BDB83-FBBD-4E8E-BE0B-E1A98AECB247 - A4E89D97-D5ED-48BB-B5FF-1BFB79211FCD - 8CEF9711-88D5-4202-AFB9-29EF4EFD25C1 - C3C48948-4F49-484E-A8DE-DEB44723099E - 209D5D73-7A77-4931-A158-3FB6D5B48A88 - 31D1F145-33AB-4441-BA11-4D1C46928C4C - 00F66D41-25AF-4597-B67D-E540965A5222 - 5297FD0C-98B1-4514-BBD1-1516810BECA6 - B32C147D-44A6-478A-9D5D-189D7831E9A7 - 43A61A22-6BEE-4997-961C-1CDE739C05FE - A243E96F-DC21-4AA0-B340-13A7674F6AFF - 429D0EF5-580D-4166-8F79-713DE96B77F1 - 0E831E03-67E1-4357-8323-C60685C23C4F - 671F05E2-D9CC-485E-BB1B-B13EF20FAC65 - 4C79256C-480A-459C-BDE8-BB0D972811DB - 79FEC3CC-2A40-4611-9A85-ECDB22FE0701 - 711ED6C3-0F18-41FB-9A7D-3094BB319A85 - A072BB1E-1DD1-45D3-9346-8CA3BA21B364 - 1B925A4D-8EE4-442B-9254-293599F5717F - 68B21F6F-5D89-41FA-A19C-F29C2F912B4E - 82F8EEE0-2452-411E-8102-7BFDDBCA2E72 - 09A11FDA-49FC-4466-8787-8D1D5D111A89 - 29340695-E426-4F77-8CF7-C59360A549F4 - F91C25EC-EC76-498B-BFB5-FDA8F57C5875 - 7850AD5C-A90D-4E2C-A931-EADFF8D3D9A3 - 05655BD8-23C6-445F-BFD1-420BF25C3030 - 33639D7A-BD8C-4396-9C44-307B8AC87C9E - DB457094-1AC9-4856-AEFC-43A9576B6775 - B186BAC0-D981-41AC-B8F4-34BAD2BC4EE6 - F46A4687-E52D-40D2-9072-C215645EDBC6 - 942F20E2-C40A-44B8-A3F2-99AAC68CB534 - 1C60D589-DD46-4109-90CA-6B34AEA2F298 - 0CB48BCA-3F6E-4AE0-85BC-08A1D2508216 - 20AAD0BC-075D-4EC0-9057-E3E5E62C4125 - 5B46ECFD-23A4-4F0C-9951-F64C19C72C2B - 46BF99AD-E172-4D49-BCF7-072F4730E1D9 - 3BA6762A-BB6B-489E-8006-F30F386AEF48 - 8343ACF4-EEB7-44B5-B835-94826466D4D5 - B904D4AA-D15D-48A4-8EB2-563BAF489332 - CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF - 2DBEE50B-3097-4A57-AB48-3586CF392D8B - 0BA2B2F1-E767-4A03-9791-0AC0183251F1 - B46D35B8-5DEB-4C10-A110-BA1965A2EB9C - 05EE1046-5ED7-48F5-8693-1F066163B2F4 - A7BF14E6-59B1-42E5-8755-8A72BF13685E - EEE6D060-C5A0-400D-A2E0-0835013C5365 - E00B62AC-6B1C-11D9-9B1F-000D93589AF6 - 1D26F26C-C6F7-434F-84F8-FEE895372E8A - 6FEAF60F-F0F3-4618-9259-DE93285F50D1 - 92E190C9-A861-4025-92D4-D6B5A24C22D4 - A5D50494-EB97-48DE-A2BE-322DF52A7A7A - 6D75102B-6E51-4360-8F12-BE12327B6AE6 - AEDD6A5F-417F-4177-8589-B07518ACA9DE - 1A7701FA-D866-498C-AD4C-7846538DB535 - uuid 467B298F-6227-11D9-BFB1-000D93589AF6 From 5fa1aed001864c3f915e70e0c68a9dbb76bda1a8 Mon Sep 17 00:00:00 2001 From: "Marco A. Mena" Date: Mon, 23 Nov 2015 01:45:26 -0800 Subject: [PATCH 45/77] Fixes blockpipe formatting Discussed in atom/language-ruby#123, fixes atom/language-ruby#93 --- Syntaxes/Ruby.plist | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 7325c6a..31bdc33 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1648,9 +1648,13 @@ end - (\|) + (?<!\|)(\|)(?!\|) patterns + + include + $self + match [_a-zA-Z][_a-zA-Z0-9]* From c2d44b02d52afcd55439b6247f42f59723834154 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 8 Mar 2016 04:59:00 -0600 Subject: [PATCH 46/77] Improve punctuation scope of blockpipe arguments --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 31bdc33..277f58d 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1644,7 +1644,7 @@ 1 name - punctuation.separator.variable.ruby + punctuation.separator.arguments.ruby end From 1cec56d0684df1f15414afadf3d659e49006fa54 Mon Sep 17 00:00:00 2001 From: Solomon White Date: Wed, 30 Dec 2015 14:29:14 -0700 Subject: [PATCH 47/77] Add support for Ruby 2.3's new "safe navigation operator" https://bugs.ruby-lang.org/issues/11537 --- Syntaxes/Ruby.plist | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 277f58d..e384292 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1699,6 +1699,20 @@ name keyword.operator.logical.ruby + + captures + + 1 + + name + punctuation.separator.method.ruby + + + comment + Safe navigation operator - Added in 2.3 + match + (&\.)\s*(?![A-Z]) + match (%|&|\*\*|\*|\+|\-|/) From 5932b27226302941b96eb42b50869e7597a691fd Mon Sep 17 00:00:00 2001 From: Jordon Bedwell Date: Sun, 3 Jan 2016 15:24:25 -0600 Subject: [PATCH 48/77] Add support for `private_class_method` It's a real thing: http://ruby-doc.org/core-2.0.0/Module.html#method-i-private_class_method --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index e384292..cb11aec 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -261,7 +261,7 @@ comment everything being a method but having a special function is a.. match - \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected|refine|using)\b(?![?!]) + \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|private_class_method|module_function|public|protected|refine|using)\b(?![?!]) name keyword.other.special-method.ruby From 61ada971d443ef4d807a37e2f1d521e6e1eba07c Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Wed, 9 Mar 2016 03:34:08 -0600 Subject: [PATCH 49/77] Add pre-defined variable $-w List of variables taken from: http://docs.ruby-lang.org/en/2.3.0/globals_rdoc.html --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index cb11aec..d35c674 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -340,7 +340,7 @@ match - (\$)(!|@|&|`|'|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv]) + (\$)(!|@|&|`|'|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpvw]) name variable.other.readwrite.global.pre-defined.ruby From 1d33d62fbf9419b40cc4dcea3ce4a4f2a02c98b4 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Wed, 9 Mar 2016 04:32:22 -0600 Subject: [PATCH 50/77] Don't allow [ characters inside a character-class This was previously allowed but returns an error in ruby. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index d35c674..e55cc5a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -4064,7 +4064,7 @@ begin - \[(?:\^?\])? + \[\^? beginCaptures 0 From 5d68373a232dfaaee6fa746e524b1c7eb95c9fa6 Mon Sep 17 00:00:00 2001 From: Oscar Barrett Date: Mon, 11 Jan 2016 12:11:28 +0800 Subject: [PATCH 51/77] Added arb to fileTypes for ruby language --- Syntaxes/Ruby.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index e55cc5a..9037bb9 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -62,6 +62,7 @@ Berksfile.lock Thorfile Puppetfile + arb firstLineMatch ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- From e1ff600ef44450b15e48c5e4d13a5ac52cf58d57 Mon Sep 17 00:00:00 2001 From: Macklin Underdown Date: Tue, 22 Mar 2016 11:59:37 -0400 Subject: [PATCH 52/77] Add Dangerfile fileType https://github.com/danger/danger --- Syntaxes/Ruby.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 9037bb9..0c2727c 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -63,6 +63,7 @@ Thorfile Puppetfile arb + Dangerfile firstLineMatch ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- From 9daa7dca6023fc0c9e092b9ad964dde448862181 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 4 Apr 2016 17:04:06 -0700 Subject: [PATCH 53/77] Add Brewfile to fileTypes --- Syntaxes/Ruby.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 0c2727c..b4483bc 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -64,6 +64,7 @@ Puppetfile arb Dangerfile + Brewfile firstLineMatch ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- From da02341b9911ec1ff747b9fb118789eba6289b35 Mon Sep 17 00:00:00 2001 From: Simon Courtois Date: Tue, 12 Jul 2016 18:58:08 +0200 Subject: [PATCH 54/77] Adding `private def` to folding rules This commit adds folding for the following method definition syntax: private def some_method # code here end --- Preferences/Folding.tmPreferences | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Preferences/Folding.tmPreferences b/Preferences/Folding.tmPreferences index 5145bd9..d6b08d6 100644 --- a/Preferences/Folding.tmPreferences +++ b/Preferences/Folding.tmPreferences @@ -11,7 +11,7 @@ foldingStartMarker (?x)^ (\s*+ - (module|class|def(?!.*\bend\s*$) + (module|class|(private\s+)?def(?!.*\bend\s*$) |unless|if |case |begin From 1094f3f1c1caa47a7a72186c49d4ad1a31558c99 Mon Sep 17 00:00:00 2001 From: Kit Sunde Date: Wed, 18 May 2016 12:46:15 +0800 Subject: [PATCH 55/77] Add .vagrantplugins to fileTypes --- Syntaxes/Ruby.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index b4483bc..557706d 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -56,6 +56,7 @@ Guardfile Hobofile Vagrantfile + .vagrantplugins Appraisals Rantfile Berksfile From 44bc21c34002842edede2417f7575a83af4be216 Mon Sep 17 00:00:00 2001 From: esdoppio Date: Sat, 25 Jun 2016 20:42:54 +0800 Subject: [PATCH 56/77] Match 'do', no trailing spaces This allows for better word selection and movement. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 557706d..0ea22dc 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -215,7 +215,7 @@ comment contextual smart pair support for block parameters match - (?<!\.)\bdo\b\s* + (?<!\.)\bdo\b name keyword.control.start-block.ruby From 518437aca0307ed816918ebbd4a76affd7a158d2 Mon Sep 17 00:00:00 2001 From: esdoppio Date: Sun, 26 Jun 2016 10:24:21 +0800 Subject: [PATCH 57/77] Remove the escaping of - = Cleans up unneeded escaping --- Syntaxes/Ruby.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 0ea22dc..166fec2 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1562,7 +1562,7 @@ begin - (?>\=\s*<<(\w+)) + (?>=\s*<<(\w+)) beginCaptures 0 @@ -1687,7 +1687,7 @@ match - <<=|%=|&{1,2}=|\*=|\*\*=|\+=|\-=|\^=|\|{1,2}=|<< + <<=|%=|&{1,2}=|\*=|\*\*=|\+=|-=|\^=|\|{1,2}=|<< name keyword.operator.assignment.augmented.ruby @@ -1719,7 +1719,7 @@ match - (%|&|\*\*|\*|\+|\-|/) + (%|&|\*\*|\*|\+|-|/) name keyword.operator.arithmetic.ruby From 06efe7df45cee13708f86d9af1975689e4ec2adc Mon Sep 17 00:00:00 2001 From: esdoppio Date: Sun, 26 Jun 2016 10:47:15 +0800 Subject: [PATCH 58/77] Remove the escaping of , ; Cleans up unneeded escaping --- Syntaxes/Ruby.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 166fec2..5a8739e 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -437,7 +437,7 @@ begin (?=[&*_a-zA-Z]) end - (?=\,|\)\s*$) + (?=,|\)\s*$) patterns @@ -1737,7 +1737,7 @@ match - \; + ; name punctuation.separator.statement.ruby From 6dc051e8af30b0d937bae69a7dec812907fbce1d Mon Sep 17 00:00:00 2001 From: esdoppio Date: Wed, 29 Jun 2016 11:41:59 +0800 Subject: [PATCH 59/77] Refine grammar of logical operators Fixes atom/language-ruby#138 --- Syntaxes/Ruby.plist | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 5a8739e..70a21d0 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -228,16 +228,6 @@ meta.syntax.ruby.start-block - comment - as above, just doesn't need a 'end' and does a logic operation - match - (?<!\.)\b(and|not|or)\b - name - keyword.operator.logical.ruby - - - comment - just as above but being not a logical operation match (?<!\.)\b(alias|alias_method|block_given[?]|break|defined[?]|iterator[?]|next|redo|retry|return|super|undef|yield)(\b|(?<=[?]))(?![?!]) name @@ -1699,7 +1689,15 @@ match - (?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^ + (?<!\.)\b(and|not|or)\b(?![?!]) + name + keyword.operator.logical.ruby + + + comment + Make sure this goes after assignment and comparison + match + (?<=^|[ \t])!|&&|\|\||\^ name keyword.operator.logical.ruby From 6f856f5145348d561b190c8d12198fa69a7648eb Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Sun, 17 Jul 2016 21:21:30 -0500 Subject: [PATCH 60/77] Avoid exiting percent literals early A stray standard ending character would exit the literal early in a literal with arbitrary delimiters. Example: ```ruby %Q:The quick #{color} fox\n}jumps over the #{temperment} dog: ``` --- Syntaxes/Ruby.plist | 18 +++++++++--------- Tests/percent_literals.rb | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 70a21d0..58c9e1c 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1975,7 +1975,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -2283,7 +2283,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -2540,7 +2540,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -2722,7 +2722,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -2920,7 +2920,7 @@ end - ([)\]}>]|\1\2)[eimnosux]* + ([)\]}>]\2|\1\2)[eimnosux]* endCaptures 0 @@ -3098,7 +3098,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -3280,7 +3280,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -3588,7 +3588,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 @@ -3845,7 +3845,7 @@ end - [)\]}>]|\1\2 + [)\]}>]\2|\1\2 endCaptures 0 diff --git a/Tests/percent_literals.rb b/Tests/percent_literals.rb index 2934093..9164d59 100644 --- a/Tests/percent_literals.rb +++ b/Tests/percent_literals.rb @@ -36,6 +36,8 @@ %Q{The quick #{color} fox\n{jumps over the #{temperment} dog}} %Q> +%Q:The quick #{color} fox\n}jumps over the #{temperment} dog: # Don't let a stray closing + # character end string # Regular expression %r(The quick brown fox jumps over the lazy dog)i From 8f4e77cb9729ee91dbba9a26666ff73d1df3fca4 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Sun, 17 Jul 2016 21:46:22 -0500 Subject: [PATCH 61/77] Don't allow `=` as an arbitrary delimiter for % strings Allowing `=` to be used as a delimiter conflicts with the `%=` operator. Fixes #95 --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 58c9e1c..050fa7c 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -2712,7 +2712,7 @@ begin - %Q?(?:([(\[{<])|([^\w\s]|_)) + %Q?(?:([(\[{<])|([^\w\s=]|_)) beginCaptures 0 From ad08f8be820d5bf4b29812038cf9ee9abe9cec2f Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 9 Aug 2016 01:02:04 -0500 Subject: [PATCH 62/77] Match parenthesis inside arguments as a pair A comment following the arguments in the function definition would prevent the argument rule from ending. Now matches the parenthesis inside arguments as a pair, doing so removes the need to look-ahead after the ending `)`. ```ruby def foo(_) # ["a", "b"] end ``` Fixes #103, original issue discussed in atom/language-ruby#78 --- Syntaxes/Ruby.plist | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 050fa7c..bb24c21 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -427,7 +427,7 @@ begin (?=[&*_a-zA-Z]) end - (?=,|\)\s*$) + (?=[,)]) patterns @@ -457,6 +457,29 @@ match \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) + + begin + \( + captures + + 0 + + name + punctuation.section.function.ruby + + + comment + Prevent end pattern of parent rule from ending prematurely. + end + \) + patterns + + + include + $self + + + include $self From f0ab9fb24f32372d3e4054f33e8c243d810c7260 Mon Sep 17 00:00:00 2001 From: Stanislav Dombrovsky Date: Thu, 25 Aug 2016 16:03:14 +0300 Subject: [PATCH 63/77] Add fastlane-related extensions Filetypes for https://fastlane.tools/ --- Syntaxes/Ruby.plist | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index bb24c21..3e20d6a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -66,6 +66,13 @@ arb Dangerfile Brewfile + Fastfile + Appfile + Deliverfile + Matchfile + Scanfile + Snapfile + Gymfile firstLineMatch ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- From 5bd7c0a1033e092d4e15fa131a32ca6c8d793d52 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 6 Sep 2016 18:05:56 +0200 Subject: [PATCH 64/77] =?UTF-8?q?Decrease=20indent=20when=20line=20contain?= =?UTF-8?q?s=20=E2=80=98})=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This would be for code like the following: some_method(arg1, { :key => value }) --- Preferences/Miscellaneous.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Preferences/Miscellaneous.plist b/Preferences/Miscellaneous.plist index b4b81ac..d7c1257 100644 --- a/Preferences/Miscellaneous.plist +++ b/Preferences/Miscellaneous.plist @@ -9,7 +9,7 @@ settings decreaseIndentPattern - ^\s*([}\]](,?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b) + ^\s*([}\]]([,)]?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b) increaseIndentPattern (?x)^ (\s* From f49a2f5113745a0c88c29924329eb1ca896d0f9e Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Thu, 18 Aug 2016 10:46:29 +0200 Subject: [PATCH 65/77] Implement `RubyUtils.find_executable` --- Support/bin/rvm_wrapper | 6 + Support/lib/executable.rb | 97 ++++++++++ Support/test/fixtures/.tm_properties | 1 + Support/test/fixtures/bin/rspec | 17 ++ Support/test/fixtures/bin/sample-executable | 3 + Support/test/fixtures/fake_rbenv/rbenv | 6 + .../fake_rbenv/shims/rbenv_installed_shim | 3 + .../test/fixtures/fake_rvm_home/.rvm/bin/rvm | 23 +++ Support/test/fixtures/sample_project/Gemfile | 4 + .../test/fixtures/sample_project/Gemfile.lock | 40 ++++ .../test/fixtures/sample_project/bin/rspec | 17 ++ .../test/fixtures/sample_project/other/rspec | 17 ++ Support/test/test_executable.rb | 171 ++++++++++++++++++ 13 files changed, 405 insertions(+) create mode 100755 Support/bin/rvm_wrapper create mode 100644 Support/lib/executable.rb create mode 100644 Support/test/fixtures/.tm_properties create mode 100755 Support/test/fixtures/bin/rspec create mode 100755 Support/test/fixtures/bin/sample-executable create mode 100755 Support/test/fixtures/fake_rbenv/rbenv create mode 100755 Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim create mode 100755 Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm create mode 100644 Support/test/fixtures/sample_project/Gemfile create mode 100644 Support/test/fixtures/sample_project/Gemfile.lock create mode 100755 Support/test/fixtures/sample_project/bin/rspec create mode 100755 Support/test/fixtures/sample_project/other/rspec create mode 100644 Support/test/test_executable.rb diff --git a/Support/bin/rvm_wrapper b/Support/bin/rvm_wrapper new file mode 100755 index 0000000..6096b7f --- /dev/null +++ b/Support/bin/rvm_wrapper @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" + +cd . # Activate rvm for the current directory +"$@" \ No newline at end of file diff --git a/Support/lib/executable.rb b/Support/lib/executable.rb new file mode 100644 index 0000000..51e5e6e --- /dev/null +++ b/Support/lib/executable.rb @@ -0,0 +1,97 @@ +require 'shellwords' + +module Executable + class NotFound < RuntimeError; end + + class << self + # Try to find the Ruby executable `name`. Return an array containing the + # command(s) needed to run the executable. If the executable could not be + # found, `Executable::NotFound` is raised with a message describing the + # problem. + # + # Typical usage looks like this: + # + # Dir.chdir(ENV['TM_PROJECT_DIRECTORY']) if ENV['TM_PROJECT_DIRECTORY'] + # begin + # executable = Executable.find('rspec') + # system(*executable, '--some', '--additional', 'args') + # rescue Executable::NotFound => e + # # Executable not found, so use fallback / display alert / … + # # `e.message` contains detailed error message. + # end + # + # Supports the following cases: + # + # 1. If an appropriate `TM_*` environment variable is present and points to + # an executable file, its value is returned. (The name of the environment + # variable is automatically derived from the executable name, eg. `rspec` + # → `TM_RSPEC` etc. Alternatively, you can use the `env_var` argument + # to explicitly specify the name.) + # 2. If a binstub (`bin/name`) exists, it is returned. + # 3. If a Gemfile.lock exists and has an entry for `name`, `[bundle exec + # name]` is returned. + # 4. If `name` is found in the search path, it is returned. (Special case: + # If `name` looks like an rbenv shim, also check if the executable has + # been installed for the current Ruby version.) + # + # Both RVM and rbenv are supported, too: + # + # * If RVM is installed, the executable will be run via a small wrapper + # shell script that sets up RVM correctly before running the executable. + # (Note that this is NOT the case if an appropriate `TM_*` environment + # variable is present: In this case, the value of the environment variable + # is returned unchanged. ) + # + # * rbenv just works out of the box as long as your PATH (inside TextMate) + # is setup to contain `~/.rbenv/shims`. + # + def find(name, env_var = nil) + # Safeguard against invalid names so that we don’t need to care about + # shell escaping later on + raise ArgumentError, "Invalid characters found in '#{name}'" unless name =~ /\A[\w_-]+\z/ + + env_var ||= 'TM_' + name.gsub(/\W+/, '_').upcase + prefix = determine_rvm_prefix || [] + if (cmd = ENV[env_var]) && cmd != '' + cmd = cmd.shellsplit + if system('which', '-s', cmd[0]) + cmd + else + raise NotFound, "#{env_var} is set to '#{cmd}', but this does not seem to exist." + end + + elsif File.exist?("bin/#{name}") + prefix + ["bin/#{name}"] + + elsif File.exist?('Gemfile.lock') && File.read('Gemfile.lock') =~ /^ #{name} / + prefix + %W(bundle exec #{name}) + + elsif (path = `#{prefix.map(&:shellescape).join(' ')} which #{name}`.chomp) != '' + # rbenv installs shims that are present even if the command has not been + # installed for the current Ruby version, so we need to also check `rbenv + # which` in this case. + if path.include?('rbenv/shims') && !system("rbenv which #{name} &>/dev/null") + raise NotFound, "rbenv reports that '#{name}' is not installed for the current Ruby version." + else + prefix + [name] + end + + else + raise NotFound, "Could not find executable '#{name}'." + end + end + + private + + # Return appropriate prefix for running commands via RVM if RVM is installed + # and the current directory contains an RVM project file. + def determine_rvm_prefix + rvm = "#{ENV['HOME']}/.rvm/bin/rvm" + %W(#{ENV['TM_BUNDLE_SUPPORT']}/bin/rvm_wrapper) if File.exist?(rvm) + end + + def ruby_version_in_gemfile? + File.exist?('Gemfile.lock') && File.read('Gemfile.lock') =~ /^RUBY_VERSION/ + end + end +end diff --git a/Support/test/fixtures/.tm_properties b/Support/test/fixtures/.tm_properties new file mode 100644 index 0000000..d1d2c06 --- /dev/null +++ b/Support/test/fixtures/.tm_properties @@ -0,0 +1 @@ +include = "{$include,.rvm}" diff --git a/Support/test/fixtures/bin/rspec b/Support/test/fixtures/bin/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/bin/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/fixtures/bin/sample-executable b/Support/test/fixtures/bin/sample-executable new file mode 100755 index 0000000..bab677a --- /dev/null +++ b/Support/test/fixtures/bin/sample-executable @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +# noop \ No newline at end of file diff --git a/Support/test/fixtures/fake_rbenv/rbenv b/Support/test/fixtures/fake_rbenv/rbenv new file mode 100755 index 0000000..0e7b4a2 --- /dev/null +++ b/Support/test/fixtures/fake_rbenv/rbenv @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +if [[ $1 == "which" ]]; then + echo "rbenv: $2: command not found" + exit 127 +fi diff --git a/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim b/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim new file mode 100755 index 0000000..08b8b25 --- /dev/null +++ b/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +# do nothing ... diff --git a/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm b/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm new file mode 100755 index 0000000..d68a5d5 --- /dev/null +++ b/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Fake RVM stub to be used in tests. Serves a single purpose: +# +# * If invoked as `rvm . do which [-s] …` it pretends that an executable +# named `sample_executable_from_rvm` is available in the search path. +# (Optional `-s` behaves just like in the original `which` command on BSD / +# MacOS.) + +if [[ "$1 $2 $3" == ". do which" ]]; then + if [[ $4 == "-s" && $5 == "sample_executable_from_rvm" ]]; then + exit 0 + elif [[ $4 == "sample_executable_from_rvm" ]]; then + echo "/some/fake/path/to/sample_executable_from_rvm" + else + exit 1 + fi + +else + >&2 echo "You tried to make this fake RVM stub do something it does not understand!: $*" + exit 99 + +fi \ No newline at end of file diff --git a/Support/test/fixtures/sample_project/Gemfile b/Support/test/fixtures/sample_project/Gemfile new file mode 100644 index 0000000..4c96875 --- /dev/null +++ b/Support/test/fixtures/sample_project/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'rubocop' +gem 'rspec' diff --git a/Support/test/fixtures/sample_project/Gemfile.lock b/Support/test/fixtures/sample_project/Gemfile.lock new file mode 100644 index 0000000..66c5e15 --- /dev/null +++ b/Support/test/fixtures/sample_project/Gemfile.lock @@ -0,0 +1,40 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.3.0) + diff-lcs (1.2.5) + parser (2.3.1.2) + ast (~> 2.2) + powerpack (0.1.1) + rainbow (2.1.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.2) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubocop (0.42.0) + parser (>= 2.3.1.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + unicode-display_width (1.1.0) + +PLATFORMS + ruby + +DEPENDENCIES + rspec + rubocop + +BUNDLED WITH + 1.12.5 diff --git a/Support/test/fixtures/sample_project/bin/rspec b/Support/test/fixtures/sample_project/bin/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/sample_project/bin/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/fixtures/sample_project/other/rspec b/Support/test/fixtures/sample_project/other/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/sample_project/other/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/test_executable.rb b/Support/test/test_executable.rb new file mode 100644 index 0000000..ef12d40 --- /dev/null +++ b/Support/test/test_executable.rb @@ -0,0 +1,171 @@ +require 'minitest/autorun' +require 'shellwords' +require "#{__dir__}/../lib/executable" + +class TestExecutableFind < Minitest::Test + def setup + Dir.chdir("#{__dir__}/fixtures/sample_project") + + # Set $HOME to a directory controlled by us to make sure `$HOME/.rvm` does + # not exist even if the user running these tests has rvm actually installed. + # Also, clear out all `TM_*` env vars so they won’t interfere with our + # tests. + @original_env = ENV.to_h + ENV['HOME'] = "#{__dir__}/fixtures/sample_project" + ENV.delete_if{ |name, _value| name.start_with?('TM_') } + + # $TM_BUNDLE_SUPPORT is needed by `Executable.determine_rvm_prefix` + ENV['TM_BUNDLE_SUPPORT'] = File.realpath("#{__dir__}/..") + @rvm_prefix = "#{ENV['TM_BUNDLE_SUPPORT']}/bin/rvm_wrapper" + end + + def teardown + ENV.replace(@original_env) + end + + def with_env(env_vars) + original_env = ENV.to_h + ENV.update(env_vars) + yield + ensure + ENV.replace(original_env) + end + + # Set $HOME to a directory containing `.rvm/bin/rvm` (because this is what + # `Executable` checks to determine if RVM is installed) + def with_rvm_installed + with_env('HOME' => "#{__dir__}/fixtures/fake_rvm_home") do + yield + end + end + + + def test_validate_name + assert_raises(ArgumentError){ Executable.find('foo bar') } + assert_raises(ArgumentError){ Executable.find('') } + assert_raises(ArgumentError){ Executable.find(nil) } + assert_raises(ArgumentError){ Executable.find('special;characters') } + assert_raises(ArgumentError){ Executable.find('not\ ok') } + assert_raises(ArgumentError){ Executable.find('"quoted"') } + end + + def test_use_env_var + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec') + end + end + + # Even if RVM is installed, if an env var is set for the executable it should + # be used unchanged (i.e. it should not be prefixed with the rvm wrapper + # script.) + def test_use_env_var_with_rvm + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_rvm_installed do + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec') + end + end + end + + def test_use_custom_env_var + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec-special', 'TM_RSPEC') + end + end + + # Setting TM_FOO to eg. `bundle exec foo` should be possible, too. + def test_use_env_var_with_executable_with_spaces + with_env('PATH' => "#{__dir__}/fixtures/bin:#{ENV['PATH']}", 'TM_SAMPLE' => 'sample-executable with options') do + assert_equal %w(sample-executable with options), Executable.find('sample') + end + end + + def test_use_env_var_with_missing_executable + with_env('TM_NONEXISTING_EXECUTABLE' => 'nonexisting-executable') do + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable', 'TM_NONEXISTING_EXECUTABLE') } + end + end + + def test_find_binstub + assert_equal %w(bin/rspec), Executable.find('rspec') + end + + def test_find_binstub_with_rvm + with_rvm_installed do + assert_equal %W(#{@rvm_prefix} bin/rspec), Executable.find('rspec') + end + end + + def test_find_in_gemfile + assert_equal %w(bundle exec rubocop), Executable.find('rubocop') + end + + def test_find_in_gemfile_with_rvm + with_rvm_installed do + assert_equal %W(#{@rvm_prefix} bundle exec rubocop), Executable.find('rubocop') + end + end + + def test_find_in_path + # Of course `ls` is not a Ruby executable, but for this test it makes no difference + assert_equal %w(ls), Executable.find('ls') + end + + def test_find_in_path_with_rvm + with_rvm_installed do + # Of course `ls` is not a Ruby executable, but for this test it makes no difference + assert_equal %W(#{@rvm_prefix} ls), Executable.find('ls') + end + end + + def test_missing_executable + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable') } + end + + def test_missing_executable_with_rvm + with_rvm_installed do + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable') } + end + end + + def test_missing_executable_with_rbenv_and_shim + # Setup an environment where our fake implementation of `rbenv` is in the + # path, as well as our fake shim (`rbenv_installed_shim`). Note that the + # fake implentation of `rbenv` will return an “not found” error if run + # as `rbenv which rbenv_installed_shim` + with_env('PATH' => "#{__dir__}/fixtures/fake_rbenv:#{__dir__}/fixtures/fake_rbenv/shims:#{ENV['PATH']}") do + assert_equal "#{__dir__}/fixtures/fake_rbenv/rbenv", `which rbenv`.chomp + assert system('which -s rbenv_installed_shim') + + # Now for the actual test + assert_raises(Executable::NotFound){ Executable.find('rbenv_installed_shim') } + end + end + + def test_find_precedence + # Make sure we start with a directory with no Gemfile or binstubs, and also with no environment variable. + Dir.mktmpdir do |dir| + Dir.chdir(dir) + + # Using search path has lowest precedence + with_env('PATH' => "#{__dir__}/fixtures/bin:#{ENV['PATH']}") do + assert_equal %w(rspec), Executable.find('rspec') + + # Using a Gemfile comes next + FileUtils.cp(Dir.glob("#{__dir__}/fixtures/sample_project/Gemfile.*"), dir) + assert_equal %w(bundle exec rspec), Executable.find('rspec') + + # Using a binstub has an even higher precedence + FileUtils.cp_r("#{__dir__}/fixtures/sample_project/bin", dir) + assert_equal %w(bin/rspec), Executable.find('rspec') + + # Finally, using an environment variable has highest precedence + with_env('TM_RSPEC' => 'ls') do + assert_equal %w(ls), Executable.find('rspec') + end + end + end + end +end From 761fc19887e3da008a686412efdb3276716a9eac Mon Sep 17 00:00:00 2001 From: milligramme Date: Tue, 31 Jan 2017 11:41:14 +0900 Subject: [PATCH 66/77] Add filetype jb Support .jb file [amatsuda/jb: A simple and fast JSON API template engine for Ruby on Rails](https://github.com/amatsuda/jb) --- Syntaxes/Ruby.plist | 1 + 1 file changed, 1 insertion(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 3e20d6a..a96be6c 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -73,6 +73,7 @@ Scanfile Snapfile Gymfile + jb firstLineMatch ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- From 11ad1b9bb7dded9c289727244b0d549a033c36bb Mon Sep 17 00:00:00 2001 From: Stefan Daschek Date: Mon, 27 Feb 2017 22:54:31 +0100 Subject: [PATCH 67/77] Improve docs (comment) for `Executable.find` --- Support/lib/executable.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Support/lib/executable.rb b/Support/lib/executable.rb index 51e5e6e..80a1383 100644 --- a/Support/lib/executable.rb +++ b/Support/lib/executable.rb @@ -20,6 +20,14 @@ class << self # # `e.message` contains detailed error message. # end # + # To use this functionality in other bundles, simply declare a dependency on + # the Ruby bundle in the bundle’s `info.plist` and then do `require + # "#{ENV['TM_RUBY_BUNDLE_SUPPORT']}/lib/executable"`. See the RSpec bundle + # for an example: + # + # * https://github.com/rspec/rspec.tmbundle/blob/aa50ab/info.plist#L224-L232 + # * https://github.com/rspec/rspec.tmbundle/blob/aa50ab/Support/lib/rspec/mate/runner.rb#L8 + # # Supports the following cases: # # 1. If an appropriate `TM_*` environment variable is present and points to From 59724dc1b68f019abadf8a5cfcbddfbb27ad20c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schwaiger?= Date: Fri, 3 Jun 2016 15:54:32 +0200 Subject: [PATCH 68/77] =?UTF-8?q?Add=20command:=20Reformat=20Document=20(?= =?UTF-8?q?=E2=8C=83=E2=87=A7H)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new command “Reformat Document” formats the current document using the `--auto-correct` option of [RuboCop][]. It also shows information about the formatting status in a floating tooltip. The command displays the information about the formatting status either as black text only, or as colorful text if [aha][] is accessible via `$PATH`. [aha]: https://github.com/theZiz/aha [RuboCop]: https://github.com/bbatsov/rubocop --- Commands/Reformat Document.tmCommand | 52 ++++++++++++++++++ Support/lib/rubocop.rb | 82 ++++++++++++++++++++++++++++ info.plist | 1 + 3 files changed, 135 insertions(+) create mode 100644 Commands/Reformat Document.tmCommand create mode 100644 Support/lib/rubocop.rb diff --git a/Commands/Reformat Document.tmCommand b/Commands/Reformat Document.tmCommand new file mode 100644 index 0000000..7a823c7 --- /dev/null +++ b/Commands/Reformat Document.tmCommand @@ -0,0 +1,52 @@ + + + + + beforeRunningCommand + saveModifiedFiles + command + #!usr/bin/env ruby18 + +# -- Imports ------------------------------------------------------------------- + +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/rubocop' + +# -- Main ---------------------------------------------------------------------- + +RuboCop.reformat + + input + document + inputFormat + text + keyEquivalent + ^H + name + Reformat Document + outputCaret + heuristic + outputFormat + text + outputLocation + discard + requiredCommands + + + command + rubocop + locations + + /usr/local/bin/rubocop + $HOME/.rbenv/shims/rubocop + $HOME/.rvm/scripts/rvm + + + + scope + source.ruby + uuid + 64BB4EE2-2803-410C-B140-EA545A13F250 + version + 2 + + \ No newline at end of file diff --git a/Support/lib/rubocop.rb b/Support/lib/rubocop.rb new file mode 100644 index 0000000..2929d66 --- /dev/null +++ b/Support/lib/rubocop.rb @@ -0,0 +1,82 @@ +# rubocop: disable AsciiComments +# rubocop: disable Style/HashSyntax + +# -- Imports ------------------------------------------------------------------- + +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/executable' + +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' +require ENV['TM_SUPPORT_PATH'] + '/lib/progress' +require ENV['TM_SUPPORT_PATH'] + '/lib/tm/detach' +require ENV['TM_SUPPORT_PATH'] + '/lib/tm/save_current_document' + +# -- Module -------------------------------------------------------------------- + +# This module allows you to reformat files via RuboCop. +module RuboCop + class << self + # This function reformats the current TextMate document using RuboCop. + # + # It works both on saved and unsaved files: + # + # 1. In the case of an unsaved files this method will stall until RuboCop + # fixed the file. While this process takes place the method displays a + # progress bar. + # + # 2. If the current document is a file saved somewhere on your disk, then + # the method will not wait until RuboCop is finished. Instead it will run + # RuboCop in the background. This has the advantage, that you can still + # work inside TextMate, while RuboCop works on the document. + # + # After RuboCop finished reformatting the file, the method will inform you + # – via a tooltip – about the problems RuboCop found in the *previous* + # version of the document. + def reformat + unsaved_file = true unless ENV['TM_FILEPATH'] + TextMate.save_if_untitled('rb') + format_file(locate_rubocop, unsaved_file) + end + + private + + def locate_rubocop + Dir.chdir(ENV['TM_PROJECT_DIRECTORY'] || + File.dirname(ENV['TM_FILEPATH'].to_s)) + begin + Executable.find('rubocop').join ' ' + rescue Executable::NotFound => error + return 'rubocop' if File.executable?(`which rubocop`.rstrip) + TextMate.exit_show_tool_tip(error.message) + end + end + + def format_file(rubocop, unsaved_file) + aha = `which aha`.rstrip.match(/.+/) + output_format = aha ? :html : :text + command = "#{rubocop} -a \"$TM_FILEPATH\" #{'--color | aha' if aha} 2>&1" + if unsaved_file + format_unsaved(command, output_format) + else + format_saved(command, output_format) + end + end + + def format_unsaved(rubocop_command, output_format) + output, success = TextMate.call_with_progress( + :title => '🤖 RuboCop', :summary => 'Reformatting File' + ) do + [`#{rubocop_command}`, $CHILD_STATUS.success?] + end + TextMate.exit_show_tool_tip(output) unless success + TextMate::UI.tool_tip(output, :format => output_format) + TextMate.exit_replace_document(File.read(ENV['TM_FILEPATH'])) + end + + def format_saved(rubocop_command, output_format) + TextMate.detach do + output = `#{rubocop_command}` + TextMate::UI.tool_tip(output, :format => output_format) + end + end + end +end \ No newline at end of file diff --git a/info.plist b/info.plist index 4961e89..d61f440 100644 --- a/info.plist +++ b/info.plist @@ -31,6 +31,7 @@ ------------------------------------ 8646378E-91F5-4771-AC7C-43FC49A93576 EE5F19BA-6C02-11D9-92BA-0011242E4184 + 64BB4EE2-2803-410C-B140-EA545A13F250 ------------------------------------ EE5F1FB2-6C02-11D9-92BA-0011242E4184 FBFC214F-B019-4967-95D2-028F374A3221 From 4a0254fb695135bbaac4a9a76bc8553f91624ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schwaiger?= Date: Mon, 25 Jul 2016 20:50:55 +0200 Subject: [PATCH 69/77] Add help document Currently with help for the new Reformat Document command. --- Commands/Help.tmCommand | 35 +++++++++++++++++++++++++++++++++++ Support/help/help.markdown | 23 +++++++++++++++++++++++ info.plist | 1 + 3 files changed, 59 insertions(+) create mode 100644 Commands/Help.tmCommand create mode 100644 Support/help/help.markdown diff --git a/Commands/Help.tmCommand b/Commands/Help.tmCommand new file mode 100644 index 0000000..7947417 --- /dev/null +++ b/Commands/Help.tmCommand @@ -0,0 +1,35 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash + +. "$TM_SUPPORT_PATH/lib/webpreview.sh" + +html_header "Ruby Bundle Help" "Ruby" +"$TM_SUPPORT_PATH/lib/markdown_to_help.rb" \ + "$TM_BUNDLE_SUPPORT/help/help.markdown" +html_footer + input + none + inputFormat + text + name + Help + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + scope + source.ruby + uuid + 535AF150-5613-44DB-AB41-EBB934A5865F + version + 2 + + \ No newline at end of file diff --git a/Support/help/help.markdown b/Support/help/help.markdown new file mode 100644 index 0000000..dd88813 --- /dev/null +++ b/Support/help/help.markdown @@ -0,0 +1,23 @@ +# Reformat Document + +The command “Reformat Document” – accessible via ^ + + H – formats the current document using the `--auto-correct` option of [RuboCop][]. It also shows information about the formatting status in a floating tooltip. The command displays the information about the formatting status either as black text only, or as colorful text if [aha][] is accessible via `PATH`. + +[aha]: https://github.com/theZiz/aha +[RuboCop]: https://github.com/bbatsov/rubocop + +## RuboCop Version + +Which version of [RuboCop][] “Reformat Document” uses depends on your environment. The command will try the options below in the given order. + +1. The value of the command specified via `TM_RUBOCOP`. +2. An executable version of RuboCop accessible via `bin/rubocop`. +3. The version of `rubocop` installed via [Bundler][]. +4. Any other version of `rubocop` accessible via, + - `/usr/local/bin/rubocop`, + - `$HOME/.rbenv/shims/rubocop` + - or the locations in your `PATH`. + + “Reformat Document” prefers [RVM][] install locations of `rubocop` for all of the applicable options above. + +[Bundler]: https://bundler.io +[RVM]: https://rvm.io \ No newline at end of file diff --git a/info.plist b/info.plist index d61f440..3539dea 100644 --- a/info.plist +++ b/info.plist @@ -28,6 +28,7 @@ ------------------------------------ D5660BB2-C554-4694-9E0F-F20CDB6B9EA0 6EA7AE06-3EA9-497D-A6DE-732DE43DA6E9 + 535AF150-5613-44DB-AB41-EBB934A5865F ------------------------------------ 8646378E-91F5-4771-AC7C-43FC49A93576 EE5F19BA-6C02-11D9-92BA-0011242E4184 From 368ea39081b432892c418e00a0682c1508321d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Schwaiger?= Date: Thu, 20 Apr 2017 12:07:23 +0200 Subject: [PATCH 70/77] Reformat Document: Support additional flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You can now specify additional RuboCop options by setting the environment variable `TM_RUBOCOP_OPTIONS`. For a description of this feature, please take a look at the section “Additional Options” in the Help document (“Bundles” → “Ruby” → “Help”). --- Support/help/help.markdown | 4 ++++ Support/lib/rubocop.rb | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Support/help/help.markdown b/Support/help/help.markdown index dd88813..9fef167 100644 --- a/Support/help/help.markdown +++ b/Support/help/help.markdown @@ -5,6 +5,10 @@ The command “Reformat Document” – accessible via ^ + &1" + command = "#{rubocop} -a \"$TM_FILEPATH\" $TM_RUBOCOP_OPTIONS \ + #{'--color | aha' if aha} 2>&1" if unsaved_file format_unsaved(command, output_format) else From 6628e6c1872eed32c2e8ec5930649ff115fdb998 Mon Sep 17 00:00:00 2001 From: Zach Ovington Date: Thu, 1 Dec 2016 09:54:31 -0500 Subject: [PATCH 71/77] Grammar fix for leading underscore in constants --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index a96be6c..66cbc93 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -383,7 +383,7 @@ match - \b[A-Z]\w*\b + \b[_A-Z]\w*\b name variable.other.constant.ruby From bf1a0e525a28188012acb4612b730f20b7d3ff6e Mon Sep 17 00:00:00 2001 From: deepj Date: Fri, 5 May 2017 16:54:46 +0200 Subject: [PATCH 72/77] Add support for heredocs with embedded XML --- Syntaxes/Ruby.plist | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 66cbc93..7d747ba 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -1059,6 +1059,64 @@ + + begin + (?=(?><<[-~]("?)((?:[_\w]+_|)XML)\b\1)) + comment + Heredoc with embedded xml + end + (?!\G) + name + meta.embedded.block.xml + patterns + + + begin + (?><<[-~]("?)((?:[_\w]+_|)XML)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + text.xml + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + text.xml + + + include + #escaped_char + + + + + begin (?=(?><<[-~]("?)((?:[_\w]+_|)SQL)\b\1)) From ed58eef1e1f2d2fad2adf854bd6c5d6562b38b81 Mon Sep 17 00:00:00 2001 From: Alhadis Date: Thu, 29 Sep 2016 14:15:35 +1000 Subject: [PATCH 73/77] Extend recognition of modelines and hashbangs Supports both emacs and vim types of modelines. --- Syntaxes/Ruby.plist | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 7d747ba..76f2fea 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -76,7 +76,28 @@ jb firstLineMatch - ^#!/.*\bruby|^#\s+-\*-\s*ruby\s*-\*- + (?x) +# Hashbang +^\#!.*(?:\s|\/) +(?:ruby|macruby|rake|jruby|rbx) +(?:$|\s) +| +# Modeline +(?i: + # Emacs + -\*-(?:\s*(?=[^:;\s]+\s*-\*-)|(?:.*?[;\s]|(?<=-\*-))mode\s*:\s*) + ruby + (?=[\s;]|(?<![-*])-\*-).*?-\*- + | + # Vim + (?:(?:\s|^)vi(?:m[<=>]?\d+|m)?|\sex) + (?=:(?=\s*set?\s[^\n:]+:)|:(?!\s*set?\s)) + (?:(?:\s|\s*:\s*)\w*(?:\s*=(?:[^\n\\\s]|\\.)*)?)* + [\s:] + (?:filetype|ft|syntax)\s*= + ruby + (?=\s|:|$) +) keyEquivalent ^~R name From 7c903ec64d2f14a3ac92d7e1cddc636d46b7b2f0 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 30 May 2017 01:03:22 -0500 Subject: [PATCH 74/77] Support ruby version numbers in hashbang lines Ex: #!/usr/bin/env ruby18 -KU --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 76f2fea..aa494e5 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -79,7 +79,7 @@ (?x) # Hashbang ^\#!.*(?:\s|\/) -(?:ruby|macruby|rake|jruby|rbx) +(?:ruby[\.\d]*|macruby|rake|jruby|rbx) (?:$|\s) | # Modeline From 80aab3896d5f5c8d2dfbb3031bfba07abfe004cb Mon Sep 17 00:00:00 2001 From: Alhadis Date: Fri, 28 Apr 2017 23:27:26 +1000 Subject: [PATCH 75/77] Add ruby_executable_hooks to hashbang recognition Adds the name of another executable to the grammar's hashbang-recognition pattern. The executables generated by RubyGems use this as their first line: #!/usr/bin/env ruby_executable_hooks Since the files have no extension, there's nothing to activate the grammar. --- Syntaxes/Ruby.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index aa494e5..4352a52 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -79,7 +79,7 @@ (?x) # Hashbang ^\#!.*(?:\s|\/) -(?:ruby[\.\d]*|macruby|rake|jruby|rbx) +(?:ruby[\.\d]*|macruby|rake|jruby|rbx|ruby_executable_hooks) (?:$|\s) | # Modeline From 4e14bd0a8ffa98a242dc365fb1e26f14e8c5974c Mon Sep 17 00:00:00 2001 From: Caleb Evans Date: Fri, 17 Mar 2017 17:13:52 -0700 Subject: [PATCH 76/77] Add grammar file specific to Gemfiles This allows matching additional methods that are only active in Gemfiles and would be objectionable if matched in standard ruby scripts. --- Syntaxes/Gemfile.tmLanguage | 48 +++++++++++++++++++++++++++++++++++++ Syntaxes/Ruby.plist | 3 +-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 Syntaxes/Gemfile.tmLanguage diff --git a/Syntaxes/Gemfile.tmLanguage b/Syntaxes/Gemfile.tmLanguage new file mode 100644 index 0000000..80cab23 --- /dev/null +++ b/Syntaxes/Gemfile.tmLanguage @@ -0,0 +1,48 @@ + + + + + fileTypes + + Gemfile + + hideFromUser + + name + Gemfile + patterns + + + include + source.ruby + + + begin + \b(?<!\.|::)(gem|git|group|platforms|ruby|source)\b(?![?!]) + captures + + 1 + + name + keyword.other.special-method.ruby.gemfile + + + end + $|(?=#|}) + name + meta.declaration.ruby.gemfile + patterns + + + include + $self + + + + + scopeName + source.ruby.gemfile + uuid + 410F8BB5-7543-4081-A38D-3B69CA92ACE9 + + diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 4352a52..f3ba9c6 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -52,7 +52,6 @@ ru prawn Cheffile - Gemfile Guardfile Hobofile Vagrantfile @@ -290,7 +289,7 @@ begin - \b(?<!\.|::)(require|require_relative|gem)\b + \b(?<!\.|::)(require|require_relative)\b captures 1 From bd70e6aad45e0890cf257fa9a6663dbe1ffecdc1 Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 30 May 2017 01:53:00 -0500 Subject: [PATCH 77/77] Add moreInfoURL to Reformat Document This will provide a link to the Rubocop homepage when not installed. --- Commands/Reformat Document.tmCommand | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Commands/Reformat Document.tmCommand b/Commands/Reformat Document.tmCommand index 7a823c7..c2f68bc 100644 --- a/Commands/Reformat Document.tmCommand +++ b/Commands/Reformat Document.tmCommand @@ -34,6 +34,8 @@ RuboCop.reformat command rubocop + moreInfoURL + http://batsov.com/rubocop/ locations /usr/local/bin/rubocop