Skip to content

Update pl branch with textmate/master #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
815e55c
Update grammar TODO
infininight Dec 16, 2014
880adad
Add keyword `fail` to grammar
sanssecours Feb 8, 2015
993af89
Use updated documentation command on 10.10
infininight May 17, 2015
944e8de
Toggle Hash Syntax: Support multiple carets
estum Jul 30, 2015
6c5431d
Toggle String/Symbol: Support multiple carets
estum Jul 30, 2015
6b4061d
Make the Toggle String/Symbol command work on hashkeys
Kimtaro Sep 23, 2013
535dd86
Add "i⇥" to insert inspect
elia Feb 3, 2014
2b650de
Use single quotes on require
elia Feb 3, 2014
5c9f974
Add @ expantion to memoized ivar
elia Feb 10, 2014
c4e60f5
Don’t use ||= inside #initialize
elia Jul 20, 2014
a7cfbc0
Skip multiple extensions in the class name
elia Jul 20, 2014
0b5c0f3
Point to ruby 1.8 shim
elia Jul 20, 2014
4551f55
Improve scoping of class names
infininight Sep 13, 2015
9187908
Add command to run script in Terminal
Mar 29, 2015
f9c884e
Syntax checker now populates the gutter
Feb 19, 2015
843e7e5
Add Cheffile and Hobofile to recognized file types
walterdolce Nov 30, 2014
a6a1701
Overhaul matching of percent delimited literals
infininight Sep 16, 2015
ada19a2
Improve scoping of regular expression components
infininight Sep 19, 2015
e053c50
Embedded code snippet (#{}) functions in percent literals
infininight Sep 19, 2015
97608b6
Match argument names on the second line of definition
infininight Oct 26, 2015
cc447f0
Add puppetfile and fix definition of capfile
Ma27 Dec 25, 2015
0bf80a3
Support old-style hashes without spaces before/after `=>`
noniq Jan 19, 2016
3e88a97
Add support for <<~ heredocs
GBH Feb 20, 2016
295b5ce
Add != to method name regexes
kevinsawicki Mar 28, 2014
35becc0
Allow ^ and !~ as method names
infininight Mar 8, 2016
0472ab7
Add kernel methods as `support.function.kernel.ruby`
citrus Apr 10, 2014
92c77b6
Correct matching of autoload?, iterator?, and exit!
infininight Mar 8, 2016
005bcab
Change iterator? to `keyword.control.pseudo-method`
hgoodman Feb 14, 2016
2ae484f
Scope self as variable.language.self
kevinsawicki Oct 6, 2014
04cbd46
Allow symbols to start with $
infininight Mar 8, 2016
f28dec9
Support &&= as augmented assignment
Nov 27, 2014
350b38f
Support Emacs file mode comments
tobiashm Apr 13, 2015
27a3ada
Fix comparable operator symbol highlighting
nikhilofthesouth May 19, 2015
b20afae
Fix require special highlighting on method calls
nikhilofthesouth May 22, 2015
4e8cbf2
Prefer `::` over consecutively matching two `:`
nikhilofthesouth May 22, 2015
2f4eaaa
Distinguish :: separators for methods/constants
nikhilofthesouth May 23, 2015
ade64e7
Fixed def method *args formatting
mamenama Oct 25, 2015
a09cba6
Fix for multiple method arguments as symbols with parentheses
mamenama Oct 30, 2015
d62dfcd
Give symbols in method argument a symbol hashkey scope
mamenama Oct 30, 2015
28911d4
Add stabby lambda (->) operator
mamenama Nov 6, 2015
f2322b7
Change stabby lambda token to match lambda scope
mamenama Nov 11, 2015
28a5c28
Add refinement methods
elifoster Nov 20, 2015
ea72103
Add refine snippet (refine→)
elifoster Nov 20, 2015
6a26751
Cleanup info.plist
infininight Mar 8, 2016
5fa1aed
Fixes blockpipe formatting
mamenama Nov 23, 2015
c2d44b0
Improve punctuation scope of blockpipe arguments
infininight Mar 8, 2016
1cec56d
Add support for Ruby 2.3's new "safe navigation operator"
rubysolo Dec 30, 2015
5932b27
Add support for `private_class_method`
envygeeks Jan 3, 2016
61ada97
Add pre-defined variable $-w
infininight Mar 9, 2016
1d33d62
Don't allow [ characters inside a character-class
infininight Mar 9, 2016
5d68373
Added arb to fileTypes for ruby language
OscarBarrett Jan 11, 2016
e1ff600
Add Dangerfile fileType
Mar 22, 2016
9daa7dc
Add Brewfile to fileTypes
mistydemeo Apr 5, 2016
da02341
Adding `private def` to folding rules
Jul 12, 2016
1094f3f
Add .vagrantplugins to fileTypes
kitsunde May 18, 2016
44bc21c
Match 'do', no trailing spaces
hediyi Jun 25, 2016
518437a
Remove the escaping of - =
hediyi Jun 26, 2016
06efe7d
Remove the escaping of , ;
hediyi Jun 26, 2016
6dc051e
Refine grammar of logical operators
hediyi Jun 29, 2016
6f856f5
Avoid exiting percent literals early
infininight Jul 18, 2016
8f4e77c
Don't allow `=` as an arbitrary delimiter for % strings
infininight Jul 18, 2016
ad08f8b
Match parenthesis inside arguments as a pair
infininight Aug 9, 2016
f0ab9fb
Add fastlane-related extensions
yeswolf Aug 25, 2016
5bd7c0a
Decrease indent when line contains ‘})’
sorbits Sep 6, 2016
f49a2f5
Implement `RubyUtils.find_executable`
noniq Aug 18, 2016
761fc19
Add filetype jb
milligramme Jan 31, 2017
11ad1b9
Improve docs (comment) for `Executable.find`
noniq Feb 27, 2017
59724dc
Add command: Reformat Document (⌃⇧H)
sanssecours Jun 3, 2016
4a0254f
Add help document
sanssecours Jul 25, 2016
368ea39
Reformat Document: Support additional flags
sanssecours Apr 20, 2017
6628e6c
Grammar fix for leading underscore in constants
zoo1 Dec 1, 2016
bf1a0e5
Add support for heredocs with embedded XML
deepj May 5, 2017
ed58eef
Extend recognition of modelines and hashbangs
Alhadis Sep 29, 2016
7c903ec
Support ruby version numbers in hashbang lines
infininight May 30, 2017
80aab38
Add ruby_executable_hooks to hashbang recognition
Alhadis Apr 28, 2017
4e14bd0
Add grammar file specific to Gemfiles
caleb531 Mar 18, 2017
bd70e6a
Add moreInfoURL to Reformat Document
infininight May 30, 2017
4a5f85d
Merge branch 'master' of https://github.com/textmate/ruby.tmbundle in…
adaedra Jul 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions Commands/@variable ||= memoized.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby18

