DefaultPackages
DefaultPackages copied to clipboard
Ruby syntax coloring missing for suggested fail/raise statments
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
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.
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.