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

Ruby syntax coloring missing for suggested fail/raise statments #99

Open FichteFoll opened 9 years ago

FichteFoll commented 9 years ago

From @jptalton on February 4, 2015 16:40

OS: OSX, ST: Stable 3065

ruby suggests using:

fail Exception, 'msg'  # no good :(

over:

  fail Exception.new('msg') # good, but not prefered :(

however, when doing so, the syntax highlighter for ruby no longer detects the single word "Exception" as a Class References. This also happens in a few other misc. places, but this one seems to catch my eye the most.

Copied from original issue: SublimeTextIssues/Core#665

aziz commented 9 years ago

I believe this is not a bug. the Exception in fail Exception, 'msg' # no good :( has a variable.other.constant.ruby scope which is all that can be inferred from a capitalized name in Ruby. But when you call .new(something) on it you give the syntax parser more clues to infer that it's a class and hence the support.class.ruby scope.

FichteFoll commented 9 years ago

According to https://manual.macromates.com/en/language_grammars#naming_conventions,

support — things provided by a framework or library should be below support.

the support scope is only meant for names provided by the language, not custom ones. Thus it should only be applied to default classes or exceptions and not to custom exceptions determined by casing.