KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Method Editor Highlighting Same Items
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: February 26, 2024

The method editor has experienced many quality of life improvments through the versions of 4D. A useful features that is not enabled by default is the highlighting to same variables and fields in a method. This feature allows all of the same items to be automatically highlighted in the method editor for a specific method when interacting with an item.

This option can be configured in the Preferences > 'Methods' Section > 'Options' Tab > 'Highlighting variables and fields' option:


By default the option is set to 'No'.
To enable the feature it can be set to 'On cursor' or 'On selection'

If 'On cursor' is applied, the highlighting occurs when the text cursor is placed on the item, including the positions before the first character and after the last of the item.
if 'On selection' is applied, the highlighting occurs when an item is selected (highlighted).

This feature also applies for object notation attriutes and functions.

This feature is very useful to quickly identify the uses of spefic items. It can also be helpful in identifying typos as the highlight only applies to items with the same spelling, case, and tokenization.

For example if two variables with the same spelling occur in a method but with different cases, the highlight will not apply to the other one.
Interacting with $myVar will only select variables with the same name and casing, $MYVAR will not be highlighted.


The tokenization must also be the same. An attibute and a function with the same name and casing will not be highlighted: