Skip to content
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

Foldable comments off by one line when at the start of a class #424

Closed
ajvondrak opened this issue Aug 19, 2020 · 1 comment
Closed

Foldable comments off by one line when at the start of a class #424

ajvondrak opened this issue Aug 19, 2020 · 1 comment
Assignees
Labels

Comments

@ajvondrak
Copy link

I have two test files that I'm opening with gvim -u NONE +'let g:ruby_fold = 1' +'let g:ruby_foldable_groups = "#"' +"source $PWD/syntax/ruby.vim" from the directory of this repo.

In the first file, I have an empty line preceding the comments on the first method.

/tmp/good.rb

class Good

  # line 1
  # line 2
  # line 3
  def folds_correctly
  end

  # line 1
  # line 2
  # line 3
  def also_folds_correctly
  end
end

All three lines get folded together for both methods.

vim window showing both methods' comments being folded completely

In the second file, I omit the blank line before the comments on the first method.

/tmp/bad.rb

class Bad
  # line 1
  # line 2
  # line 3
  def does_not_fold_correctly
  end

  # line 1
  # line 2
  # line 3
  def folds_correctly
  end
end

The first line does not get folded into the comment on the first method. The second method's comment still gets all its lines folded, though.

vim window showing the first method's comment folding excluding its first line, but the second method's comment folding including its first line

In case it helps, I ran a git bisect on commits since 2019-01-01:

$ git bisect log
git bisect start
# bad: [fe2e520c62dfe10b9bc192b6c2651ef0519b1070] An additional note about hanging indentation
git bisect bad fe2e520c62dfe10b9bc192b6c2651ef0519b1070
# good: [37bc2a10f561b91020938f670b6901636a9f3b63] Clean up file headers
git bisect good 37bc2a10f561b91020938f670b6901636a9f3b63
# good: [33d9c2b4a68594833855356d46e58aa11a3b7b65] Fix == operator highlighting with no leading whitespace
git bisect good 33d9c2b4a68594833855356d46e58aa11a3b7b65
# bad: [25074cbdda1a917c73fcba8b8955153cdbbe97d1] Fix highlighting of required trailing keyword parameters
git bisect bad 25074cbdda1a917c73fcba8b8955153cdbbe97d1
# good: [552cd6f28d33c722daf489d38bcdc5689167ca89] Highlight ., &., and :: when nobbling keywords
git bisect good 552cd6f28d33c722daf489d38bcdc5689167ca89
# bad: [b54b4e31de5c5b844386f869ba6851053d3f590c] Normalise test formatting
git bisect bad b54b4e31de5c5b844386f869ba6851053d3f590c
# good: [4abc4340abff09698fc5c8fe91dec87e3c3e2255] Add rudimentary syntax highlighter testing
git bisect good 4abc4340abff09698fc5c8fe91dec87e3c3e2255
# bad: [4c91c8e06225830c0b31b927673e49c68aa57082] Optionally highlight pseudo operators
git bisect bad 4c91c8e06225830c0b31b927673e49c68aa57082
# good: [142712c4d1b480fd34d9945071245f619cb9a266] Fix highlighting of capitalized bare bang/predicate method calls
git bisect good 142712c4d1b480fd34d9945071245f619cb9a266
# first bad commit: [4c91c8e06225830c0b31b927673e49c68aa57082] Optionally highlight pseudo operators

If this is to be believed, the folding broke in 4c91c8e.

I'm running the following version of vim:

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 26 2020 06:16:12)
macOS version
Included patches: 1-539
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +fullscreen        +num64             +textobjects
+browse            -gettext           +odbeditor         +textprop
++builtin_terms    -hangul_input      +packages          +timers
+byte_offset       +iconv             +path_extra        +title
+channel           +insert_expand     +perl              +toolbar
+cindent           +job               +persistent_undo   +transparency
+clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           -python            +visual
+comments          +linebreak         +python3           +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
+cscope            +localmap          +rightleft         +wildignore
+cursorbind        +lua               +ruby              +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con_gui    +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       -X11
+digraphs          +mouse             -sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   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-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin -lpython3.8 -framework CoreFoundation  -lruby.2.7     
@ajvondrak
Copy link
Author

Looks like it works for modules, though:

module Test
  # line 1
  # line 2
  # line 3
  def method
  end
end

vim window showing the previous module with all the comment lines folded together

So I think the class keyword probably has something to do with it. The previously identified commit certainly looks suspicious in that regard: 4c91c8e#diff-6d7e8ac4bbcd03c0bb043b7fac5692d0R354

@dkearns dkearns self-assigned this Aug 21, 2020
@dkearns dkearns added the syntax label Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants