Skip to content

Prioritize creating 'final' variables in 'Introduce Variable' refactoring #8782

Description

@danielgomezrico

The 'Introduce Variable' feature currently creates a var instead of a final variable. It should prioritize final when the variable is not reassigned.

Current Behavior:

Starting with:

await Something.initialize(
  resourceAttributes: {
    'service.environment': config.environment,
  }.toAttributes(),
);

Using 'Introduce Variable' results in:

var attributes = {
  'service.environment': config.environment,
}.toAttributes();

await Something.initialize(
  resourceAttributes: attributes,
);

Desired Behavior:

It should generate:

final attributes = {
  'service.environment': config.environment,
}.toAttributes();

await Something.initialize(
  resourceAttributes: attributes,
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions