Skip to content

Commit b0decc9

Browse files
Ng Cheuk-fungtpope
authored andcommitted
Fix completion issue about variables with vartype = "gets"
"gets" cannot be a valid vartype, otherwise `eval("#{vartype}.instance_methods")` would cause vim to freeze. Closes #228.
1 parent ef2deea commit b0decc9

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

autoload/rubycomplete.vim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,9 @@ class VimRubyCompletion
704704
cv = eval("self.class.constants")
705705
vartype = get_var_type( receiver )
706706
dprint "vartype: %s" % vartype
707-
if vartype != ''
707+
708+
invalid_vartype = ['', "gets"]
709+
if !invalid_vartype.include?(vartype)
708710
load_buffer_class( vartype )
709711

710712
begin
@@ -732,7 +734,7 @@ class VimRubyCompletion
732734
methods.concat m.instance_methods(false)
733735
}
734736
end
735-
variables += add_rails_columns( "#{vartype}" ) if vartype && vartype.length > 0
737+
variables += add_rails_columns( "#{vartype}" ) if vartype && !invalid_vartype.include?(vartype)
736738

737739
when /^\(?\s*[A-Za-z0-9:^@.%\/+*\(\)]+\.\.\.?[A-Za-z0-9:^@.%\/+*\(\)]+\s*\)?\.([^.]*)/
738740
message = $1

0 commit comments

Comments
 (0)