From dirk.traulsen at lypso.de Wed Jan 2 03:37:19 2008 From: dirk.traulsen at lypso.de (Dirk Traulsen) Date: Wed, 02 Jan 2008 09:37:19 +0100 Subject: indentation problem in e.g. array and hash definitions Message-ID: <477B5B4F.5019.27E4F277@dirk.traulsen.lypso.de> Hi! Here is the indentation glitch #3. My example here is the indentation of array and hash definitons. I hope this helps. Thanks Dirk Please see the following, which is also attached as a file: #---------------------------------------# # file automatically indented with gg=G # #---------------------------------------# #vimfiles # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ #7.1 # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ # Nice indentation with '()': Array.new(var_1, var_2, var_3 ) # but '[]' and '{}' are not recognized: arr = [var_1, var_2, var_3 ] hsh = {var_1 => 1, var_2 => 2, var_3 => 3 } -------------- next part -------------- A non-text attachment was scrubbed... Name: indent_error_3.rb Type: application/octet-stream Size: 644 bytes Desc: not available Url : http://rubyforge.org/pipermail/vim-ruby-devel/attachments/20080102/05fe4f58/attachment.obj From dirk.traulsen at lypso.de Wed Jan 2 03:31:10 2008 From: dirk.traulsen at lypso.de (Dirk Traulsen) Date: Wed, 02 Jan 2008 09:31:10 +0100 Subject: indentation problem with 'until' as a modifier Message-ID: <477B59DE.15738.27DF513E@dirk.traulsen.lypso.de> Hi! First I want say that I really appreciate what you have achieved with vim-ruby, which is a great help for me and a real pleasure to use. A big Thank You to everybody here who is or was involved! Alas, it is not perfect. I have found some glitches, I want to report here. To allow to discuss them seperately, I will report them in three different mails. I will always attach a file to show the correct indentation. I hope this helps. Thanks Dirk Please see the following, which is also attached as a file: #---------------------------------------# # file automatically indented with gg=G # #---------------------------------------# #vimfiles # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ #7.1 # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ # The non-breaking of the line with '\' is not recognized, # so that 'until' is recognized as a beginning loop and not # as the modifier it is here. print 'Do you want to delete this (y/n)? ' \ until (result = gets.chomp.downcase).match(/^[yn]$/) puts 'result: ' + result # Here also 'until' is not recognized as a modifier begin print 'Do you want to delete this (y/n)? ' end until (result = gets.chomp.downcase).match(/^[yn]$/) puts 'result: ' + result -------------- next part -------------- A non-text attachment was scrubbed... Name: indent_error_1.rb Type: application/octet-stream Size: 913 bytes Desc: not available Url : http://rubyforge.org/pipermail/vim-ruby-devel/attachments/20080102/e0cc9c77/attachment.obj From dirk.traulsen at lypso.de Wed Jan 2 03:33:34 2008 From: dirk.traulsen at lypso.de (Dirk Traulsen) Date: Wed, 02 Jan 2008 09:33:34 +0100 Subject: indentation of blocks dependant on comment line Message-ID: <477B5A6E.27641.27E1845A@dirk.traulsen.lypso.de> Hi! Here is the indentation glitch #2. As you will see, the indentation of a block is dependant on a comment line above. I hope this helps. Thanks Dirk Please see the following, which is also attached as a file: #---------------------------------------# # file automatically indented with gg=G # #---------------------------------------# #vimfiles # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ #7.1 # indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns Exp $ # syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope Exp $ module Enumerable def group_by r = Hash.new each{|e| (r[yield(e)] ||= []) << e} r end end # These are 4 nearly identical examples. There are two differences: # 1. 'do/end' vs. '{}' blocks # 2. outcommenting of the arr definition in the first line. # # In example 1+3 there is no indent during the dbl definition. # In example 2+4 after outcommenting of arr the dbl def. is indented # In example 2 the closing '}' of the blocks breaks the indent. # In example 4 the indent is not reset after 'pop'. # # 1. The indentation should not be dependant on the outcommenting # of arr. # 2. I would prefer the indentation of the complete dbl definition # like in example 4, but naturally with the indent reset afterwards # and the same for the {} blocks. # ############ block with {} ########################################## arr = %w(house cat car ball cat) dbl = arr.group_by {|n| Digest::MD5.hexdigest(n) }.delete_if { |k,v| v.size < 2 }.sort.transpose.pop p dbl ############ block with {} and arr outcommented ##################### #arr = %w(house cat car ball cat) dbl = arr.group_by {|n| Digest::MD5.hexdigest(n) }.delete_if { |k,v| v.size < 2 }.sort.transpose.pop p dbl ############ block with do/end ###################################### arr = %w(house cat car ball cat) dbl = arr.group_by do |n| Digest::MD5.hexdigest(n) end.delete_if do |k,v| v.size < 2 end.sort.transpose.pop p dbl ############ block with do/end and arr outcommented ################# #arr = %w(house cat car ball cat) dbl = arr.group_by do |n| Digest::MD5.hexdigest(n) end.delete_if do |k,v| v.size < 2 end.sort.transpose.pop p dbl ###################################################################### -------------- next part -------------- A non-text attachment was scrubbed... Name: indent_error_2.rb Type: application/octet-stream Size: 2212 bytes Desc: not available Url : http://rubyforge.org/pipermail/vim-ruby-devel/attachments/20080102/67128de5/attachment.obj From vim-ruby-devel at tpope.info Mon Jan 21 10:25:32 2008 From: vim-ruby-devel at tpope.info (Tim Pope) Date: Mon, 21 Jan 2008 09:25:32 -0600 Subject: indentation problem with 'until' as a modifier In-Reply-To: <477B59DE.15738.27DF513E@dirk.traulsen.lypso.de> References: <477B59DE.15738.27DF513E@dirk.traulsen.lypso.de> Message-ID: <20080121152532.GV24734@michael.tpope.us> On Wed, Jan 02, 2008 at 09:31:10AM +0100, Dirk Traulsen wrote: > First I want say that I really appreciate what you have achieved with > vim-ruby, which is a great help for me and a real pleasure to use. A > big Thank You to everybody here who is or was involved! > > Alas, it is not perfect. I have found some glitches, I want to report > here. To allow to discuss them seperately, I will report them in three > different mails. > > I will always attach a file to show the correct indentation. > > I hope this helps. Thanks for these, Dirk. Ruby indenting is probably the hardest part of this set of runtime files, so a lot of these may go unaddressed unless someone submits a patch. Still, I will add them and any further ones you forward to my to do list. It appears a couple of the issues you submitted may already be fixed in CVS. Cheers, Tim