Closed graceful-potato closed 4 years ago
Good catch. Support for leading underscores was added in https://github.com/textmate/ruby.tmbundle/commit/6628e6c1872eed32c2e8ec5930649ff115fdb998 without further explanation. The correct regexp should have been '\b_?[A-Z]\w*\b'
though, to not match variables starting with an underscore.
However, Ruby obviously does not support constants starting with an underscore:
_FOO = 1
self.class.const_defined?(:_FOO)
# ~> -:2:in `const_defined?': wrong constant name _FOO (NameError)
# ~> from -:2:in `<main>'
So this fix totally makes sense. Thanks!
Ruby constant should begins with an uppercase letter.
_variable_name
is not a constant