search

Home  >  Q&A  >  body text

Why doesn't VS Code limit each line to a maximum of 80 characters when saving?

I installed the Prettier extension and set the maximum line width to 80. I also set it up to format on save. When I save the file I'm working on, I find that the comments are still very long. The extension should shorten it to the maximum 80 character width, but it doesn't do that. Do I need to use other settings? Or maybe there is a better extension than Prettier? I just want to use any formatting tool that can eliminate the 200 errors I get when deploying my TypeScript cloud functions.

P粉129731808P粉129731808440 days ago733

reply all(1)I'll reply

  • P粉541565322

    P粉5415653222023-09-17 17:25:38

    Prettier does not format comments, see https://prettier.io/docs/en/rationale.html#comments

    I recommend converting your comments to jsdoc style comments and wrapping them yourself.

    vscode has a nice feature where adding a newline character to a comment will make the new line a comment as well.

    By the way, I can't comment on your post because I don't have enough reputation haha, but you can create a basic prettier profile by pressing Ctrl Shift P and typing prettier,

    reply
    0
  • Cancelreply