This command overrides reformat paragraph in the comment.line.number- sign.ruby scope. Here is the description given by rubywrap.rb:
# RubyWrap is a word wrapper utility designed for ruby scripts. It should, # however work for any programming language which uses an initial prefix for # comments (see --prefix). RubyWrap correctly handles indented comments, # indented text within comments, header comments, and many forms of lists. It # will also pass through code without change and detabify.
Any interest in adding this to the Ruby bundle?
rubywrap.rb goes in Ruby.tmbundle/Support/bin.
-- Daniel
On Aug 22, 2006, at 12:57 PM, Daniel Harple wrote:
This command overrides reformat paragraph in the comment.line.number-sign.ruby scope.
I like the look of this command and am for adding it. Let me ask this before I do though. When I enter in this (comment all on one long line):
class Test # This is a really long line designed to test the new comment rewrapping script posted to the TextMate mailing list: end
and push Control-Q, why do I get this (second line not indented):
class Test # This is a really long line designed to test the new comment rewrapping # script posted to the TextMate mailing list: end
If we can fix that, I'm sold.
James Edward Gray II
On Aug 22, 2006, at 2:35 PM, James Edward Gray II wrote:
I like the look of this command and am for adding it. Let me ask this before I do though. When I enter in this (comment all on one long line):
class Test # This is a really long line designed to test the new comment rewrapping script posted to the TextMate mailing list: end
and push Control-Q, why do I get this (second line not indented):
class Test # This is a really long line designed to test the new comment rewrapping # script posted to the TextMate mailing list: end
If we can fix that, I'm sold.
Inserting as a snippet helps, but there is still something odd going on. After running it on this text it correctly wraps:
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
goes to ->
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod # tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, # quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo # consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse # cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat # non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
After running the command on it again it shows up as:
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod # tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, # quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo # consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse # cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat # non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Any idea how to fix that?
-- Daniel
Since the command ought to work for other languages (I gave it a quick test with LaTeX and it seemed fine), how about adding the rubywrap.rb script to Support/bin, rather than Bundles/Ruby.tmbundle/ Support/bin? That way it will be accessible to any command/bundle that wants to call on it (and that provides the right parameters for a given language).
-Alan
On Aug 22, 2006, at 2:48 PM, Alan Schussman wrote:
Since the command ought to work for other languages (I gave it a quick test with LaTeX and it seemed fine), how about adding the rubywrap.rb script to Support/bin, rather than Bundles/ Ruby.tmbundle/Support/bin? That way it will be accessible to any command/bundle that wants to call on it (and that provides the right parameters for a given language).
That's a good point. I'll make the change when I check the command in.
James Edward Gray II
On Aug 22, 2006, at 3:02 PM, Daniel Harple wrote:
Any idea how to fix that?
Well, I found out I wasn't getting the input I excepted. I have “Input” selected as “Selected Text or Scope”, and I was excepting this input text (insertion point is |):
# | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod # tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim # veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
to all be picked up by the “or Scope” section. Turns out it is just the line the point is on. I just changed the command to be scope source.ruby and it seems to work fine, but it will now reformat all comments if you don't have a selection.
-- Daniel
On 23/8/2006, at 14:43, Daniel Harple wrote:
[...] I just changed the command to be scope source.ruby and it seems to work fine, but it will now reformat all comments if you don't have a selection.
We could change the single-line comment rule to also markup the leading whitespace as comment.line.*, that would make the entire “block” of line comments target for the scope selector of comment.line.
On Aug 23, 2006, at 7:50 AM, Allan Odgaard wrote:
On 23/8/2006, at 14:43, Daniel Harple wrote:
[...] I just changed the command to be scope source.ruby and it seems to work fine, but it will now reformat all comments if you don't have a selection.
We could change the single-line comment rule to also markup the leading whitespace as comment.line.*, that would make the entire “block” of line comments target for the scope selector of comment.line.
I went with this option and checked in the command. Let me know if I broke anything...
James Edward Gray II
On Aug 23, 2006, at 9:22 AM, Daniel Harple wrote:
On Aug 23, 2006, at 9:46 AM, James Edward Gray II wrote:
I went with this option and checked in the command. Let me know if I broke anything...
There is a small error:
flags += " --retabify " if ENV["TM_SOFT_TABS"] == "NO"
There should be a `flags = ""` in there.
You can tell I use soft tabs. ;)
How's it look now?
James Edward Gray II
On Aug 23, 2006, at 10:41 AM, James Edward Gray II wrote:
You can tell I use soft tabs. ;)
How's it look now?
text =`echo -n "#{e_as(STDIN.read)}" | ruby "#{ENV ["TM_SUPPORT_PATH"]}/bin/rubywrap.rb" #{flags}`
should be:
text =`echo -n #{e_sh(STDIN.read)} | ruby "#{ENV["TM_SUPPORT_PATH"]}/ bin/rubywrap.rb" #{flags}`
This way it won't eat $variables and other shell specific stuff.
Regards, -- Daniel
On Aug 23, 2006, at 1:34 PM, Daniel Harple wrote:
text =`echo -n "#{e_as(STDIN.read)}" | ruby "#{ENV ["TM_SUPPORT_PATH"]}/bin/rubywrap.rb" #{flags}`
should be:
text =`echo -n #{e_sh(STDIN.read)} | ruby "#{ENV ["TM_SUPPORT_PATH"]}/bin/rubywrap.rb" #{flags}`
This way it won't eat $variables and other shell specific stuff.
This creates some errors... how strange.
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod # tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, # quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo # consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse # cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat # non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
goes to:
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod# # tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim # veniam,# quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea # commodo# consequat. Duis aute irure dolor in reprehenderit in voluptate # velit esse# cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat # cupidatat# non proident, sunt in culpa qui officia deserunt mollit anim id # est laborum.
-- Daniel