Skip to content

Configuration: Automatically add newlines between sequences of language constructs #42

@resolritter

Description

@resolritter

This issue proposes a new configuration which automatically adds newlines between sequences of language constructs

With the following configuration:

"functionExpression.addNewlinesBetween": [
   {
     "match": "AssignmentExpression",
     "followedBy": "ControlFlowExpression"
   }
]

Given the following code

const foo = "bar"
if (foo) {
   baz()
}

With the introduced configuration, a new line would be automatically added between const ... (AssignmentExpression) and if... (ControlFlowExpression).

const foo = "bar"

if (foo) {
   baz()
}

The "AST matching query" syntax is based on this "match"/"followedBy" JSON field member pair, but another idea would be to use tree-sitter's S-expression-based matching. I think this is not needed, though, but I might be oversimplifying the use-case.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions