Skip to content

Code Action: Attributes Grouping #831

Description

@Malix-Labs

Is your feature request related to a problem? Please describe.

Currently, there is no code action to group similar attributes

Describe the solution you'd like

Featuring a code action to group similar attributes

Example

On this snippet :

{
  a.b = true;
  a.c = true;
  a = { d = true; };
  a = {
    e.f = true;
    e.g = true;
  };
}

Upon selecting a, running the "Attributes Grouping" Code Action should output :

{
  a = {
    b = true;
    c = true;
    d = true;
    e.f = true;
    e.g = true;
  };
}

Taking in its scope only the selection, or otherwise the current file / module

Also, a Group Recursively variant should execute that code action recursively on nested attributes
So this input :

{
  a.b = true;
  a.c = true;
  a = { d = true; };
  a = {
    e.f = true;
    e.g = true;
  };
}

Upon selecting a, running the "Attributes Grouping Recursively" Code Action should output :

{
  a = {
    b = true;
    c = true;
    d = true;
    e = { 
      f = true;
      g = true;
    };
  };
}

Describe alternatives you've considered

No response

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions