Skip to content

[Formatter] add new options for blank linesΒ #65453

Open

Description

πŸ” Search Terms

formatter blank line

βœ… Viability Checklist

⭐ Suggestion

I'm using the new TypeScript formatter ("tsgo" one). In Zed here are my settings:

"TypeScript": {
  "formatter": "language_server",
  "format_on_save": "on",
  "language_servers": [
    "typescript-ls",
    "!vtsls",
    "!typescript-language-server",
    "..."
  ]
},

I'd like the formatter to perform more cleanup for example removing some unnecessary blank lines

interface Foo {
    bar: boolean;

}

Would be formatted to

interface Foo {
    bar: boolean;
}

Also when I'm programming in Rust I like the blank_lines_upper_bound settings with default value 1. Meaning

const foo = "foo";


const bar = "bar";

would be formatted to

const foo = "foo";

const bar = "bar";

There is also another settings with rustfmt called blank_lines_lower_bound but I personally don't change the default 0 value.

If I'm not mistaken, this is currently not possible to configure such behaviors with the default TypeScript formatter.
Would that be possible to implement them?

πŸ“ƒ Motivating Example

N/A

πŸ’» Use Cases

  1. What do you want to use this for?
    Better auto-formatting when saving my TypeScript files

  2. What shortcomings exist with current approaches?
    We need to manually clean all those unnecessary blank lines

  3. What workarounds are you using in the meantime?
    Using Prettier instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions