Skip to content

Incorrect indentation for block params with parenthesis  #344

Open

Description

@ismailallocator
hash.each_with_object({}) do |(key, value), new_hash|
  users.each do |user|
  puts user
end
end

instead of

hash.each_with_object({}) do |(key, value), new_hash|
  users.each do |user|
    puts user
  end
end

inner block end keyword is on same line as the first block end.

Activity

  1. AndrewRadev commented on May 2, 2017

    @AndrewRadev
    Member

    I can't seem to reproduce the issue on the current master branch. Could you check if you've got the latest version from github? If you do, it might be something setting-related, or related to the Vim version. Could you post the output from vim --version, and any vim-ruby settings that you've set?

  2. klieth commented on Aug 31, 2017

    @klieth

    I am also seeing this issue, on OS X 10.12.6 using both vim and neovim:

    $ vim --version
    VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr  4 2017 18:14:54)
    Included patches: 1-898, 8056
    Compiled by root@apple.com
    Normal version without GUI.  Features included (+) or not (-):
    +acl             -farsi           -mouse_netterm   +syntax
    -arabic          +file_in_path    -mouse_sgr       +tag_binary
    +autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
    -balloon_eval    +float           -mouse_urxvt     -tag_any_white
    -browse          +folding         +mouse_xterm     -tcl
    +builtin_terms   -footer          +multi_byte      +terminfo
    +byte_offset     +fork()          +multi_lang      +termresponse
    +cindent         -gettext         -mzscheme        +textobjects
    -clientserver    -hangul_input    +netbeans_intg   +title
    -clipboard       +iconv           +path_extra      -toolbar
    +cmdline_compl   +insert_expand   -perl            +user_commands
    +cmdline_hist    +jumplist        +persistent_undo +vertsplit
    +cmdline_info    -keymap          +postscript      +virtualedit
    +comments        -langmap         +printer         +visual
    -conceal         +libcall         -profile         +visualextra
    +cryptv          +linebreak       +python/dyn      +viminfo
    +cscope          +lispindent      -python3         +vreplace
    +cursorbind      +listcmds        +quickfix        +wildignore
    +cursorshape     +localmap        +reltime         +wildmenu
    +dialog_con      -lua             -rightleft       +windows
    +diff            +menu            +ruby/dyn        +writebackup
    +digraphs        +mksession       +scrollbind      -X11
    -dnd             +modify_fname    +signs           -xfontset
    -ebcdic          +mouse           +smartindent     -xim
    -emacs_tags      -mouseshape      -sniff           -xsmp
    +eval            -mouse_dec       +startuptime     -xterm_clipboard
    +ex_extra        -mouse_gpm       +statusline      -xterm_save
    +extra_search    -mouse_jsbterm   -sun_workshop    -xpm
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
          user exrc file: "$HOME/.exrc"
      fall-back for $VIM: "/usr/share/vim"
    Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
    Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv
    
    $ nvim --version
    nvim --version
    NVIM v0.2.1-313-gd3d0c9a7
    Build type: RelWithDebInfo
    Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20170607-69609-1iz5qrs/build/config -I/tmp/neovim-20170607-69609-1iz5qrs/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/usr/include -I/tmp/neovim-20170607-69609-1iz5qrs/build/src/nvim/auto -I/tmp/neovim-20170607-69609-1iz5qrs/build/include
    Compiled by kai@kai.local
    
    Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui
    For differences from Vim, see :help vim-differences
    
       system vimrc file: "$VIM/sysinit.vim"
      fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-d3d0c9a/share/nvim"
    

    I just ran a :PluginUpdate, so I should have the latest from Github.

  3. AndrewRadev commented on Sep 1, 2017

    @AndrewRadev
    Member

    @klieth Could you also post your .vimrc? The particular settings you have might give me a clue.

  4. klieth commented on Sep 1, 2017

    @klieth

    @AndrewRadev I'm using a mostly vanilla install of maximum-awesome: https://github.com/square/maximum-awesome/blob/master/vimrc and https://github.com/square/maximum-awesome/blob/master/vimrc.local

    The only addition I've made is to add set nohlsearch.

  5. AndrewRadev commented on Sep 2, 2017

    @AndrewRadev
    Member

    Hmm, well, I tried installing this distribution. It was harder than it should be, since the authors seem to be building it exclusively for MacOS (relying on the presence of brew), but I digress. I still can't seem to reproduce the issue with this distribution.

    Could you double-check that vim-ruby is at the latest version? I know you've run a PluginUpdate, but could you cd into ~/.vim/bundle/vim-ruby and run git show HEAD? For me, the latest commit is 074200ffa39b19baf9d9750d399d53d97f21ee07.

  6. matthewd commented on Jul 3, 2018

    @matthewd

    FWIW, I just came here to report this same issue:

    [].each do |(a, b)|
      it "x" do
      puts
    end
    end
    VIM - Vi IMproved 8.1 (2018 May 17, compiled Jun 17 2018 23:04:26)
    macOS version
    Included patches: 1-72
    Compiled by travis@Traviss-Mac-1044.local
    Huge version with MacVim GUI.  Features included (+) or not (-):
    +acl               +farsi             +mouse_netterm     +tag_binary
    +arabic            +file_in_path      +mouse_sgr         +tag_old_static
    +autocmd           +find_in_path      -mouse_sysmouse    -tag_any_white
    -autoservername    +float             +mouse_urxvt       -tcl
    +balloon_eval      +folding           +mouse_xterm       +termguicolors
    +balloon_eval_term -footer            +multi_byte        +terminal
    +browse            +fork()            +multi_lang        +terminfo
    ++builtin_terms    +fullscreen        -mzscheme          +termresponse
    +byte_offset       -gettext           +netbeans_intg     +textobjects
    +channel           -hangul_input      +num64             +timers
    +cindent           +iconv             +odbeditor         +title
    +clientserver      +insert_expand     +packages          +toolbar
    +clipboard         +job               +path_extra        +transparency
    +cmdline_compl     +jumplist          +perl/dyn          +user_commands
    +cmdline_hist      +keymap            +persistent_undo   +vertsplit
    +cmdline_info      +lambda            +postscript        +virtualedit
    +comments          +langmap           +printer           +visual
    +conceal           +libcall           +profile           +visualextra
    +cryptv            +linebreak         +python/dyn        +viminfo
    +cscope            +lispindent        +python3/dyn       +vreplace
    +cursorbind        +listcmds          +quickfix          +wildignore
    +cursorshape       +localmap          +reltime           +wildmenu
    +dialog_con_gui    +lua/dyn           +rightleft         +windows
    +diff              +menu              +ruby/dyn          +writebackup
    +digraphs          +mksession         +scrollbind        -X11
    +dnd               +modify_fname      +signs             -xfontset
    -ebcdic            +mouse             +smartindent       +xim
    +emacs_tags        +mouseshape        +startuptime       -xpm
    +eval              +mouse_dec         +statusline        -xsmp
    +ex_extra          -mouse_gpm         -sun_workshop      -xterm_clipboard
    +extra_search      -mouse_jsbterm     +syntax            -xterm_save
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
          user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
        user gvimrc file: "$HOME/.gvimrc"
    2nd user gvimrc file: "~/.vim/gvimrc"
           defaults file: "$VIMRUNTIME/defaults.vim"
        system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
    Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
    Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
    
    % grep ruby ~/.vimrc
    /Users/matthew/.vimrc:let g:syntastic_ruby_checkers = ['mri', 'rubocop']
    /Users/matthew/.vimrc:let g:ale_fixers = { 'ruby': ['rubocop'] }
    /Users/matthew/.vimrc:  let g:gutentags_ctags_executable_ruby = $HOME.'/bin/ripper-tags'
    /Users/matthew/.vimrc:let g:splitjoin_ruby_curly_braces = 0
    /Users/matthew/.vimrc:let g:splitjoin_ruby_hanging_args = 0
    

    My HEAD is 1e4c6fd.

  7. tpope commented on Jul 6, 2018

    @tpope
    Member

    Can't reproduce either. This is definitely a bug I've encountered in the past, so I'm inclined to think this is a case of the stock files included with Vim loading rather than the latest.

  8. matthewd commented on Jul 6, 2018

    @matthewd

    Hrmm 😕

    Here's my --startuptime... dirty laundry notwithstanding, I think it confirms it's loading in the right order. (~/.vim/ftplugin/ruby.vim is just setlocal ts=2 sts=2 sw=2 et)

    Likewise:

      indentexpr=GetRubyIndent(v:lnum)
            Last set from ~/.common/.vim/bundle/vim-ruby/indent/ruby.vim
      indentkeys=0{,0},0),0],!^F,o,O,e,:,.,=end,=else,=elsif,=when,=ensure,=rescue,==begin,==end,=private,=protected,=public
            Last set from ~/.common/.vim/bundle/vim-ruby/indent/ruby.vim
    

    (~/.vim is a symlink to ~/.common/.vim)

  9. tpope commented on Jul 6, 2018

    @tpope
    Member

    I concede your install looks correct.

  10. matthewd commented on Jul 7, 2018

    @matthewd

    Thanks for confirming; from that, I dug in in hopes of finding some sort of cross-plugin interaction.

    ... but I didn't find one. I think (based on --startuptime and -V) this eliminates all local context:

    vim -N -i NONE -u NONE --noplugin \
    --cmd 'let &runtimepath="~/.vim/bundle/vim-ruby,$VIMRUNTIME"' \
    --cmd 'filetype indent on' --cmd 'syntax on' \
    -c 'setf ruby' -c 'normal =G' - <<EOF
    [].each do |(a, b)|
    it "x" do
    puts
    end
    end
    EOF

    But that still leaves me looking at:

    [].each do |(a, b)|
    	it "x" do
    	puts
    end
    end

    (to be extra sure I also killed $VIMRUNTIME/*/ruby.vim, though they should all no-op because vim-ruby's versions were loaded first)

    I also tried pointing at a fresh clone (now at 6959e10), just to eliminate any weirdness in my existing checkout; no luck there either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions