Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 23 additions & 9 deletions Commands/Start Comments.tmCommand
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!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/ruby

comments = &lt;&lt;-"end-comment"
##
# $0
#
# @author $USER
end-comment
print comments.chomp</string>
file_contents = STDIN.readlines

# The next line, if is a method description, deconstruct it and generate all the helpers
# for it.
next_line = file_contents[ENV["TM_LINE_NUMBER"].to_i]

if next_line =~ /^\s*def\s*([^\s\(]+)\s*\(?\s*((?:\w+\s*[^,\)]*\s*,?\s*)*)\s*\)?\s*$/

puts "#"

parameters = Regexp.last_match(2)

# Get the count of parameters found so that I can create better indexes of methods

parameters.scan(/(?:(\w+)\s*(?:[^,\)]*)\s*)/).each_with_index do |param,index|
puts "# @param [${#{1 + (index * 2)}:Types}] #{param} ${#{2 + (index * 2)}:Description}"
end

end

print "#"</string>
<key>fallbackInput</key>
<string>none</string>
<key>input</key>
<string>none</string>
<string>document</string>
<key>name</key>
<string>Start Comments</string>
<key>output</key>
Expand Down
1 change: 1 addition & 0 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<string>11314DEC-DEC2-4F8C-BC58-C5484D9651B9</string>
<string>4AF61B71-12D3-4F78-9983-3C9AD2D6582D</string>
<string>B8AD763C-830B-4A5B-AD40-5E7B90C83F0A</string>
<string>4DA00FEA-56BB-4C69-91B7-29DF70184035</string>
</array>
<key>uuid</key>
<string>99270392-BF3F-45A6-91EF-08CAB0314D8F</string>
Expand Down