line_number = ENV['TM_LINE_NUMBER'].to_i - 1
# line = STDIN.lines.to_a[line_number-1]
# method_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

ivar_name = (method_name != 'initialize' &amp;&amp; method_name) || 'instance_variable'
assignment = method_name == 'initialize' ? '=' : '${2:||}='

print "@${1:#{ivar_name}} #{assignment} "
print '${3:$1}' unless ENV['TM_CURRENT_WORD']
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>name</key>
<string>@variable</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>snippet</string>
<key>outputLocation</key>
<string>atCaret</string>
<key>scope</key>
<string>source.ruby</string>
<key>tabTrigger</key>
<string>@</string>
<key>uuid</key>
<string>20ACDEEE-1F1D-4CFB-8B66-940E902693EF</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
19 changes: 16 additions & 3 deletions Commands/Check ERB Syntax.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@
<string>nop</string>
<key>command</key>
<string>#!/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&gt;&amp;1`.chomp
result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2&gt;&amp;1`
puts result
TextMate.go_to :line =&gt; $1 if result =~ /-:(\d+):/</string>
puts result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2&gt;&amp;1`

if result =~ /-:(\d+):(.*)/
TextMate.go_to :line =&gt; $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
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
Expand Down
18 changes: 15 additions & 3 deletions Commands/Check Ruby Syntax.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@
<string>nop</string>
<key>command</key>
<string>#!/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&gt;&amp;1`
puts result
TextMate.go_to :line =&gt; $1 if result =~ /-:(\d+):/
puts result = `"${TM_RUBY:=ruby}" -wc 2&gt;&amp;1`

if result =~ /-:(\d+):(.*)/
TextMate.go_to :line =&gt; $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
</string>
<key>input</key>
<string>document</string>
Expand Down
17 changes: 13 additions & 4 deletions Commands/Convert Ruby hash to 1_9 syntax.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
<key>command</key>
<string>#!/usr/bin/env ruby18

