jskinner / DefaultPackages

Old bug tracker for Sublime Text's "Default Packages", e.g. bad syntax highlighting
http://web.archive.org/web/20150524043750/https://www.sublimetext.com/forum/viewtopic.php?f=2&t=12095
26 stars 2 forks source link

Incorrect Syntax Hightlighting of Ruby when variable has name 'gem' #133

Closed alazarchuk closed 8 years ago

alazarchuk commented 9 years ago

OS: Ubuntu Linux (x64) ST Version: Build 3083

The Ruby code:

if ver then
  next if File.exists?(File.join(gem_dir, "#{gem}-#{ver}"))
else File.exists?(gem_dir)
  list = Dir.entries(gem_dir)
  next if list.length > 0
end

The bug exists only when the local variable has name 'gem' and used inside double quoted string.

image

wbond commented 8 years ago

Since the usage of bundler in Ruby is so pervasive, and a Gemfile is just ruby code, highlighting of gem seems to make sense to me. I don't think we want to remove this.

FichteFoll commented 8 years ago

@wbond the highlighting still breaks in an unacceptable way, at least in the screenshot.

I don't have experience in Ruby, but gem does not seem to actually be a keyword despite its scope?