Skip to content

rocket auto-alignment: should detect trailing ; as a boundary to stop alignment #158

@lelutin

Description

@lelutin

In the case where multiple resources are defined in the same block with a ; to end the definition of one resource, the current auto-alignment will continue going up or down until it encounters a curly brace. this means that all of the different resources will be aligned at the same level, which is usually not useful.

For example in the following snippet with the cursor placed at the right of the final content:

file {  
  'blah': content => 'bloh';
  'moo': content => 'meuh';
  'verylongfilename': content 
}

typing => there will produce this:

file {  
  'blah': content             => 'bloh';
  'moo': content              => 'meuh';                                                                        
  'verylongfilename': content => 
}

whereas the following would rather be expected:

file {  
  'blah': content => 'bloh';
  'moo': content => 'meuh';
  'verylongfilename': content => 
}

the part of the auto-alignment function that discovers lines above and below the current one should also check for a trailing ; (with possible spaces and comment at its right) and stop the discovery at that point. when going up, stop without the line containing the ;, but when going down, include the line that contains the ; in the zone that needs alignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions