atom / language-java

Java package for Atom
Other
62 stars 58 forks source link

Fix the scope of "instanceof" when using with camelCase variable names #231

Closed sadikovi closed 4 years ago

sadikovi commented 4 years ago

Requirements

Description of the Change

This PR updates variables scope to restrict it to the word boundaries. This fixes the case when anything that could potentially match a variable declaration would break syntax highlighting, for example, myVar instanceof MyClass would result being highlighted as my[Var instanceof MyClass] where [..] would become a part of variable declaration.

I generalised the word boundary (\b) check to make sure we never match variable declaration halfway through, particularly for usages of instanceof.

Alternate Designs

None were considered.

Benefits

Fixes the issue of highlighting instanceof.

Possible Drawbacks

This might break certain usages of variable declarations.

Applicable Issues

Fixes #229