Skip to content

Variable Naming

The Variable Naming feature suggests variable names for parameters and local variables in functions making it easier to understand the purpose of the variables in the function.

How it works

The variable naming feature works on a per-function basis. It submits a representation of the function to the Sidekick service, which uses a language model to suggest names for the variables.

How to use it

During Sidekick's process for making general suggestions, Sidekick may generate suggestions for naming variables. To apply these suggestions, select each suggestion you want to apply (using Cntrl + Click or Shift + Click depending on the desired selection scope) and perform any of the following actions:

  • Click on the Accept selected suggestions button
  • Right-click and select Apply

To manually request and apply suggestions for naming variables in the current function, perforom the following actions:

  • Select Suggest Variable Names from the hamburger menu in the Sidekick Suggestions sidebar, or select Suggest Variables Names for Current Function from the Plugins->Sidekick main menu
  • Select each generated suggestion you want to apply following the same actions above for applying general suggestions

Alternatively, you can click on a suggested item to navigate to the variable definition. You can then rename that variable directly using the Binary Ninja UI. At that point, the suggestion items that refer to that variable will be removed from the list. The remaining suggestions can be reviewed, accepted, or rejected.

How to customize it

The Sidekick.suggestions.variable_naming_convention setting controls the naming convention. The following options are available:

Value Description
any Use whatever names are generated by the model.
snake Formats the variable name as snake_case.
camel Formats the variable name as camelCase.
pascal Formats the variable name as PascalCase.