print case str = STDIN.read
when /=&gt;/; str.gsub(/:(\w+)[\s]+=&gt;[\s]+/, '\1: ')
when /(\w+):/; str.gsub(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =&gt;\\2")
else; str
def toggle_ruby_hash_syntax(str)
case str
when /\=&gt;/
str.gsub!(/:(\w+)\s*=&gt;\s*/, '\1: ')
when /(\w+):/
str.gsub!(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =&gt;\\2")
else
str
end
end

while str = $stdin.gets
print toggle_ruby_hash_syntax(str)
end
</string>
<key>fallbackInput</key>
Expand Down
35 changes: 35 additions & 0 deletions Commands/Help.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/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</string>
<key>input</key>
<string>none</string>
<key>inputFormat</key>
<string>text</string>
<key>name</key>
<string>Help</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>html</string>
<key>outputLocation</key>
<string>newWindow</string>
<key>scope</key>
<string>source.ruby</string>
<key>uuid</key>
<string>535AF150-5613-44DB-AB41-EBB934A5865F</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo "&lt;meta content='0;URL=file://$("${TM_BUNDLE_SUPPORT}/bin/ri_lookup" "${T
<key>outputLocation</key>
<string>newWindow</string>
<key>scope</key>
<string>source.ruby &amp; attr.os-version.10.9</string>
<string>source.ruby</string>
<key>semanticClass</key>
<string>lookup.define.ruby</string>
<key>uuid</key>
Expand Down
2 changes: 1 addition & 1 deletion Commands/Lookup in Documentation.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<key>outputLocation</key>
<string>toolTip</string>
<key>scope</key>
<string>source.ruby</string>
<string>source.ruby &amp; attr.os-version.10.6, source.ruby &amp; attr.os-version.10.7, source.ruby &amp; attr.os-version.10.8</string>
<key>semanticClass</key>
<string>lookup.define.ruby</string>
<key>uuid</key>
Expand Down
54 changes: 54 additions & 0 deletions Commands/Reformat Document.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveModifiedFiles</string>
<key>command</key>
<string>#!usr/bin/env ruby18

# -- Imports -------------------------------------------------------------------

require ENV['TM_BUNDLE_SUPPORT'] + '/lib/rubocop'

# -- Main ----------------------------------------------------------------------

RuboCop.reformat
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>^H</string>
<key>name</key>
<string>Reformat Document</string>
<key>outputCaret</key>
<string>heuristic</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>discard</string>
<key>requiredCommands</key>
<array>
<dict>
<key>command</key>
<string>rubocop</string>
<key>moreInfoURL</key>
<string>http://batsov.com/rubocop/</string>
<key>locations</key>
<array>
<string>/usr/local/bin/rubocop</string>
<string>$HOME/.rbenv/shims/rubocop</string>
<string>$HOME/.rvm/scripts/rvm</string>
</array>
</dict>
</array>
<key>scope</key>
<string>source.ruby</string>
<key>uuid</key>
<string>64BB4EE2-2803-410C-B140-EA545A13F250</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
82 changes: 82 additions & 0 deletions Commands/Run Script in Terminal.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/bin/bash
[[ -z "$TM_FILEPATH" ]] &amp;&amp; TM_TMPFILE=$(mktemp -t rubyInTerm)
: "${TM_FILEPATH:=$TM_TMPFILE}"; cat &gt;"$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 &lt;&lt;"RUBY"
str = ENV['STR']
str = str.gsub(/'/, "'\\\\''")
str = str.gsub(/[\\"]/, '\\\\\\0')
print "'#{str}'"
RUBY
}

iTerm_running () {
ruby &lt;&lt;"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 &lt;&lt;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 &lt;&lt;- 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
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>^@R</string>
<key>name</key>
<string>Run in Terminal</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>discard</string>
<key>scope</key>
<string>source.ruby</string>
<key>uuid</key>
<string>4444CB9A-8345-4116-8349-C359ADDA390C</string>
<key>version</key>
<integer>2</integer>
</dict>
</plist>
26 changes: 19 additions & 7 deletions Commands/Toggle String:Symbol.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@
<key>command</key>
<string>#!/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" =&gt; :symbol
when /("|')(\w+)\1/
str.gsub!(/("|')(\w+)\1/, ':\2')
# :symbol =&gt; "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
</string>
<key>fallbackInput</key>
Expand All @@ -28,7 +40,7 @@ end
<key>output</key>
<string>replaceSelectedText</string>
<key>scope</key>
<string>source.ruby string.quoted, source.ruby constant.other.symbol.ruby</string>
<string>source.ruby string.quoted, source.ruby constant.other.symbol, source.ruby constant.other.symbol.hashkey.ruby</string>
<key>uuid</key>
<string>B297E4B8-A8FF-49CE-B9C4-6D4911724D43</string>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion Preferences/Folding.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>foldingStartMarker</key>
<string>(?x)^
(\s*+
(module|class|def(?!.*\bend\s*$)
(module|class|(private\s+)?def(?!.*\bend\s*$)
|unless|if
|case
|begin
Expand Down
2 changes: 1 addition & 1 deletion Preferences/Miscellaneous.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>settings</key>
<dict>
<key>decreaseIndentPattern</key>
<string>^\s*([}\]](,?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b)</string>
<string>^\s*([}\]]([,)]?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b)</string>
<key>increaseIndentPattern</key>
<string>(?x)^
(\s*
Expand Down
19 changes: 19 additions & 0 deletions Preferences/Symbol List: Class.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Symbol List: Class</string>
<key>scope</key>
<string>meta.class.ruby</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<true/>
<key>symbolTransformation</key>
<string>s/^\s*class\s+//</string>
</dict>
<key>uuid</key>
<string>64AFA1C0-BDC7-42DE-B3B5-C597538975E9</string>
</dict>
</plist>
Loading