DefaultPackages icon indicating copy to clipboard operation
DefaultPackages copied to clipboard

Ruby syntax coloring missing for suggested fail/raise statments

Open FichteFoll opened this issue 10 years ago • 2 comments

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

FichteFoll avatar Feb 04 '15 16:02 FichteFoll

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.

aziz avatar Jul 01 '15 02:07 aziz

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.

FichteFoll avatar Jul 01 '15 08:07 FichteFoll